which is more accurate/good/feasible 'optimtool' or a same function involked in command window?

1 view (last 30 days)
Hi
I am optimizing a non linear function using 'fmincon'. when i am using this command in matlab command window i am getting some results which is different than when i am using it with 'optimtool' user interface for optimization. Both the cases have same input data but output is different for some variables.
P.S. My objective function calls many user defined functions while calculation. Is it the reason??

Accepted Answer

Shashank Prasanna
Shashank Prasanna on 25 Mar 2013
You should get the exact same result if you call it in command line or through the GUI, they use the same functions. There could be couple of reasons you may be seeing different results, some may be:
1) The options are different. You can change the options in the command line using OPTIMSET. In the GUI you can just enter them. The options holds several tolerances and that will affect your stopping criterion.
2) Do you have something that is random in your objective function or initial conditions? If yes you can fix the seed of the internal random number generator using the RNG function.
3) Check if the constraints are the same.

More Answers (0)

Categories

Find more on Get Started with Optimization Toolbox 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!