Skip to content

Error when adding objective #35

@mjposs

Description

@mjposs

Hi

I'm trying to use Chuffled on Mac OS (with julia 1.10.2, x_86-64, JuMP v0.21.4) and I'm getting an error:

julia> model = Model(Chuffed.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: FlatZincWriter

julia> @variable(model, x, Int)
x

julia> @variable(model, 0 <= y <= 3, Int)
y

julia> @objective(model, Min, 12x + 20y)
ERROR: MethodError: supports(::Chuffed.FZN.Optimizer, ::MathOptInterface.ObjectiveFunction{MathOptInterface.ScalarAffineFunction{Float64}}) is ambiguous.

Candidates:
  supports(model::Chuffed.FZN.Optimizer, attr::Union{MathOptInterface.AbstractConstraintAttribute, MathOptInterface.AbstractModelAttribute, MathOptInterface.AbstractOptimizerAttribute, MathOptInterface.AbstractVariableAttribute}, x...)
    @ Chuffed.FZN ~/.julia/packages/Chuffed/NBAVo/src/FlatZincOptimizer.jl:166
  supports(::MathOptInterface.ModelLike, attr::Union{MathOptInterface.AbstractModelAttribute, MathOptInterface.AbstractOptimizerAttribute})
    @ MathOptInterface ~/.julia/packages/MathOptInterface/YDdD3/src/attributes.jl:191

Possible fix, define
  supports(::Chuffed.FZN.Optimizer, ::Union{…})

Stacktrace:
 [1] is_bridged(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, F::Type{…})
   @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/lazy_bridge_optimizer.jl:368
 [2] supports(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, attr::MathOptInterface.ObjectiveFunction{…})
   @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge_optimizer.jl:877
 [3] supports(m::MathOptInterface.Utilities.CachingOptimizer{…}, attr::MathOptInterface.ObjectiveFunction{…})
   @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/YDdD3/src/Utilities/cachingoptimizer.jl:704
 [4] set_objective_function(model::Model, func::MathOptInterface.ScalarAffineFunction{Float64})
   @ JuMP ~/.julia/packages/JuMP/e0Uc2/src/objective.jl:95
 [5] set_objective_function(model::Model, func::AffExpr)
   @ JuMP ~/.julia/packages/JuMP/e0Uc2/src/objective.jl:110
 [6] set_objective(model::Model, sense::MathOptInterface.OptimizationSense, func::AffExpr)
   @ JuMP ~/.julia/packages/JuMP/e0Uc2/src/objective.jl:128
 [7] macro expansion
   @ ~/.julia/packages/JuMP/e0Uc2/src/macros.jl:831 [inlined]
 [8] top-level scope
   @ REPL[25]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions