Scippy

SCIP

Solving Constraint Integer Programs

scip::ObjVardata Class Reference

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 52 of file objvardata.h.

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

#include <objvardata.h>

Public Member Functions

 ObjVardata ()
 
virtual ~ObjVardata ()
 
ObjVardataoperator= (const ObjVardata &o)=delete
 
ObjVardataoperator= (ObjVardata &&o)=delete
 
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()

scip::ObjVardata::ObjVardata ( )
inline

default constructor

Definition at line 56 of file objvardata.h.

◆ ~ObjVardata()

virtual scip::ObjVardata::~ObjVardata ( )
inlinevirtual

destructor

Definition at line 61 of file objvardata.h.

References operator=().

Member Function Documentation

◆ operator=() [1/2]

ObjVardata& scip::ObjVardata::operator= ( const ObjVardata o)
delete

assignment of polymorphic classes causes slicing and is therefore disabled.

Referenced by ~ObjVardata().

◆ operator=() [2/2]

ObjVardata& scip::ObjVardata::operator= ( ObjVardata &&  o)
delete

assignment of polymorphic classes causes slicing and is therefore disabled.

◆ scip_delorig()

virtual SCIP_RETCODE scip::ObjVardata::scip_delorig ( SCIP scip,
SCIP_VAR var 
)
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
scipSCIP data structure
varoriginal variable, the data to free is belonging to

Definition at line 79 of file objvardata.h.

References SCIP_OKAY.

◆ scip_trans()

virtual SCIP_RETCODE scip::ObjVardata::scip_trans ( SCIP scip,
SCIP_VAR var,
ObjVardata **  objvardata,
SCIP_Bool deleteobject 
)
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:

  1. 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.
  2. 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
scipSCIP data structure
vartransformed variable, the data to create is belonging to
objvardatapointer to store the transformed variable data object
deleteobjectpointer to store whether SCIP should delete the object after solving

Definition at line 100 of file objvardata.h.

References FALSE, NULL, and SCIP_OKAY.

◆ scip_deltrans()

virtual SCIP_RETCODE scip::ObjVardata::scip_deltrans ( SCIP scip,
SCIP_VAR var 
)
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
scipSCIP data structure
vartransformed variable, the data to free is belonging to

Definition at line 127 of file objvardata.h.

References SCIP_OKAY.

◆ scip_copy()

virtual SCIP_RETCODE scip::ObjVardata::scip_copy ( SCIP scip,
SCIP sourcescip,
SCIP_VAR sourcevar,
SCIP_HASHMAP varmap,
SCIP_HASHMAP consmap,
SCIP_VAR targetvar,
ObjVardata **  objvardata,
SCIP_RESULT result 
)
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
scipSCIP data structure
sourcescipsource SCIP main data structure
sourcevarvariable of the source SCIP
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
targetvarvariable of the (targert) SCIP (targetvar is the copy of sourcevar)
objvardatapointer to store the copied variable data object
resultpointer to store the result of the call

Definition at line 150 of file objvardata.h.

References NULL, SCIP_Bool, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_Real, SCIPcreateObjVar(), and SCIPgetObjVardata().