Skip to content

How to add cuts/constraints to Conic Benchmark Library (CBLIB) Instances? #1107

@miladdf94

Description

@miladdf94

Hi everyone
@blegat @ccoffrin @chriscoey @odow @mlubin

I am new to Julia and need some help with Julia/Mosek.
I have used the following code from #950 to read Conic Benchmark Library (CBLIB) instances.
However, I need to add some constraints/cuts to these instances and re-run the optimization problem using Mosek.

I need help with adding cuts/constraints to the instance. For example, let's say we want to add this cut:
x1 + x5 <= 7

I also need help with building CBF instances in Julia and obtaining the constraint matrix of these instances. I tried to use ConicBenchmarkUtilities to convert between CBF and MathProgBase conic format. But it seems MathProgBase is deprecated and the code does not work.

The code that I used is as follows (#950)

using MathOptInterface, MathOptFormat, MosekTools

const MOI = MathOptInterface

filename = "instances/10_0_1_w.cbf"

mathoptformat_model = MathOptFormat.CBF.Model()

solver = Mosek.Optimizer()

#user_model = nothing
user_model = MOI.Bridges.full_bridge_optimizer(solver , Float64)

println("check 1")
MOI.read_from_file(mathoptformat_model, filename)
println("check 2")
MOI.copy_to(user_model, mathoptformat_model)
@show user_model
println("check 3")
MOI.optimize!(user_model)
x = MOI.get(user_model, MOI.VariableIndex, "x")
@show x

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions