Hi all. I’m pretty new to Julia optimization. I have this problem:
model = Model(HiGHS.Optimizer)
@variable(model, x[1:n] >= 0)
@constraint(model, A' * x .>= f)
@objective(model, Min, b' * x)
which works perfectly when using the HiGHS optimizer alone, but I want to find multiple solutions, so I’ve been trying to use MOA as follows
model = Model()
@variable(model, x[1:n] >= 0)
@constraint(model, A' * x .>= f)
@objective(model, Min, b' * x)
set_optimizer(model, () -> MOA.Optimizer(HiGHS.Optimizer))
set_attribute(model, MOA.Algorithm(), MOA.Dichotomy())
set_attribute(model, MOA.SolutionLimit(), 2)
but when I call optimize, I get the following error
ERROR: MathOptInterface.UnsupportedAttribute{MathOptInterface.ObjectiveFunction{MathOptInterface.ScalarAffineFunction{Float64}}}: Attribute MathOptInterface.ObjectiveFunction{MathOptInterface.ScalarAffineFunction{Float64}}() is not supported by the model.
Stacktrace:
[1] bridge_type(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, F::Type{…})
@ MathOptInterface.Bridges C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Bridges\lazy_bridge_optimizer.jl:520
[2] concrete_bridge_type(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, F::Type{…})
@ MathOptInterface.Bridges.Objective C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Bridges\Objective\bridge.jl:68
[3] set(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, attr::MathOptInterface.ObjectiveFunction{…}, func::MathOptInterface.ScalarAffineFunction{…})
@ MathOptInterface.Bridges C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Bridges\bridge_optimizer.jl:1187
[4] _pass_attribute(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, attr::MathOptInterface.ObjectiveFunction{…})
@ MathOptInterface.Utilities C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Utilities\copy.jl:51
[5] pass_attributes(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap)
@ MathOptInterface.Utilities C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Utilities\copy.jl:38
[6] default_copy_to(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…})
@ MathOptInterface.Utilities C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Utilities\copy.jl:503
[7] copy_to
@ C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Bridges\bridge_optimizer.jl:455 [inlined]
[8] optimize!
@ C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\MathOptInterface.jl:84 [inlined]
[9] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{…})
@ MathOptInterface.Utilities C:\Users\JHANNY\.julia\packages\MathOptInterface\2CULs\src\Utilities\cachingoptimizer.jl:316
[10] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
@ JuMP C:\Users\JHANNY\.julia\packages\JuMP\Gwn88\src\optimizer_interface.jl:457
[11] optimize!
@ C:\Users\JHANNY\.julia\packages\JuMP\Gwn88\src\optimizer_interface.jl:409 [inlined]
which I think doesn’t really make sense since HiGHS does support ScalarAffineFunction{Float64}, and the problem can be solved perfectly fine without using MOA.
Thanks for the help!