Hi Josh,

If I understood you correctly, it sounds like your cost function is returning a 
nan at some point. IMO, it is not really the solver’s fault to handle those 
things, especially since different compiler options and compilers will vary in 
how they handle nans (aggressive optimization usually turns off IEEE compliant 
arithmetic). I would recode the function to catch those situations.

Best,
Grey 

> On Jul 8, 2016, at 12:08 PM, Joshua Milam <jomi...@mix.wvu.edu> wrote:
> 
> To whom it may concern,
> 
> I have recently started learning programming and have been evaluating the 
> many NLopt algorithms as solvers for a 7 dimensional problem. I am using 
> nlopt-2.4.2 on a linux system and my problem is coded in C++.
> 
> One combination that seems to do very well is using G_MLSL_LDS with LN_PRAXIS 
> as the local solver. The problem I am having is that the result returned by 
> the "nlopt::optomize" function is "-nan". I put a print statement in my 
> objective (cost) function so that the value of the cost function is printed. 
> Based on this, I know that the algorithm solves the problem and stops when 
> the function value reaches below 0.0001 (set with the "set_stopval" 
> function). Unfortunately, the last value of the cost function and the 
> resulting values of the optimization variables are not the ones returned as 
> results by the "optimize" function. Instead, the results given are the "-nan" 
> value of the cost function and the optimization variables corresponding to 
> the last time the cost function equaled "-nan".
> 
> I followed the code to the "get_minf" function near line:260 in the file 
> "mlsl/mlsl.c" and then onto "rb_tree_min" function near line:280 in the 
> "util/redblack.c" file. Once at this point, I realized that I had better ask 
> for help or suggestions. I want the results of the optimization to be the 
> values from the last run of the cost function and not the ones when "-nan". 
> Surely, there is a very easy way of patching the NLopt code to accomplish 
> this but with my limited programming experience I am not sure how. I'm not 
> really sure how these functions work and am very inexperienced with pointers. 
> Anyway, i thought that a conditional using the "isnan(-minf)" or something 
> would solve the issue, I just don't know where.
> 
> Any and all help will be appreciated,
> Thanks,
> Josh
> _______________________________________________
> NLopt-discuss mailing list
> NLopt-discuss@ab-initio.mit.edu
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss


_______________________________________________
NLopt-discuss mailing list
NLopt-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to