Skip to content

Get rid of SingleVariable #1472

@blegat

Description

@blegat

Having a separation between the index type VariableIndex and the function type SingleVariable is nice in principle but it's not the best for usability and causes confusions like #1380.
As VariableIndex has no supertype, it could simply be AbstractScalarFunction and we won't need SingleVariable.
The deprecation path doesn't seem too bad, we can do

const SingleVariable = VariableIndex
function VariableIndex(vi::VariableIndex)
    @warn "SingleVariable is deprecated"
    return vi
end

I always end up having to convert between VariableIndex and SingleVariable and it's a difference of behavior with JuMP that makes it difficult to write a code that works both for JuMP and MOI model as JuMP has VariableRef that works both as the reference and the function while in MOI we have two different things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions