You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to solve a sequence of LP with a changing constant value in a linear constraint. I picked a solution from the doc at http://www.juliaopt.org/JuMP.jl/v0.20.0/constraints/ but I got an error which I could summarize in this example:
using JuMP
using Clp
m =Model(with_optimizer(Clp.Optimizer, LogLevel=0))
@variable(m, 0<= x)
@variable(m, xmax)
@constraint(m, x <= xmax)
fix(m[:xmax], 1.)
@objective(m, Min, x)
optimize!(m)
this gives:
ERROR: UndefVarError: getconstant not defined
Stacktrace:
[1] add_linear_constraints(::Clp.Optimizer, ::Array{MathOptInterface.ScalarAffineFunction{Float64},1}, ::Array{MathOptInterface.LessThan{Float64},1}) at /opt/julia/packages/LinQuadOptInterface/ZMx9f/src/constraints/scalaraffine.jl:79
[2] add_constraints(::Clp.Optimizer, ::Array{MathOptInterface.ScalarAffineFunction{Float64},1}, ::Array{MathOptInterface.LessThan{Float64},1}) at /opt/julia/packages/LinQuadOptInterface/ZMx9f/src/constraints/scalaraffine.jl:62
[3] add_constraints(::MathOptInterface.Bridges.LazyBridgeOptimizer{Clp.Optimizer}, ::Array{MathOptInterface.ScalarAffineFunction{Float64},1}, ::Array{MathOptInterface.LessThan{Float64},1}) at /opt/julia/packages/MathOptInterface/4hMCx/src/Bridges/bridge_optimizer.jl:1011
[4] copy_constraints(::MathOptInterface.Bridges.LazyBridgeOptimizer{Clp.Optimizer}, ::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}, ::MathOptInterface.Utilities.IndexMap, ::Array{MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.LessThan{Float64}},1}) at /opt/julia/packages/MathOptInterface/4hMCx/src/Utilities/copy.jl:228
[5] pass_constraints(::MathOptInterface.Bridges.LazyBridgeOptimizer{Clp.Optimizer}, ::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}, ::Bool, ::MathOptInterface.Utilities.IndexMap, ::Array{DataType,1}, ::Array{Array{T,1} where T,1}, ::Array{DataType,1}, ::Array{Array{T,1} where T,1}, ::typeof(MathOptInterface.Utilities.copy_constraints), ::typeof(MathOptInterface.set)) at /opt/julia/packages/MathOptInterface/4hMCx/src/Utilities/copy.jl:265
[6] pass_constraints(::MathOptInterface.Bridges.LazyBridgeOptimizer{Clp.Optimizer}, ::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}, ::Bool, ::MathOptInterface.Utilities.IndexMap, ::Array{DataType,1}, ::Array{Array{T,1} where T,1}, ::Array{DataType,1}, ::Array{Array{T,1} where T,1}) at /opt/julia/packages/MathOptInterface/4hMCx/src/Utilities/copy.jl:240
[7] default_copy_to(::MathOptInterface.Bridges.LazyBridgeOptimizer{Clp.Optimizer}, ::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}, ::Bool) at /opt/julia/packages/MathOptInterface/4hMCx/src/Utilities/copy.jl:340
[8] #automatic_copy_to#97 at /opt/julia/packages/MathOptInterface/4hMCx/src/Utilities/copy.jl:15 [inlined]
[9] #automatic_copy_to at ./none:0 [inlined]
[10] #copy_to#1 at /opt/julia/packages/MathOptInterface/4hMCx/src/Bridges/bridge_optimizer.jl:228 [inlined]
[11] (::getfield(MathOptInterface, Symbol("#kw##copy_to")))(::NamedTuple{(:copy_names,),Tuple{Bool}}, ::typeof(MathOptInterface.copy_to), ::MathOptInterface.Bridges.LazyBridgeOptimizer{Clp.Optimizer}, ::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}) at ./none:0
[12] attach_optimizer(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}) at /opt/julia/packages/MathOptInterface/4hMCx/src/Utilities/cachingoptimizer.jl:149
[13] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}) at /opt/julia/packages/MathOptInterface/4hMCx/src/Utilities/cachingoptimizer.jl:185
[14] #optimize!#78(::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Model, ::Nothing) at /opt/julia/packages/JuMP/iGamg/src/optimizer_interface.jl:141
[15] optimize! at /opt/julia/packages/JuMP/iGamg/src/optimizer_interface.jl:111 [inlined] (repeats 2 times)
[16] top-level scope at none:0
I also get this error with CPLEX so it seems solver independent. I am using JuMP v0.20.0 with Julia 1.1.1
CPLEX and Clp have not yet been updated to JuMP v0.20/MOI v0.9, see jump-dev/MathOptInterface.jl#736 for an up to date list of solvers that have been ported.
Thanks for your help, I moved back to JuMP v0.19 until the update. Perhaps CPLEX and Clp should be temporally removed from the list of currently supported solver on the v0.20 documentation
Hi,
I need to solve a sequence of LP with a changing constant value in a linear constraint. I picked a solution from the doc at http://www.juliaopt.org/JuMP.jl/v0.20.0/constraints/ but I got an error which I could summarize in this example:
this gives:
I also get this error with CPLEX so it seems solver independent. I am using JuMP v0.20.0 with Julia 1.1.1
I had a look at https://github.com/JuliaOpt/LinQuadOptInterface.jl/blob/master/src/constraints/scalaraffine.jl where the error comes from, not sure wether if it should be a JuMP or LinQuadOptInterface issue
The text was updated successfully, but these errors were encountered: