virtual bool intermediate_callback(AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData* ip_data, IpoptCalculatedQuantities* ip_cq)It is not required to implement (overload) this method. This method is called once per iteration (during the convergence check), and can be used to obtain information about the optimization status while IPOPT solves the problem, and also to requires a premature termination.
The information provided by the entities in the argument list corresponds to what IPOPT prints in the iteration summary (see also Section 6). Further information can be obtained from the ip_data and ip_cq objects (for experts only :).
You you let this method return false, IPOPT will terminate with the User_Requested_Stop status. If you do not implement this method (as we do in this example), the default implementation always returns true.