Skip to content

VariableConstraint #1471

@blegat

Description

@blegat

The way variables are represented internally by MOIU.GenericModel is encapsulated in the following 4 lines

num_variables_created::Int64
# If nothing, no variable has been deleted so the indices of the
# variables are VI.(1:num_variables_created)
variable_indices::Union{Nothing,Set{VI}}
# Union of flags of `S` such that a `SingleVariable`-in-`S`
# constraint was added to the model and not deleted yet.
single_variable_mask::Vector{UInt8}
# Bounds set by `SingleVariable`-in-`S`:
variable_bounds::Box{T}

We could factor them out into a ModelLike supporting only these SingleVariable constraints.
This would allow MOI wrapper that need this to just have this as a field as well and not have to redo all the work.
That would apply to all solvers currently having the VariableInfo struct.
The issue is that this is currently hardcoded for a few SingleVariable constraints of interest.

EDIT: just notice that this is close to what #1468 does

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