fmincon test the same parameters multiple times

Hello,
I want to minimise a function that i call costfunctionSTEAM. I have implemented that part as follows:
sixmin = @(X) (costfunctionSTEAM(data,X,...));
xmin = fmincon(sixmin,initX,[],[],[],[],LB,HB);
Now my problem is that fmincon seems to test each set of X parameters several times in a row. In costfunctionSTEAM I have included a display of all parameters and the output " Cost" from costfunctionSTEAM for each time it is called. And, I get the same line printed upp to 7 times i a row, but most often 6 times. Example of output during the run:
Cost = 1.6124, with R2 = 30.2503 11.65 0, with R1 = 22.0866 1.54525 0, with P = 0.21135 0.78865 0
Cost = 1.6124, with R2 = 30.2503 11.65 0, with R1 = 22.0866 1.54525 0, with P = 0.21135 0.78865 0
Cost = 1.6124, with R2 = 30.2503 11.65 0, with R1 = 22.0866 1.54525 0, with P = 0.21135 0.78865 0
Cost = 1.6124, with R2 = 30.2503 11.65 0, with R1 = 22.0866 1.54525 0, with P = 0.21135 0.78865 0
Cost = 1.6124, with R2 = 30.2503 11.65 0, with R1 = 22.0866 1.54525 0, with P = 0.21135 0.78865 0
Cost = 1.6124, with R2 = 30.2503 11.65 0, with R1 = 22.0866 1.54525 0, with P = 0.21135 0.78865 0
Cost = 1.6124, with R2 = 30.2503 11.65 0, with R1 = 22.0866 1.54525 0, with P = 0.21135 0.78865 0

 采纳的回答

fmincon has to build up the Jacobian matrix dC/dpi (C: costfunction, pi: parameter i).
For this end, fmincon calls the costfunction (number of parameters + 1) times with
p1,p2,p3,...,p6
p1+deltap1,p2,p3,...,p6
p1,p2+deltap2,p3,...,p6
...
p1,p2,p3,...,p6+deltap6
If you enhance precision of your output, you will see that the parameters are not the same, but that in each call one parameter differs slightly from the parameter values of the "main" call with p1,p2,...,p6.
Best wishes
Torsten.

2 个评论

Thanks Torsten, I will look in to this by increasing the output precision.
Are the deltap related to the x tolerance?
I don't know how it is implemented internally.
Maybe according to
Best wishes
Torsten.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by