Ipopt solver: no method matching setvartype!


#1

Dear colleagues, I was using juliabox (because for the moment I can no install solvers in my julia) and I am using the same model that I use for my model with linear costs. This is the model:

#dispatch with quadratic cost function
dispatchQ = Model(solver=IpoptSolver())

# define variables
@variable(dispatchQ, p[1:nGen, 1:T] >= 0)  #power
@variable(dispatchQ, u[1:nGen, 1:T], Bin) #binary for SC-SD
@variable(dispatchQ, s[1:nGen, 1:T] >= 0) #normal startup

# objective is to minimize total cost
@objective(dispatchQ, Min, sum(c[j]*p[j,t]*p[j,t]+b[j]*p[j,t]+a[j]+s[j,t] for j = 1:nGen for t = 1:T))

# power balance
@constraint(dispatchQ, consPowerBalance[t=1:T],  sum(p[j,t] for j = 1:nGen) == L[t])


# variable Pmax and Pmin
@constraint(dispatchQ, consPMax[j=1:nGen, t=1:T],  p[j,t] <= PMax[j,t] * u[j,t])
@constraint(dispatchQ, consPMin[j=1:nGen, t=1:T],  p[j,t] >= PMin[j,t] * u[j,t])

# simplified startup costs
@constraint(dispatchQ, conss1[j=1:nGen, t=1],  s[j,t] >= d[j] * (u[j,t] - X0[j]))
@constraint(dispatchQ, conss2[j=1:nGen, t=2:T],  s[j,t] >= d[j] * (u[j,t] - u[j,t-1]))

# print model (do not be afraid)
print(dispatchQ)

# save the status
status = solve(dispatchQ)

The model is printed but when the code arrives to the solver part I get this error:

MethodError: **no method matching setvartype!**(::Ipopt.IpoptMathProgModel, ::Array{Symbol,1})
Closest candidates are:
  setvartype!(::MathProgBase.SolverInterface.NonlinearToLPQPBridge, ::Array{Symbol,1}) at /home/jrun/.julia/v0.6/MathProgBase/src/SolverInterface/nonlinear_to_lpqp.jl:88
  setvartype!(::MathProgBase.SolverInterface.ConicToLPQPBridge, ::Any) at /home/jrun/.julia/v0.6/MathProgBase/src/SolverInterface/conic_to_lpqp.jl:318
  setvartype!(::MathProgBase.SolverInterface.LPQPtoConicBridge, ::Any) at /home/jrun/.julia/v0.6/MathProgBase/src/SolverInterface/lpqp_to_conic.jl:273

Stacktrace:
 [1] optimize!(::MathProgBase.SolverInterface.NonlinearToLPQPBridge) at /home/jrun/.julia/v0.6/MathProgBase/src/SolverInterface/nonlinear_to_lpqp.jl:69
 [2] #solve#116(::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::JuMP.Model) at /home/jrun/.julia/v0.6/JuMP/src/solvers.jl:175
 [3] solve(::JuMP.Model) at /home/jrun/.julia/v0.6/JuMP/src/solvers.jl:150

Is something related with the variables supported? Does Ipopt not support binary variables?


#2

Ipopt doesn’t support binary variables. You may want to have a look at using Gurobi, CPLEX, or Pajarito.jl instead.