Is there a way to plot the output of my function for fmincon evaluations?
Show older comments
I want to plot the progression of my objective as it is being optimized by fmincon. I was hoping the output would be in a regular pattern (for my three variable function, something like: 1. del_x_step, 2. del_y_step, 3. del_z_step, [evaluate gradient, etc], 4. new position) so I could just plot every 4th step. However upon viewing the outputs, I see that the function seems to bounce around a bit between successive iterations.
Norm of First-order
Iter F-count f(x) Feasibility Steplength step optimality
0 4 -1.848033e+04 3.097e+01 8.456e+01
1 9 -2.084884e+04 0.000e+00 7.000e-01 6.711e+01 3.159e+02
2 22 -2.086112e+04 0.000e+00 4.035e-02 2.496e+00 3.015e+02
3 26 -2.227361e+04 0.000e+00 1.000e+00 1.393e+01 1.816e+02
4 37 -2.228014e+04 0.000e+00 8.235e-02 2.194e+00 7.227e+01
5 41 -2.243568e+04 0.000e+00 1.000e+00 1.467e+00 2.271e+02
6 47 -2.270094e+04 0.000e+00 4.900e-01 9.539e+00 8.021e+01
7 51 -2.271830e+04 0.000e+00 1.000e+00 3.290e+00 1.466e+02
8 60 -2.272500e+04 0.000e+00 1.681e-01 1.128e+00 1.370e+02
9 91 -2.273291e+04 0.000e+00 6.571e-05 1.702e+00 7.642e+01
10 95 -2.276594e+04 0.000e+00 1.000e+00 2.046e+00 1.681e+02
11 120 -2.276670e+04 0.000e+00 5.585e-04 6.198e-04 1.664e+02
12 126 -2.276754e+04 0.000e+00 4.900e-01 3.616e-02 1.656e+02
13 148 -2.276926e+04 0.000e+00 1.628e-03 3.320e-04 1.684e+02
14 175 -2.276926e+04 0.000e+00 6.571e-05 3.230e-05 1.684e+02
Optimization stopped because the relative changes in all elements of x are
less than options.TolX = 1.000000e-06, and the relative maximum constraint
violation, 0.000000e+00, is less than options.TolCon = 1.000000e-06.
Optimization Metric Options
max(abs(delta_x./x)) = 7.75e-07 TolX = 1e-06 (default)
relative max(constraint violation) = 0.00e+00 TolCon = 1e-06 (default)
My questions are:
1. Is there a straightforward explanation for the additional function evaluations adding to the f-count? 2. Is it reasonable to just plot the output at each iteration (e.g. at 4, 9, 22, etc shown above)?
Accepted Answer
More Answers (0)
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!