You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/tutorial.md
+91Lines changed: 91 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,97 @@ Here is an example using the constrained problem solve:
62
62
stats.solver_specific[:internal_msg]
63
63
```
64
64
65
+
## Monitoring optimization with callbacks
66
+
67
+
You can monitor the optimization process using a callback function. The callback allows you to access the current iterate and constraint violations at each iteration, which is useful for custom stopping criteria, logging, or real-time analysis.
68
+
69
+
### Callback signature
70
+
71
+
The callback function must have the following signature:
In this section, we work through an example where we specify the problem and its derivatives manually. For this, we need to implement the following `NLPModel` API methods:
Copy file name to clipboardExpand all lines: src/NLPModelsIpopt.jl
+9-38Lines changed: 9 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -123,44 +123,15 @@ end
123
123
124
124
Return the set of functions needed to instantiate an `IpoptProblem`.
125
125
126
-
You can use a callback to monitor the optimization process. The callback must have the signature:
127
-
128
-
function my_callback(alg_mod, iter_count, problem_ptr, args...)
129
-
130
-
The `problem_ptr` argument is required to access the current iterate and constraint violations using `Ipopt.GetIpoptCurrentIterate` and `Ipopt.GetIpoptCurrentViolations`.
0 commit comments