Hi,
The best approach is to set the lower and upper bounds on the variables (or impose other problem constraints) to exclude the region where the NaN evaluations occur. Then you should set the user option
'honorbnds', 1 via the "knitro_options" function to enforce that all iterates stay inside the bounds throughout the optimization. Otherwise you might try to modify your objective function so that it doesn't evaluate to NaN. You should also experiment
with all four Knitro algorithms via the 'algorithm' option to see if a non-default algorithm works better.
If you want to share your model, we can try to take a look at it when we get a chance.
Best regards,
-Richard
|
knitro_opts = knitro_options('algorithm',1, 'outlev', 4, 'gradopt', 1, 'hessopt', 2, 'maxfevals', 'maxit', 1e5, 'scale', 1, 'xtol', 1e-5, 'opttol', 1e-5, 'UseParallel', true, 'bar_maxcrossit',0, 'ms_enable', 1, 'ms_deterministic', 1, 'ms_maxsolves', 30, 'ms_num_to_save', 5, 'ms_savetol', 0.01, 'ms_terminate', 0, 'par_msnumthreads', 10, 'ms_maxbndrange', 5);
[that, ~, eflag, output, ~, grad, hess]=knitro_nlp(f,x0,[],[],[],[],lb,ub,[],[],knitro_opts,[]);
Is there a way to use parallel multi-start? Thanks a lot!
Hi,
Unfortunately the MATLAB Mex interface is not thread-safe so it is not possible to use the internal Knitro multi-start
procedure in parallel in knitromatlab. You can, however, try to implement your own custom multi-start at the MATLAB level using the MATLAB provided parallel tools (i.e. using a MATLAB "parfor" loop). This requires that you have the MATLAB Parallel Computing Toolbox however. There is an example of how to do this in the Knitro distribution at "knitromatlab/examples/exampleMultiStart.m".
Best regards,
-Richard
|
Hi,
It may be that your version of Knitro pre-dates the inclusion of that example. Attached is the example.
Best regards,
-Richard
|