jump-dev / SCS.jl

A Julia interface for the SCS conic programming solver
https://github.com/cvxgrp/scs
Other
81 stars 27 forks source link

Attribute MathOptInterface.Name() is not supported by the model #257

Closed VHarisop closed 2 years ago

VHarisop commented 2 years ago

I'm using SCS v1.1.1 with JuMP v1.0.0 and MathOptInterface v1.2.0. The following minimal example fails:

using JuMP
using SCS

import MathOptInterface
const MOI = MathOptInterface

let (m, n) = (5, 10)
    A = rand(m, n)
    b = A * rand(n)
    c = rand(n)

    model = Model(SCS.Optimizer)
    MOI.set(model, MOI.Name(), "random_model")
    @variable(model, x[1:n] >= 0.0)
    @constraint(model, A * x .== b)
    @objective(model, Min, c'x)
    optimize!(model)
end

The error message that I get is the following:

ERROR: MathOptInterface.UnsupportedAttribute{MathOptInterface.Name}: Attribute MathOptInterface.Name() is not supported by the model.

Is this intended? The offending line in the master branch would be this, but it seems that the Name() attribute is not used anywhere so it should not affect the solve. Happy to submit a pull request if this is not intended behavior.

odow commented 2 years ago

Not all solvers support all attributes, so in some sense this is intended. But we can probably skip Name, just like we skip https://github.com/jump-dev/SCS.jl/blob/f55c6a2a161c87946514b44852658fc16ddce980/src/MOI_wrapper/MOI_wrapper.jl#L300-L301

odow commented 2 years ago

Fixing this here: https://github.com/jump-dev/SCS.jl/pull/258