Scippy

SCIP

Solving Constraint Integer Programs

objprobdata.h File Reference

Detailed Description

C++ wrapper for user problem data.

Author
Tobias Achterberg

Definition in file objprobdata.h.

#include <cassert>
#include "scip/scip.h"
#include "objscip/objcloneable.h"

Go to the source code of this file.

Data Structures

class  scip::ObjProbData
 C++ wrapper for user problem data. More...
 

Namespaces

 scip
 

Functions

SCIP_RETCODE SCIPcreateObjProb (SCIP *scip, const char *name, scip::ObjProbData *objprobdata, SCIP_Bool deleteobject)
 
scip::ObjProbDataSCIPgetObjProbData (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:

  1. 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) );
  2. 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
scipSCIP data structure
nameproblem name
objprobdatauser problem data object
deleteobjectshould 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::ObjProbData::scip_copy(), and 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
scipSCIP data structure

Definition at line 227 of file objprobdata.cpp.

References NULL, and SCIPgetProbData().

Referenced by tsp::ProbDataTSP::scip_copy(), scip::ObjProbData::scip_copy(), SCIP_DECL_CONSCOPY(), SCIP_DECL_EVENTEXEC(), SCIP_DECL_HEURINIT(), and SCIP_DECL_HEURINITSOL().