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

Constraint associated with a variable set #3951

Open
odow opened this issue Feb 26, 2025 · 3 comments · May be fixed by #3955
Open

Constraint associated with a variable set #3951

odow opened this issue Feb 26, 2025 · 3 comments · May be fixed by #3955
Labels
Status: Needs developer call This should be discussed on a monthly developer call

Comments

@odow
Copy link
Member

odow commented Feb 26, 2025

Reported by @lopenguin at https://discourse.julialang.org/t/dual-to-psd-constraint-in-jump/126352

If I have

using JuMP
model = Model()
@variable(model, A[1:2, 1:2] >= 0, PSD)
@variable(model, B[1:2, 1:2] in HermitianPSDCone())
@variable(model, C[1:3] in SecondOrderCone())

it's not at all trivial to get the constraint reference so I can query the dual.

One suggested workaround might be:

using JuMP
model = Model()
@variable(model, A[1:2, 1:2] >= 0, Symmetric)
@constraint(model, A_ref, A in PSDCone())
@variable(model, B[1:2, 1:2], Hermitian)
@constraint(model, B_ref, B in HermitianPSDCone())
@variable(model, C[1:3])
@constraint(model, C_ref, C in SecondOrderCone())

For scalar variables, we have:

model = Model()
@variable(model, x >= 0, Int)
LowerBoundRef(x)
IntegerRef(x)

So perhaps we need something similar.

@odow
Copy link
Member Author

odow commented Feb 26, 2025

The underlying issue is that we aren't doing anything with the ConstraintIndex returned here:

x, _ = MOI.add_constrained_variable(moi_backend, set)

x, _ = MOI.add_constrained_variable(moi_backend, set)

var_index, con_index = MOI.add_constrained_variable(moi_backend, set)

var_indices, con_index = MOI.add_constrained_variables(moi_backend, set)

@odow odow added the Status: Needs developer call This should be discussed on a monthly developer call label Feb 27, 2025
@odow
Copy link
Member Author

odow commented Feb 27, 2025

ConstrainedVariableRef
ConstrainedInSetRef
InSetConstraintRef
SetRef
VariableSetRef
VariableInSetRef **
ConstraintAtCreationRef
ConstrainedOnCreationRef
CreationConstraintRef

@odow
Copy link
Member Author

odow commented Feb 27, 2025

We discussed this on today's call, and agreed that we need a dictionary in model to map between variables and their corresponding set.

We did not agree on a name for the ref. Conclusion is that I should prototype the PR with documentation etc, and we can decide then.

@odow odow linked a pull request Feb 28, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs developer call This should be discussed on a monthly developer call
Development

Successfully merging a pull request may close this issue.

1 participant