problem.setcbslpend
problem.setcbslpend |
Purpose
Set a user callback to be called at the end of the SLP optimization
Synopsis
problem.setcbslpend(callback, object)
callback(my_prob, my_object)
Arguments
callback
|
The function to be called at the end of the SLP optimization.
callback returns an integer value. If the return value is nonzero, the optimization will return an error code and the "User Return Code" error will be set.
|
my_prob
|
The problem passed to the callback function.
|
my_object
|
The user-defined object passed as
object to
setcbslpend.
|
object
|
Address of a user-defined object, which can be used for any purpose by the function.
object is passed to
callback as
my_object.
|
Example
The following example sets up a callback to be executed at the end of the SLP optimization. It frees the memory allocated to the object created when the optimization began:
ObjData = None p.setcbslpend(CBSlpEnd, ObjData)
A suitable callback function might resemble this:
def CBSlpEnd(MyProb, Obj): if Obj is not None: Obj = [] return 0
Further information
This callback can be used at the end of the SLP optimization to carry out any further processing or housekeeping before the optimization function returns.
Related topics