Detailed Description
C++ wrapper for user variable data.
This class defines the interface for user variable data implemented in C++. Each variable can be equipped with a variable data class. This data can be accessed via the function SCIPgetObjVardata() at any time after it is created and before it is deleted.
Definition at line 43 of file objvardata.h.
C++ wrapper for user variable data. More...
#include <objvardata.h>
Public Member Functions | |
ObjVardata () | |
virtual | ~ObjVardata () |
virtual SCIP_RETCODE | scip_delorig (SCIP *scip, SCIP_VAR *var) |
virtual SCIP_RETCODE | scip_trans (SCIP *scip, SCIP_VAR *var, ObjVardata **objvardata, SCIP_Bool *deleteobject) |
virtual SCIP_RETCODE | scip_deltrans (SCIP *scip, SCIP_VAR *var) |
virtual SCIP_RETCODE | scip_copy (SCIP *scip, SCIP *sourcescip, SCIP_VAR *sourcevar, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_VAR *targetvar, ObjVardata **objvardata, SCIP_RESULT *result) |
Constructor & Destructor Documentation
◆ ObjVardata()
|
inline |
default constructor
Definition at line 47 of file objvardata.h.
◆ ~ObjVardata()
|
inlinevirtual |
destructor
Definition at line 52 of file objvardata.h.
Member Function Documentation
◆ scip_delorig()
|
inlinevirtual |
destructor of user variable data to free original user data (called when original variable is freed)
If the "deleteobject" flag in the SCIPcreateObjVar() method was set to TRUE, this method is not needed, because all the work to delete the user variable data can be done in the destructor of the user variable data object. If the "deleteobject" flag was set to FALSE, and the user variable data object stays alive after the SCIP variable is freed, this method should delete all the variable specific data that is no longer needed.
- Parameters
-
scip SCIP data structure var original variable, the data to free is belonging to
Definition at line 64 of file objvardata.h.
References SCIP_OKAY.
◆ scip_trans()
|
inlinevirtual |
creates user data of transformed variable by transforming the original user variable data (called after variable was transformed)
The user has two possibilities to implement this method:
- Return the pointer to the original variable data object (this) as pointer to the transformed variable data object. The user may modify some internal attributes, but he has to make sure, that these modifications are reversed in the scip_deltrans() method, such that the original variable data is restored. In this case, he should set *deleteobject to FALSE, because the variable data must not be destructed by SCIP after the solving process is terminated.
- Call the copy constructor of the variable data object and return the created copy as transformed variable data object. In this case, he probably wants to set *deleteobject to TRUE, thus letting SCIP call the destructor of the object if the transformed variable data is no longer needed.
- Parameters
-
scip SCIP data structure var transformed variable, the data to create is belonging to objvardata pointer to store the transformed variable data object deleteobject pointer to store whether SCIP should delete the object after solving
Definition at line 85 of file objvardata.h.
◆ scip_deltrans()
|
inlinevirtual |
destructor of user variable data to free transformed user data (called when transformed variable is freed)
If the "*deleteobject" flag in the scip_trans() method was set to TRUE, this method is not needed, because all the work to delete the user variable data can be done in the destructor of the user variable data object. If the "*deleteobject" flag was set to FALSE, and the user variable data object stays alive after the SCIP variable is freed, this method should delete all the variable specific data that is no longer needed.
- Parameters
-
scip SCIP data structure var transformed variable, the data to free is belonging to
Definition at line 112 of file objvardata.h.
References SCIP_OKAY.
◆ scip_copy()
|
inlinevirtual |
copies variable data of source SCIP variable for the target SCIP variable
This method should copy the variable data of the source SCIP and create a target variable data for target variable. This callback is optional. If the copying process was successful, the target variable gets this variable data assigned. In case the result pointer is set to SCIP_DIDNOTRUN, the target variable will have no variable data at all.
The variable map and the constraint map can be used via the function SCIPgetVarCopy() and SCIPgetConsCopy(), respectively, to get for certain variables and constraints of the source SCIP the counter parts in the target SCIP. You should be very carefully in using these two methods since they could lead to infinite loop.
possible return values for *result:
- SCIP_DIDNOTRUN : the copying process was not performed
- SCIP_SUCCESS : the copying process was successfully performed
- Parameters
-
scip SCIP data structure sourcescip source SCIP main data structure sourcevar variable of the source SCIP varmap a hashmap which stores the mapping of source variables to corresponding target variables consmap a hashmap which stores the mapping of source contraints to corresponding target constraints targetvar variable of the (targert) SCIP (targetvar is the copy of sourcevar) objvardata pointer to store the copied variable data object result pointer to store the result of the call
Definition at line 135 of file objvardata.h.
References SCIP_Bool, SCIP_DIDNOTRUN, SCIP_EXPORT, SCIP_OKAY, SCIP_Real, SCIPcreateObjVar(), and SCIPgetObjVardata().