Skip to content

Commit 6233386

Browse files
authored
Document how to implement a solver interface (#1300)
1 parent 22f7f12 commit 6233386

File tree

5 files changed

+664
-187
lines changed

5 files changed

+664
-187
lines changed

docs/src/manual/constraints.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,26 @@ where ``\mathcal{E}`` is the exponential cone (see [`ExponentialCone`](@ref)),
173173
| At most one component of ``x`` can be nonzero | `VectorOfVariables` | `SOS1` |
174174
| At most two components of ``x`` can be nonzero, and if so they must be adjacent components | `VectorOfVariables` | `SOS2` |
175175
| ``y = 1 \implies a^T x \in S`` | `VectorAffineFunction` | `IndicatorSet` |
176+
177+
## JuMP mapping
178+
179+
The following bullet points show examples of how JuMP constraints are translated
180+
into MOI function-set pairs:
181+
182+
- `@constraint(m, 2x + y <= 10)` becomes `ScalarAffineFunction`-in-`LessThan`
183+
- `@constraint(m, 2x + y >= 10)` becomes `ScalarAffineFunction`-in-`GreaterThan`
184+
- `@constraint(m, 2x + y == 10)` becomes `ScalarAffineFunction`-in-`EqualTo`
185+
- `@constraint(m, 0 <= 2x + y <= 10)` becomes `ScalarAffineFunction`-in-`Interval`
186+
- `@constraint(m, 2x + y in ArbitrarySet())` becomes
187+
`ScalarAffineFunction`-in-`ArbitrarySet`.
188+
189+
Variable bounds are handled in a similar fashion:
190+
191+
- `@variable(m, x <= 1)` becomes `SingleVariable`-in-`LessThan`
192+
- `@variable(m, x >= 1)` becomes `SingleVariable`-in-`GreaterThan`
193+
194+
One notable difference is that a variable with an upper and lower bound is
195+
translated into two constraints, rather than an interval. i.e.:
196+
197+
- `@variable(m, 0 <= x <= 1)` becomes `SingleVariable`-in-`LessThan` *and*
198+
`SingleVariable`-in-`GreaterThan`.

0 commit comments

Comments
 (0)