运行失败的原因
一般问题
发布于 2025-05-12 15:57:05
查看 14过去412天
function f(x)
z=(x[1]-2)^2+(x[2]-1)^2+0.04/(-0.25x[1]^2-x[2]^2+1)+5(x[1]-2*x[2]+1)^2
return z
end
using TyOptimization
x0=[0,0]
opt1 = optimoptions(:fminunc, Algorithm="quasi-newton",HessianApproximation="bfgs")
x1,=fminunc(f,x0,opt1)
opt2 = optimoptions(:fminunc,Algorithm="quasi-newton",HessianApproximation="dfp")
x2,=fminunc(f,x0,opt2)
opt3 = optimoptions(:fminunc,Algorithm="trust-region",SpecifyObjectiveGradient="false")
x3,=fminunc(f,x0,opt3)
println(x1)
println(x2)
println(x3)
所属专栏:Syslab基础平台
产品信息:Syslab科学计算环境