How to solve these optimization problems?

Hey I seem to have trouble solving optimization problems and I’m stuck on these two. I was wondering if anyone can help point me to the right direction. Also, are any resources or advice to help improve optimization problems in general?

Arnold has n items arranged in a row. Each items has one of 100 different ids (0 to 99). He wants to mix all these items together. At each step, he mixes two items that stand next to each other, and puts the resulting item in their place. When mixing two items a and b, the resulting item will have id≡(a+b)(modn)id\equiv (a+b)\pmod n st n = 100. Also, the amount of broken code generated when mixing two items of a and b is a*ba*b. Find out what is the minimum amount of error that Arnold can get when mixing all the items together.
Dan made a processor on which n tasks are to be run. As soon as one task finishes running, the next one can start. Each task j has a length l_jl_j giving the amount of time that the task takes to run and a weight w_jw_j giving the importance of the task. Define the completion time c_jc_j of a task j as the total time that elapses before task j finishes running. For example, if we run task 1 that has length 3 and then task 2 that has length 5, then the completion time of task 1 is 3, and the completion time of task 2 is 3+5=8. The goal is to minimize: \sum_{j=0}^n\sum_{j=0}^n w_j*c_jw_j*c_j.

Note: I didn’t know if this was supposed to be posted on math or cs se. I posted it here since I couldn’t find a way to even solve it with a mathematical approach and I thought it was more appropriate here but if it doesn’t belong here, just tell me and I will remove it.

=================

  

 

Hi, welcome to Math.SE. Please note that this is a MathJax-enabled site; use the facility. For a quick info, check this meta Math.SE post.
– MAFIA36790
2 days ago

  

 

np thanks. will fix
– diyi
2 days ago

=================

=================