# Optimal values dynamic programming and mathematical programming

조회 수: 4(최근 30일)
Luca Repetto 2021년 7월 31일
댓글: Luca Repetto 2021년 8월 3일
Hello,
I have a problem where I have to minimize the weighted tardiness of 10 jobs on one machine.
With a dynamic programming algorithm I have found that the optimal cost is 102.
To verify the correctness of the algorithm I implemented the same problem in mathematical programming and the solution, in the field of fval, has the value of 154.4.
Do you think that the fval value is the same of the cost that I've found in dynamic programming or is another different value?

댓글을 달려면 로그인하십시오.

### 답변(1개)

John D'Errico 2021년 7월 31일
The crystal ball is very foggy today. What does it matter what we think? We know nothing about what you actually did, if the code you wrote is correct. So what we think is a bit irrelevant.
What do we know? We know that you tried to solve a problem with potentially multiple local minima. You tried to solve it twice, and you got differnt results. That MAY be due to the fact that different solvers can converge to different solutions. It may just mean you totally screwed something up, and you did not really solve the same problem twice you think you were solving. Hey, it does happen, far more often than you may "think". In fact, that is quite common. But it is also common for solvers to not converge to the same solution.
So as a guess, I "think" you don't understand that different solvers can converge to various local minima. Even running the same solver twice can do that, since some solvers are stochastic in nature.
If you really want more information, I can consult my MATLAB tarot cards, perhaps read some tea leaves. :) If you want a better response, then you would need to actually show the code you used and wrote, along with any necessary data, so that someone could verify what you did.
##### 댓글 수: 1표시숨기기 없음
Luca Repetto 2021년 8월 3일
I'm sorry if I wasn't clear with the question.
Can you tell me, what value represents fval in the syntax of an optimization problem like this?
prob = optimproblem;
[sol, fval, output] = solve(prob);

댓글을 달려면 로그인하십시오.

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!