More advanced MOI Constraints
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 839
- Forks
- 100
- Avg merge
- 20h 43m
- Merged PRs (30d)
- 38
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OptimizationMOI expression simplification routine mentioned in the issue and review how MathOptInterface constraints are currently represented and registered. The work is complete when an advanced constraint such as SOS1 can be expressed through the proposed interface and transformed into the corresponding MOI constraint without requiring callers to build the internal representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100