Skip to content

FileFormats.CBF: support constrained variables #1402

Closed

Description

@odow

Writing

Currently, the CBF writer assumes all variables are in the "F" (MOI.Reals) cone.

println(io, num_var, " 1")
println(io, "F ", num_var)

We should add support for add_constrained_variables and then dis-allow VectorOfVariables constraints:

_add_cones(data, model, MOI.VectorOfVariables, S)

since we end up writing VectorOfVariables constraints as a affine-in-set anyway:
function _add_function(data, f::MOI.VectorOfVariables, ::Any)
for v in f.variables
data.num_rows += 1
push!(data.acoord, (data.num_rows, v.value, 1.0))
end
return
end

Reading

This should be changed to add_constrained_variable:

MOI.add_constraint(
model,
MOI.VectorOfVariables(data.scalar_vars[var_idx.+indices]),
_cbf_to_moi_cone(data, cone_str, cone_dim),
)

Activity

  1. added
    Submodule: FileFormats
    Status: help wanted
    on Jun 21, 2021
  2. added this to the MOI 1.x milestone on Aug 12, 2021
  3. changed the title [-]Support constrained variables in FileFormats.CBF[/-] [+]FileFormats.CBF: support constrained variables[/+] on Apr 20, 2022
  4. odow commented on Nov 2, 2023

    @odow
    MemberAuthor

    Closing for now. There's no point changing read because Model doesn't distinguish add_constrained_variables, and writing is tricky to get right. It's something to revisit if we work on MOI 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: help wantedSubmodule: FileFormats

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions