Skip to content

Commit f4c150b

Browse files
Separate blocks for output visibility
1 parent a9558fd commit f4c150b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/src/tutorials/constraints.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ Let's check that the constraints are satisfied and the objective is lower than a
4242
```@example constraints
4343
res = zeros(2)
4444
cons(res, sol.u, _p)
45+
res
46+
```
47+
48+
```@example constraints
4549
prob.f(sol.u, _p)
46-
nothing # hide
4750
```
4851

4952
We can also use the Ipopt library with the OptimizationMOI package.
@@ -55,23 +58,24 @@ sol = solve(prob, Ipopt.Optimizer())
5558
```@example constraints
5659
res = zeros(2)
5760
cons(res, sol.u, _p)
58-
println(res)
61+
res
62+
```
63+
64+
```@example constraints
5965
prob.f(sol.u, _p)
60-
nothing # hide
6166
```
6267

6368
We can also use ModelingToolkit as our AD backend and generate symbolic derivatives and expression graph for the objective and constraints.
6469

6570
Let's modify the bounds to use the function as an equality constraint. The constraint now becomes -
6671

67-
6872
```math
69-
\begin{align}
73+
\begin{aligned}
7074
7175
x_1^2 + x_2^2 = 1.0 \\
7276
73-
\leq x_1 * x_2 = 0.5
74-
\end{align}
77+
x_1 * x_2 = 0.5
78+
\end{aligned}
7579
```
7680

7781
```@example constraints

0 commit comments

Comments
 (0)