Scippy

SCIP

Solving Constraint Integer Programs

scip::ObjProbData Class Reference

Detailed Description

C++ wrapper for user problem data.

This class defines the interface for user problem data implemented in C++. This class can be accessed at any time using the methods SCIPgetObjProbData(). Therefore, it can be used to store data which has to be accessible within several plugins.

Definition at line 43 of file objprobdata.h.

C++ wrapper for user problem data. More...

#include <objprobdata.h>

Public Member Functions

 ObjProbData ()
 
virtual ~ObjProbData ()
 
virtual SCIP_RETCODE scip_delorig (SCIP *scip)
 
virtual SCIP_RETCODE scip_trans (SCIP *scip, ObjProbData **objprobdata, SCIP_Bool *deleteobject)
 
virtual SCIP_RETCODE scip_deltrans (SCIP *scip)
 
virtual SCIP_RETCODE scip_initsol (SCIP *scip)
 
virtual SCIP_RETCODE scip_exitsol (SCIP *scip, SCIP_Bool restart)
 
virtual SCIP_RETCODE scip_copy (SCIP *scip, SCIP *sourcescip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, ObjProbData **objprobdata, SCIP_Bool global, SCIP_RESULT *result)
 

Constructor & Destructor Documentation

◆ ObjProbData()

scip::ObjProbData::ObjProbData ( )
inline

default constructor

Definition at line 47 of file objprobdata.h.

Referenced by tsp::ProbDataTSP::~ProbDataTSP().

◆ ~ObjProbData()

virtual scip::ObjProbData::~ObjProbData ( )
inlinevirtual

destructor

Definition at line 52 of file objprobdata.h.

Member Function Documentation

◆ scip_delorig()

virtual SCIP_RETCODE scip::ObjProbData::scip_delorig ( SCIP scip)
inlinevirtual

destructor of user problem data to free original user data (called when original problem is freed)

If the "deleteobject" flag in the SCIPcreateObjProb() method was set to TRUE, this method is not needed, because all the work to delete the user problem data can be done in the destructor of the user problem data object. If the "deleteobject" flag was set to FALSE, and the user problem data object stays alive after the SCIP problem is freed, this method should delete all the problem specific data that is no longer needed.

Parameters
scipSCIP data structure

Reimplemented in ProbDataObjectives, and tsp::ProbDataTSP.

Definition at line 64 of file objprobdata.h.

References SCIP_OKAY.

◆ scip_trans()

virtual SCIP_RETCODE scip::ObjProbData::scip_trans ( SCIP scip,
ObjProbData **  objprobdata,
SCIP_Bool deleteobject 
)
inlinevirtual

creates user data of transformed problem by transforming the original user problem data (called after problem was transformed)

The user has two possibilities to implement this method:

  1. Return the pointer to the original problem data object (this) as pointer to the transformed problem 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 problem data is restored. In this case, he should set *deleteobject to FALSE, because the problem data must not be destructed by SCIP after the solving process is terminated.
  2. Call the copy constructor of the problem data object and return the created copy as transformed problem 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 problem data is no longer needed.
Parameters
scipSCIP data structure
objprobdatapointer to store the transformed problem data object
deleteobjectpointer to store whether SCIP should delete the object after solving

Definition at line 84 of file objprobdata.h.

References FALSE, NULL, and SCIP_OKAY.

◆ scip_deltrans()

virtual SCIP_RETCODE scip::ObjProbData::scip_deltrans ( SCIP scip)
inlinevirtual

destructor of user problem data to free transformed user data (called when transformed problem 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 problem data can be done in the destructor of the user problem data object. If the "*deleteobject" flag was set to FALSE, and the user problem data object stays alive after the SCIP problem is freed, this method should delete all the problem specific data that is no longer needed.

Parameters
scipSCIP data structure

Reimplemented in tsp::ProbDataTSP.

Definition at line 110 of file objprobdata.h.

References SCIP_OKAY.

◆ scip_initsol()

virtual SCIP_RETCODE scip::ObjProbData::scip_initsol ( SCIP scip)
inlinevirtual

solving process initialization method of transformed data (called before the branch and bound process begins)

This method is called before the branch and bound process begins and can be used to initialize user problem data that depends for example on the number of active problem variables, because these are now fixed.

Parameters
scipSCIP data structure

Definition at line 122 of file objprobdata.h.

References SCIP_OKAY.

◆ scip_exitsol()

virtual SCIP_RETCODE scip::ObjProbData::scip_exitsol ( SCIP scip,
SCIP_Bool  restart 
)
inlinevirtual

solving process deinitialization method of transformed data (called before the branch and bound data is freed)

This method is called before the branch and bound data is freed and should be used to free all data that was allocated in the solving process initialization method. The user has to make sure, that all LP rows associated to the transformed user problem data are released.

Parameters
scipSCIP data structure
restartwas this exit solve call triggered by a restart?

Definition at line 135 of file objprobdata.h.

References SCIP_OKAY.

◆ scip_copy()

virtual SCIP_RETCODE scip::ObjProbData::scip_copy ( SCIP scip,
SCIP sourcescip,
SCIP_HASHMAP varmap,
SCIP_HASHMAP consmap,
ObjProbData **  objprobdata,
SCIP_Bool  global,
SCIP_RESULT result 
)
inlinevirtual

copies user data of source SCIP for the target SCIP

This method should copy the problem data of the source SCIP and create a target problem data for (target) SCIP. Implementing this callback is optional. If the copying process was successful the target SCIP gets this problem data assigned. In case the result pointer is set to SCIP_DIDNOTRUN the target SCIP will have no problem 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 an infinite loop due to recursion.

possible return values for *result:

  • SCIP_DIDNOTRUN : the copying process was not performed
  • SCIP_SUCCESS : the copying process was successfully performed
Parameters
scipSCIP data structure
sourcescipsource SCIP main data structure
varmapa hashmap which stores the mapping of source variables to corresponding target variables
consmapa hashmap which stores the mapping of source contraints to corresponding target constraints
objprobdatapointer to store the copied problem data object
globalcreate a global or a local copy?
resultpointer to store the result of the call

Definition at line 159 of file objprobdata.h.

References SCIP_Bool, SCIP_DIDNOTRUN, SCIP_OKAY, SCIPcreateObjProb(), and SCIPgetObjProbData().