I am trying to do a sensitivity analysis in Julia using JuMP
. Here is my code:
using JuMP, Plots, Gurobi
m=Model(with_optimizer(Gurobi.Optimizer))
@variable(m, x>=0)
@variable(m, y>=0)
@variable(m, k>=0)
k = 0
while k<=1
φ(x,y,k)=3*x+k*y
@objective(m, Max, φ(x,y,k))
@constraint(m, 2*x-4>=0)
@constraint(m, y-0.5*x>=0)
pl=optimize!(m)
k=k+0.2
end
The problem is that I get an error:
UndefVarError: k not defined
What am I missing?
Clp
solver instead of theGurobi
solver – Yorgos