Detailed Description
C++ wrapper for user problem data.
Definition in file objprobdata.h.
Go to the source code of this file.
Data Structures | |
class | scip::ObjProbData |
C++ wrapper for user problem data. More... | |
Namespaces | |
namespace | scip |
Functions | |
SCIP_RETCODE | SCIPcreateObjProb (SCIP *scip, const char *name, scip::ObjProbData *objprobdata, SCIP_Bool deleteobject) |
scip::ObjProbData * | SCIPgetObjProbData (SCIP *scip) |
Function Documentation
◆ SCIPcreateObjProb()
SCIP_RETCODE SCIPcreateObjProb | ( | SCIP * | scip, |
const char * | name, | ||
scip::ObjProbData * | objprobdata, | ||
SCIP_Bool | deleteobject | ||
) |
creates empty problem, initializes all solving data structures, and sets the user problem data to point to the given user data object
The method should be called in one of the following ways:
- The user is resposible of deleting the object: SCIP_CALL( SCIPcreate(&scip) ); ... MyProbData* myprobdata = new MyProbData(...); SCIP_CALL( SCIPcreateObjProb(scip, "probname", &myprobdata, FALSE) ); ... // solve the problem SCIP_CALL( SCIPfreeProb(scip) ); delete myprobdata; // delete probdata AFTER SCIPfreeProb() ! ... SCIP_CALL( SCIPfree(&scip) );
- The object pointer is passed to SCIP and deleted by SCIP in the SCIPfreeProb() call: SCIP_CALL( SCIPcreate(&scip) ); ... SCIP_CALL( SCIPcreateObjProb(scip, "probname", new MyProbData(...), TRUE) ); ... SCIP_CALL( SCIPfree(&scip) ); // problem is freed and destructor of MyProbData is called here
creates empty problem, initializes all solving data structures, and sets the user problem data to point to the given user data object
- Parameters
-
scip SCIP data structure name problem name objprobdata user problem data object deleteobject should the user problem data object be deleted when problem is freed?
Definition at line 202 of file objprobdata.cpp.
References SCIP_CALL, SCIP_OKAY, and SCIPcreateProb().
Referenced by SCIP_DECL_READERREAD().
◆ SCIPgetObjProbData()
scip::ObjProbData * SCIPgetObjProbData | ( | SCIP * | scip | ) |
gets user problem data object Warning! This method should only be called after a problem was created with SCIPcreateObjProb(). Otherwise, a segmentation fault may arise, or an undefined pointer is returned.
- Parameters
-
scip SCIP data structure
Definition at line 227 of file objprobdata.cpp.
References NULL, and SCIPgetProbData().
Referenced by tsp::ProbDataTSP::scip_copy(), SCIP_DECL_CONSCOPY(), SCIP_DECL_EVENTEXEC(), SCIP_DECL_HEURINIT(), and SCIP_DECL_HEURINITSOL().