我必须生成所有的帕累托点,但我得到了这个错误。
using JuMP
using Gurobi
using Gadfly
using Ipopt
m = Model(solver=IpoptSolver(print_level=0))
@variable(m, 0.1 <= x <= 1.0)
@variable(m, 0.0 <= y <= 1.0)
pareto_x = Float16[]
pareto_y = Float16[]
for i in 0.0:0.1:1.0
for j in 0.0:0.1:1.0
f1(x,y) = x
f2(x,y) = (2.0-exp(-((y-0.2)/0.004)^2)-0.8*exp(-((y-0.6)/0.4)^2) )/x
@NLobjective(m, Min, i*f1(x,y) + j*f2(x,y) ) ## <<-- ERROR HERE
status = solve(m)
println("Objective value: ", getobjectivevalue(m))
x_opt = getvalue(x)
y_opt = getvalue(y)
println("x = ", x_opt)
println("y = ", y_opt)
push!(pareto_x,f1(x_opt,y_opt))
push!(pareto_y,f2(x_opt,y_opt))
end
end
plot(x=pareto_x, y=pareto_y)