问题描述
你能帮我吗?在下面的代码中,Ipopt求解器用于求解非线性模型。但似乎此求解器不适合正态分布。您能帮助我哪个非线性求解器对求解模型有用?非常感谢。
using JuMP,Gurobi,Ipopt
#parameters--------------------------------------------------------
sig=0.86;
#---------------------------------------------------------------------------
ALT= Model(optimizer_with_attributes(Juniper.Optimizer,"nl_solver"=>optimizer_with_attributes(Ipopt.Optimizer,"print_level" => 0),"mip_solver"=>optimizer_with_attributes(Gurobi.Optimizer,"logLevel" => 0),"registered_functions" =>[Juniper.register( :f,1,f; autodiff = true)])
)
# variables-----------------------------------------------------------------
f(x) = cdf(normal(0,1),x);
JuMP.register(ALT,:f,f; autodiff = true);
@variable(ALT,h >= 0);
@variable(ALT,L >= 0);
@variable(ALT,n,Int);
#-------------------------------------------------------------------
@NLexpression(ALT,k7,1-f(L-sig*sqrt(n))+f(-L-sig*sqrt(n)));
#constraints--------------------------------------------------------
@NLconstraint(ALT,f(-L) <= 1/400);
#-------------------------------------------------------------------
@NLobjective(ALT,Min,1/k7)
optimize!(ALT)
有此错误
ERROR: undefvarerror: normal not defined
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)