Why fmincon gives different objfun values with the same values of variables?

1 次查看(过去 30 天)
Dear all, I am trying to use fmincon to maximize an objective function, which includes a system of odes to be solved. I tried to store the x values (x is a vector of 3 elements) and fval values at every iteration. Below is the part of the message that fmincon gave me:
Local minimum possible. Constraints satisfied. fmincon stopped because the size of the current step is less than the default value of the step size tolerance and constraints are satisfied to within the default value of the constraint tolerance. criteria details
x: [4x3 double]
fval: [4x1 double]
iterations: 4
funcCount: 68
constrviolation: 0
stepsize: 2.4333e-10
algorithm: 'interior-point'
firstorderopt: 1.6806e+09
cgiterations: 39
message: 'Local minimum possible. Constraints satisfied.
fmincon s...'
>>My question is why the last two values of fval are different while the values of x are identical (shown in the table). I also checked the intermediate values (values at each funevaluations), and found that the objective function was called for a number of times with the same set of x vales!!!!
Could anyone please explain the possible reasons??
Many many thanks in advance.
Best regards Mahmudul

回答(1 个)

Walter Roberson
Walter Roberson 2015-8-28
Before you display the values for that table, give the command
format long g
and then look at the values again. You will probably find that the values differ after the 5th decimal point.
  6 个评论

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by