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.

Functions

SCIP_RETCODE SCIPcreateObjProb (SCIP *scip, const char *name, scip::ObjProbData *objprobdata, SCIP_Bool deleteobject)
 
scip::ObjProbDataSCIPgetObjProbData (SCIP *scip)
 

Function Documentation

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) );
  1. 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
Parameters
scipSCIP data structure
nameproblem name
objprobdatauser problem data object
deleteobjectshould the user problem data object be deleted when problem is freed?
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