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

More advanced MOI Constraints #641

Open
AlCap23 opened this issue Dec 4, 2023 · 0 comments
Open

More advanced MOI Constraints #641

AlCap23 opened this issue Dec 4, 2023 · 0 comments

Comments

@AlCap23
Copy link
Contributor

AlCap23 commented Dec 4, 2023

Is your feature request related to a problem? Please describe.

Mathoptinterface offers automatic and well tested "advanced" constraints, e.g. SOS constraints. It would be nice to offer those within Optimzation.jl.

As a motivating example consider the sparse regression problem (😅), which can either be modeled with integer variables
$z_i \in \lbrace 0, 1\rbrace$ using a big-M formulationin the constraints

$$ M^l_i z_i \leq \xi_i \leq M^u_i z_i $$

or with the special ordered set 1 type constraint

$$ \lbrace \xi_i , 1 - z_i \rbrace \in \text{SOS-1} $$

which mathoptinterface expands internally.

Describe the solution you’d like

I think the nicest solution would be something along

@variables begin 
   x::Float64 [description="Parameter with value"] 
   c::Int [bounds = (0,1), description = "Integer decision"]
end

constraint = [
   SOS1(x, 1-c)
]

which indicates the right constraints.

Given that these constraints add variables and might become complicated, a transformation step could be added in the expression simplifcation routine of OptimizationMOI. This way only "dummy" constraints must be added and registered.

# Something along the lines of 
...
if ex.args[1] == SOS1 
    MOI.add_constraint(..., ....)
end
...

Describe alternatives you’ve considered

Instead of relying on MOI we could add functions returning the internal representation of the constraint. This would be more universal, but might end buggy and adds to the maintenance stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant