File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,11 @@ Let's check that the constraints are satisfied and the objective is lower than a
42
42
``` @example constraints
43
43
res = zeros(2)
44
44
cons(res, sol.u, _p)
45
+ res
46
+ ```
47
+
48
+ ``` @example constraints
45
49
prob.f(sol.u, _p)
46
- nothing # hide
47
50
```
48
51
49
52
We can also use the Ipopt library with the OptimizationMOI package.
@@ -55,23 +58,24 @@ sol = solve(prob, Ipopt.Optimizer())
55
58
``` @example constraints
56
59
res = zeros(2)
57
60
cons(res, sol.u, _p)
58
- println(res)
61
+ res
62
+ ```
63
+
64
+ ``` @example constraints
59
65
prob.f(sol.u, _p)
60
- nothing # hide
61
66
```
62
67
63
68
We can also use ModelingToolkit as our AD backend and generate symbolic derivatives and expression graph for the objective and constraints.
64
69
65
70
Let's modify the bounds to use the function as an equality constraint. The constraint now becomes -
66
71
67
-
68
72
``` math
69
- \begin{align }
73
+ \begin{aligned }
70
74
71
75
x_1^2 + x_2^2 = 1.0 \\
72
76
73
- \leq x_1 * x_2 = 0.5
74
- \end{align }
77
+ x_1 * x_2 = 0.5
78
+ \end{aligned }
75
79
```
76
80
77
81
``` @example constraints
You can’t perform that action at this time.
0 commit comments