understand how fmincon works through an example
10 views (last 30 days)
Show older comments
Dear All,
In my research I used fmincon a lot and I have been trying to understand how it works for a long time. Due to the lack of mathematical profession, I am really struggling with understanding the dazzling documentation. Could some one just illustrate the algorithm to me through this example as follows. It is minimizing the function 5x-ln(x) with the starting point 0.1 and constraint 0<x<5.
if true
options = optimset('OutputFcn', @outfun,'Display','iter');
x=fmincon(@(x) 5*x-log(x),0.1,-1,0,[],[],0,5,[],options);
end
here the function Output is defines as
if true
%
function stop = outfun(x, optimValues, state)
stop = false;
hold on;
plot(x,'.');
drawnow
end
end
If I run this code, I get the optima result is x=0.2 and the intermediate results are
if true
%
Max Line search Directional First-order
Iter F-count f(x) constraint steplength derivative optimality Procedure
0 2 2.80259 -0.1
1 9 2.6395 -0.2531 0.0313 -5 1.15
2 11 2.61755 -0.2266 1 -1.05 0.586
3 13 2.61008 -0.1929 1 -0.586 0.183
4 15 2.60945 -0.2009 1 -0.183 0.0233
5 17 2.60944 -0.2 1 -0.0233 0.000826
Local minimum possible. Constraints satisfied.
fmincon stopped because the predicted change in the objective function
is less than the default value of the function tolerance and constraints
are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
No active inequalities.
end
Now my questions are (I give up to understand the stuff about constraints for now)
- The second column in the tables is F-count, which means the Number of function evaluation. It seems the numbers for each iteration is increasing. How does fmincon choose the numbers and how it decides which point to evaluate?
- It seems after examining several points in each iteration, fmincon somehow decide to move on to next iteration by using Direction derivative. First, how it decides it can move on? Second, is the direction derivative is the same as in Newton's method? If not, what is it? And since it is just a direction, I suppose fmincon still needs to decide the step-size? What is the step-size then?
Could someone please help me about with these two question even I know there are still far more things to learn about fmincon.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!