You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining an Opt object using, for example, the MMA algorithm the parameters structure is empty. I would think the correct behavior is to populate with the default values for each parameter available to that algorithm.
using NLopt
opt = Opt(:LD_MMA, 10)
opt.params
> NLopt.OptParams()
Additionally querying for example haskey(opt.params, "inner_maxeval") returns false. Since this calls the C function nlopt_has_param I'd expect it to return true because the MMA algorithm supports the inner_maxeval parameter (according to the relevant PR). I can imagine this is extra confusing without knowing the available parameters ahead of time. Is there a list of internal parameters for each algorithm? I didn't see it in the NLopt generic documentation.
Setting some value with setindex!(opt.params, <value>, <parameter name>) works and populates the dict, but allows any string as a parameter name -- not just those which would be allowed by that algorithm.
Related to this, what is the purpose for requiring a default value to be passed to get()? I find it confusing that the "default value" passed as an argument is returned. How can you use that function to query the current value?
The text was updated successfully, but these errors were encountered:
NLopt doesn't currently export a global list of the algorithms and any parameters that they allow and their defaults. The only way to check optional parameters for a given algorithm is currently to look up that algorithm in the NLopt manual.
So this would need to be changed in the underlying C library first.
(get allows a default value in order to conform to the generic AbstractDict interface.)
Closing because this isn't possible to achieve in NLopt.jl. We can revisit if a future version of NLopt supports this.
It will also work by default if the C library starts reporting nlopt_has_param as true for the default parameters, so we probably don't even need to do anything here.
When defining an
Opt
object using, for example, the MMA algorithm the parameters structure is empty. I would think the correct behavior is to populate with the default values for each parameter available to that algorithm.Additionally querying for example
haskey(opt.params, "inner_maxeval")
returnsfalse
. Since this calls the C functionnlopt_has_param
I'd expect it to returntrue
because the MMA algorithm supports theinner_maxeval
parameter (according to the relevant PR). I can imagine this is extra confusing without knowing the available parameters ahead of time. Is there a list of internal parameters for each algorithm? I didn't see it in the NLopt generic documentation.Setting some value with
setindex!(opt.params, <value>, <parameter name>)
works and populates the dict, but allows any string as a parameter name -- not just those which would be allowed by that algorithm.Related to this, what is the purpose for requiring a default value to be passed to
get()
? I find it confusing that the "default value" passed as an argument is returned. How can you use that function to query the current value?The text was updated successfully, but these errors were encountered: