Skip to content

Error 'Unsupported constraints' appears when using MOI to load and solve CBF files #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JinsongLiu6 opened this issue Nov 12, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@JinsongLiu6
Copy link

JinsongLiu6 commented Nov 12, 2022

The software version is:
COSMO v0.8.6
MathOptInterface v1.9.0

I try to load .cbf files form CBLIB and solve them by COSMO, but errors appear.
My code and the error information is:

using COSMO
using MathOptInterface
const MOI = MathOptInterface

file_name = "db-joint-soerensen.cbf"
dest = MOI.FileFormats.Model(format = MOI.FileFormats.FORMAT_CBF)
MOI.read_from_file(dest, file_name)
optimizer = COSMO.Optimizer()
MOI.optimize!(optimizer, dest)

ERROR: LoadError: MathOptInterface.UnsupportedConstraint{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.Nonpositives}
Stacktrace:
[1] MathOptInterface.Utilities.IndexMap(dest::COSMO.Optimizer{Float64}, src::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.CBF.ModelFunctionConstraints{Float64}})
@ COSMO ~/.julia/packages/COSMO/74ztU/src/MOI_wrapper.jl:170
[2] copy_to(dest::COSMO.Optimizer{Float64}, src::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.CBF.ModelFunctionConstraints{Float64}}; copy_names::Bool)
@ COSMO ~/.julia/packages/COSMO/74ztU/src/MOI_wrapper.jl:134
[3] copy_to
@ ~/.julia/packages/COSMO/74ztU/src/MOI_wrapper.jl:131 [inlined]
[4] optimize!(dest::COSMO.Optimizer{Float64}, src::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, MathOptInterface.FileFormats.CBF.ModelFunctionConstraints{Float64}})
@ MathOptInterface ~/.julia/packages/MathOptInterface/a4tKm/src/MathOptInterface.jl:86
[5] top-level scope
@ ~/Desktop/julia/try.jl:28

@JinsongLiu6 JinsongLiu6 added the bug Something isn't working label Nov 12, 2022
@JinsongLiu6 JinsongLiu6 changed the title Error 'Unsupported constrains' appears when using MOI to load and solve CBF files Error 'Unsupported constraints' appears when using MOI to load and solve CBF files Nov 12, 2022
@migarstka
Copy link
Member

COSMO does not support the constraint MathOptInterface.Nonpositives used in this MOI model.

However, you can formulate the same model using MathOptInterface.Nonnegatives instead.

Have a look at the MOI docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants