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
It seems, ForcedStop termination doesn't work for a number of gradien-based algorithms (or these algorithms handle ForcedStop condition differently). The MWE is the following:
using NLopt
function myfunc(x::Vector, grad::Vector)
if x[1] > 5.
throw(NLopt.ForcedStop())
elseif length(grad) > 0
grad[1] = 1.
end
return x[1]
end
for alg in [:LN_NELDERMEAD, :LN_SBPLX, :LN_COBYLA, :LN_PRAXIS, :LN_BOBYQA, :LD_MMA, :LD_SLSQP, :LD_CCSAQ, :LD_LBFGS, :LD_TNEWTON, :LD_VAR2, :LD_VAR1]
opt = Opt(alg, 1)
opt.upper_bounds = [1e3]
opt.xtol_rel = 1e-3
opt.max_objective = myfunc
(minf,minx,ret) = optimize(opt, [1.])
println("$alg returned $ret status")
end
LN_NELDERMEAD returned FORCED_STOP status
LN_SBPLX returned FORCED_STOP status
LN_COBYLA returned FORCED_STOP status
LN_PRAXIS returned FORCED_STOP status
LN_BOBYQA returned FORCED_STOP status
LD_MMA returned FORCED_STOP status
LD_SLSQP returned FORCED_STOP status
LD_CCSAQ returned FORCED_STOP status
LD_LBFGS returned FAILURE status
LD_TNEWTON returned FAILURE status
LD_VAR2 returned FAILURE status
LD_VAR1 returned FAILURE status
The text was updated successfully, but these errors were encountered:
They all return FORCED_STOP, it was just that some solvers were failing before x[1] was greater than 5.
julia>using NLopt
julia>functionmyfunc(x::Vector, grad::Vector)
throw(NLopt.ForcedStop())
return x[1]
end
myfunc (generic function with 1 method)
julia>for alg in [:LN_NELDERMEAD, :LN_SBPLX, :LN_COBYLA, :LN_PRAXIS, :LN_BOBYQA, :LD_MMA, :LD_SLSQP, :LD_CCSAQ, :LD_LBFGS, :LD_TNEWTON, :LD_VAR2, :LD_VAR1]
opt =Opt(alg, 1)
opt.upper_bounds = [1e3]
opt.xtol_rel =1e-3
opt.max_objective = myfunc
(minf,minx,ret) =optimize(opt, [1.])
println("$alg returned $ret status")
end
LN_NELDERMEAD returned FORCED_STOP status
LN_SBPLX returned FORCED_STOP status
LN_COBYLA returned FORCED_STOP status
LN_PRAXIS returned FORCED_STOP status
LN_BOBYQA returned FORCED_STOP status
LD_MMA returned FORCED_STOP status
LD_SLSQP returned FORCED_STOP status
LD_CCSAQ returned FORCED_STOP status
LD_LBFGS returned FORCED_STOP status
LD_TNEWTON returned FORCED_STOP status
LD_VAR2 returned FORCED_STOP status
LD_VAR1 returned FORCED_STOP status
Hello @stevengj
It seems,
ForcedStop
termination doesn't work for a number of gradien-based algorithms (or these algorithms handleForcedStop
condition differently). The MWE is the following:The text was updated successfully, but these errors were encountered: