Skip to content

Bounds in Binary Variables #99

@ccoffrin

Description

@ccoffrin

The following model

using JuMP; using GLPK
m = Model()
@variable(m, x, binary=true, lower_bound=0, upper_bound=1)
optimize!(m, with_optimizer(GLPK.Optimizer))

results in,

ERROR: LoadError: Cannot set bounds because variable is of type: BINARY.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] add_constraints(::GLPK.Optimizer, ::Array{MathOptInterface.SingleVariable,1}, ::Array{MathOptInterface.GreaterThan{Float64},1}) at /.julia/packages/LinQuadOptInterface/ZMx9f/src/constraints/singlevariable.jl:128
 [3] add_constraints(::MathOptInterface.Bridges.LazyBridgeOptimizer{GLPK.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::Array{MathOptInterface.SingleVariable,1}, ::Array{MathOptInterface.GreaterThan{Float64},1}) at /.julia/packages/MathOptInterface/C3lip/src/Bridges/bridgeoptimizer.jl:342
...

Both CBC and Gurobi have no issue with this case. You might want to support it for consistency.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions