Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileFormats.CBF: support constrained variables #1402

Closed
odow opened this issue Jun 21, 2021 · 1 comment
Closed

FileFormats.CBF: support constrained variables #1402

odow opened this issue Jun 21, 2021 · 1 comment
Labels
Status: help wanted This issue needs could use help from the community Submodule: FileFormats About the FileFormats submodule
Milestone

Comments

@odow
Copy link
Member

odow commented Jun 21, 2021

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),
)

@odow odow added Submodule: FileFormats About the FileFormats submodule Status: help wanted This issue needs could use help from the community labels Jun 21, 2021
@odow odow added this to the MOI 1.x milestone Aug 12, 2021
@odow odow changed the title Support constrained variables in FileFormats.CBF FileFormats.CBF: support constrained variables Apr 20, 2022
@odow
Copy link
Member Author

odow commented Nov 2, 2023

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
Labels
Status: help wanted This issue needs could use help from the community Submodule: FileFormats About the FileFormats submodule
Development

No branches or pull requests

1 participant