Skip to content

Broadcasting variables constrained on creation #2148

@odow

Description

@odow

We have a decision to make about what to do if a user writes the following:

model = Model()
@variable(model, x[1:2] in MOI.Integer())

Should we

  • (a) throw a nice error message because MOI.Integer is a scalar-set and x is a vector; or
  • (b) broadcast the scalar set over the vector.

Either case needs a method like:

function build_variable(
    _error::Function, 
    variables::Vector{<:ScalarVariable},
    set::MOI.AbstractScalarSet
)
    return VariablesConstrainedOnCreation.(variables, Ref(set))
end

along with some tests. (If (a), the return replaced by a nice error message.)

cc @Wikunia

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions