Can fmincon output all the considered 'x' values for minimisation of the function f(x)?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Laurence hutton-smith
le 18 Mai 2015
Commenté : Laurence hutton-smith
le 19 Mai 2015
I am currently using fmincon to minimise a function f(x), I was hoping there would be a way I could, along with the value of x that minimises f(x), also output all the values of x that led to that final value?
I would like to be able to visualise the minimiser results through the iterations, as the function f(x) is of a quite high dimension.
0 commentaires
Réponse acceptée
John D'Errico
le 18 Mai 2015
As Alan points out, the output function is perfect for your purpose. Of course, you could simply put a display into your objective function.
Or you could use a global variable in the objective function to accumulate all of the calls in one array. Since it is global, when done, you will have a big array that contains all of the calls.
One other approach is to accumulate the calls in one persistent variable in the objective function. Then make one last call to the function and have your objective return that variable as the SECOND returned argument to your objective.
Note that if fmincon is differentiating the function using finite differences, there will be multiple calls with nearly the exact same values repeated, but with tiny differences. You can drop them out.
Finally, you ask about visualizing the calls in some high number of dimensions. This will be a serious problem. I think you may not appreciate that it is difficult. Unless of course, you just happen to have one of the really new hyper-spatial monitors, that can display data in a vast number of dimensions. They are very expensive, and always seem to break down. Ok, sarcasm off, the point is, you cannot easily visualize data in a high number of dimensions. You can try to use tools like Chernoff faces, etc., but expect it to be difficult.
Plus de réponses (1)
Alan Weiss
le 18 Mai 2015
You can use an output function for this purpose. In fact, the example in that link shows how to do exactly what you want.
Alan Weiss
MATLAB mathematical toolbox documentation
0 commentaires
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!