/// <summary>
 /// Setting a callback function for the "intermediate callback"
 /// method in the optimizer.  This gives control back to the user once
 /// per iteration.  If set, it provides the user with some
 /// information on the state of the optimization.  This can be used
 /// to print some user-defined output.  It also gives the user a way
 /// to terminate the optimization prematurely.  If the callback
 /// method returns false, Ipopt will terminate the optimization.
 /// Calling this set method to set the CB pointer to null disables
 /// the intermediate callback functionality.
 /// </summary>
 /// <param name="intermediate">Intermediate callback function</param>
 /// <returns>true if the callback function could be set successfully, false otherwise</returns>
 public bool SetIntermediateCallback(IntermediateDelegate intermediate)
 {
     unsafe
     {
         m_intermediate = new IntermediateReporter(intermediate).Report;
         return(SetIntermediateCallback(m_problem, m_intermediate) == TRUE);
     }
 }
Example #2
0
 /// <summary>
 /// Setting a callback function for the "intermediate callback"
 /// method in the optimizer.  This gives control back to the user once
 /// per iteration.  If set, it provides the user with some
 /// information on the state of the optimization.  This can be used
 /// to print some user-defined output.  It also gives the user a way
 /// to terminate the optimization prematurely.  If the callback
 /// method returns false, Ipopt will terminate the optimization.
 /// Calling this set method to set the CB pointer to null disables
 /// the intermediate callback functionality.
 /// </summary>
 /// <param name="intermediate_cb">Managed intermediate callback function</param>
 /// <returns>true if the callback function could be set successfully, false otherwise</returns>
 public bool SetIntermediateCallback(IntermediateDelegate intermediate_cb)
 {
     return IsInitialized && IpoptAdapter.SetIntermediateCallback(
         m_problem, m_intermediate_cb = new IntermediateReporter(intermediate_cb).Report) == IpoptBoolType.True;
 }
Example #3
0
 internal IntermediateReporter(IntermediateDelegate intermediate_cb)
 {
     m_intermediate_cb = intermediate_cb;
 }
Example #4
0
 /// <summary>
 /// Setting a callback function for the "intermediate callback"
 /// method in the optimizer.  This gives control back to the user once
 /// per iteration.  If set, it provides the user with some
 /// information on the state of the optimization.  This can be used
 /// to print some user-defined output.  It also gives the user a way
 /// to terminate the optimization prematurely.  If the callback
 /// method returns false, Ipopt will terminate the optimization.
 /// Calling this set method to set the CB pointer to null disables
 /// the intermediate callback functionality.
 /// </summary>
 /// <param name="intermediate_cb">Managed intermediate callback function</param>
 /// <returns>true if the callback function could be set successfully, false otherwise</returns>
 public bool SetIntermediateCallback(IntermediateDelegate intermediate_cb)
 {
     return(IsInitialized && IpoptAdapter.SetIntermediateCallback(
                m_problem, m_intermediate_cb = new IntermediateReporter(intermediate_cb).Report) == IpoptBoolType.True);
 }
Example #5
0
 internal IntermediateReporter(IntermediateDelegate intermediate_cb)
 {
     m_intermediate_cb = intermediate_cb;
 }
 internal IntermediateReporter(IntermediateDelegate intermediate)
 {
     m_intermediate = intermediate;
 }