Scippy

SCIP

Solving Constraint Integer Programs

relax.c File Reference

Detailed Description

methods and datastructures for relaxation handlers

Author
Tobias Achterberg
Timo Berthold

Definition in file relax.c.

#include <assert.h>
#include <string.h>
#include "scip/def.h"
#include "scip/set.h"
#include "scip/stat.h"
#include "scip/clock.h"
#include "scip/paramset.h"
#include "scip/scip.h"
#include "scip/relax.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/struct_relax.h"

Go to the source code of this file.

Functions

 SCIP_DECL_SORTPTRCOMP (SCIPrelaxComp)
 
 SCIP_DECL_SORTPTRCOMP (SCIPrelaxCompName)
 
static SCIP_DECL_PARAMCHGD (paramChgdRelaxPriority)
 
SCIP_RETCODE SCIPrelaxCopyInclude (SCIP_RELAX *relax, SCIP_SET *set)
 
SCIP_RETCODE SCIPrelaxCreate (SCIP_RELAX **relax, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, int freq, SCIP_DECL_RELAXCOPY((*relaxcopy)), SCIP_DECL_RELAXFREE((*relaxfree)), SCIP_DECL_RELAXINIT((*relaxinit)), SCIP_DECL_RELAXEXIT((*relaxexit)), SCIP_DECL_RELAXINITSOL((*relaxinitsol)), SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), SCIP_DECL_RELAXEXEC((*relaxexec)), SCIP_RELAXDATA *relaxdata)
 
SCIP_RETCODE SCIPrelaxFree (SCIP_RELAX **relax, SCIP_SET *set)
 
SCIP_RETCODE SCIPrelaxInit (SCIP_RELAX *relax, SCIP_SET *set)
 
SCIP_RETCODE SCIPrelaxExit (SCIP_RELAX *relax, SCIP_SET *set)
 
SCIP_RETCODE SCIPrelaxInitsol (SCIP_RELAX *relax, SCIP_SET *set)
 
SCIP_RETCODE SCIPrelaxExitsol (SCIP_RELAX *relax, SCIP_SET *set)
 
SCIP_RETCODE SCIPrelaxExec (SCIP_RELAX *relax, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
 
SCIP_RELAXDATASCIPrelaxGetData (SCIP_RELAX *relax)
 
void SCIPrelaxSetData (SCIP_RELAX *relax, SCIP_RELAXDATA *relaxdata)
 
void SCIPrelaxSetCopy (SCIP_RELAX *relax, SCIP_DECL_RELAXCOPY((*relaxcopy)))
 
void SCIPrelaxSetFree (SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
 
void SCIPrelaxSetInit (SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
 
void SCIPrelaxSetExit (SCIP_RELAX *relax, SCIP_DECL_RELAXEXIT((*relaxexit)))
 
void SCIPrelaxSetInitsol (SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
 
void SCIPrelaxSetExitsol (SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
 
const char * SCIPrelaxGetName (SCIP_RELAX *relax)
 
const char * SCIPrelaxGetDesc (SCIP_RELAX *relax)
 
int SCIPrelaxGetPriority (SCIP_RELAX *relax)
 
void SCIPrelaxSetPriority (SCIP_RELAX *relax, SCIP_SET *set, int priority)
 
int SCIPrelaxGetFreq (SCIP_RELAX *relax)
 
SCIP_Real SCIPrelaxGetSetupTime (SCIP_RELAX *relax)
 
void SCIPrelaxEnableOrDisableClocks (SCIP_RELAX *relax, SCIP_Bool enable)
 
SCIP_Real SCIPrelaxGetTime (SCIP_RELAX *relax)
 
SCIP_Longint SCIPrelaxGetNCalls (SCIP_RELAX *relax)
 
SCIP_Bool SCIPrelaxIsInitialized (SCIP_RELAX *relax)
 
SCIP_Bool SCIPrelaxIsSolved (SCIP_RELAX *relax, SCIP_STAT *stat)
 
void SCIPrelaxMarkUnsolved (SCIP_RELAX *relax)
 
SCIP_RETCODE SCIPrelaxationCreate (SCIP_RELAXATION **relaxation)
 
SCIP_RETCODE SCIPrelaxationFree (SCIP_RELAXATION **relaxation)
 
void SCIPrelaxationSetSolZero (SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
 
SCIP_Bool SCIPrelaxationIsSolZero (SCIP_RELAXATION *relaxation)
 
void SCIPrelaxationSetSolValid (SCIP_RELAXATION *relaxation, SCIP_Bool isvalid)
 
SCIP_Bool SCIPrelaxationIsSolValid (SCIP_RELAXATION *relaxation)
 
void SCIPrelaxationSetSolObj (SCIP_RELAXATION *relaxation, SCIP_Real obj)
 
SCIP_Real SCIPrelaxationGetSolObj (SCIP_RELAXATION *relaxation)
 
void SCIPrelaxationSolObjAdd (SCIP_RELAXATION *relaxation, SCIP_Real val)
 

Function Documentation

SCIP_DECL_SORTPTRCOMP ( SCIPrelaxComp  )

compares two relaxation handlers w. r. to their priority

Definition at line 42 of file relax.c.

SCIP_DECL_SORTPTRCOMP ( SCIPrelaxCompName  )

comparison method for sorting relaxators w.r.t. to their name

Definition at line 48 of file relax.c.

References SCIPrelaxGetName().

static SCIP_DECL_PARAMCHGD ( paramChgdRelaxPriority  )
static

method to call, when the priority of a relaxation handler was changed

Definition at line 55 of file relax.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPparamGetData(), SCIPparamGetInt(), and SCIPsetRelaxPriority().

SCIP_RETCODE SCIPrelaxCopyInclude ( SCIP_RELAX relax,
SCIP_SET set 
)

copies the given relaxation handler to a new scip

Parameters
relaxrelaxation handler
setSCIP_SET of SCIP to copy to

Definition at line 69 of file relax.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and SCIPrelaxGetName().

Referenced by SCIPsetCopyPlugins().

SCIP_RETCODE SCIPrelaxCreate ( SCIP_RELAX **  relax,
SCIP_SET set,
SCIP_MESSAGEHDLR messagehdlr,
BMS_BLKMEM blkmem,
const char *  name,
const char *  desc,
int  priority,
int  freq,
SCIP_DECL_RELAXCOPY((*relaxcopy))  ,
SCIP_DECL_RELAXFREE((*relaxfree))  ,
SCIP_DECL_RELAXINIT((*relaxinit))  ,
SCIP_DECL_RELAXEXIT((*relaxexit))  ,
SCIP_DECL_RELAXINITSOL((*relaxinitsol))  ,
SCIP_DECL_RELAXEXITSOL((*relaxexitsol))  ,
SCIP_DECL_RELAXEXEC((*relaxexec))  ,
SCIP_RELAXDATA relaxdata 
)

creates a relaxation handler

Parameters
relaxpointer to relaxation handler data structure
setglobal SCIP settings
messagehdlrmessage handler
blkmemblock memory for parameter settings
namename of relaxation handler
descdescription of relaxation handler
prioritypriority of the relaxation handler (negative: after LP, non-negative: before LP)
freqfrequency for calling relaxation handler
relaxdatarelaxation handler data

Definition at line 87 of file relax.c.

References BMSallocMemory, BMSduplicateMemoryArray, FALSE, NULL, paramname, SCIP_ALLOC, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPclockCreate(), SCIPsetAddIntParam(), and SCIPsnprintf().

Referenced by SCIPincludeRelax(), and SCIPincludeRelaxBasic().

SCIP_RETCODE SCIPrelaxFree ( SCIP_RELAX **  relax,
SCIP_SET set 
)

calls destructor and frees memory of relaxation handler

Parameters
relaxpointer to relaxation handler data structure
setglobal SCIP settings

Definition at line 149 of file relax.c.

References BMSfreeMemory, BMSfreeMemoryArray, NULL, SCIP_CALL, SCIP_OKAY, and SCIPclockFree().

SCIP_RETCODE SCIPrelaxInit ( SCIP_RELAX relax,
SCIP_SET set 
)

initializes relaxation handler

Parameters
relaxrelaxation handler
setglobal SCIP settings

Definition at line 175 of file relax.c.

References SCIP_Relax::initialized, SCIP_Relax::lastsolvednode, SCIP_Relax::name, SCIP_Relax::ncalls, NULL, SCIP_Relax::relaxclock, SCIP_CALL, SCIP_INVALIDCALL, SCIP_OKAY, SCIPclockReset(), SCIPclockStart(), SCIPclockStop(), SCIPerrorMessage, SCIP_Relax::setuptime, and TRUE.

Referenced by SCIPsetIncludeExternalCode().

SCIP_RETCODE SCIPrelaxExit ( SCIP_RELAX relax,
SCIP_SET set 
)

calls exit method of relaxation handler

Parameters
relaxrelaxation handler
setglobal SCIP settings

Definition at line 213 of file relax.c.

References FALSE, SCIP_Relax::initialized, SCIP_Relax::name, NULL, SCIP_CALL, SCIP_INVALIDCALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), SCIPerrorMessage, and SCIP_Relax::setuptime.

Referenced by SCIPsetInitPlugins().

SCIP_RETCODE SCIPrelaxInitsol ( SCIP_RELAX relax,
SCIP_SET set 
)

informs relaxation handler that the branch and bound process is being started

Parameters
relaxrelaxation handler
setglobal SCIP settings

Definition at line 243 of file relax.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), and SCIP_Relax::setuptime.

Referenced by SCIPsetExitprePlugins().

SCIP_RETCODE SCIPrelaxExitsol ( SCIP_RELAX relax,
SCIP_SET set 
)

informs relaxation handler that the branch and bound process data is being freed

Parameters
relaxrelaxation handler
setglobal SCIP settings

Definition at line 267 of file relax.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), and SCIP_Relax::setuptime.

Referenced by SCIPsetInitsolPlugins().

SCIP_RETCODE SCIPrelaxExec ( SCIP_RELAX relax,
SCIP_SET set,
SCIP_STAT stat,
int  depth,
SCIP_Real lowerbound,
SCIP_RESULT result 
)

calls execution method of relaxation handler

Parameters
relaxrelaxation handler
setglobal SCIP settings
statdynamic problem statistics
depthdepth of current node
lowerboundpointer to lower bound computed by the relaxation handler
resultpointer to store the result of the callback method

Definition at line 291 of file relax.c.

References SCIP_Relax::freq, SCIP_Relax::lastsolvednode, SCIP_Relax::name, SCIP_Relax::ncalls, SCIP_Stat::ntotalnodes, NULL, SCIP_Relax::relaxclock, SCIP_CALL, SCIP_CONSADDED, SCIP_CUTOFF, SCIP_DIDNOTRUN, SCIP_INVALIDRESULT, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIP_SUCCESS, SCIP_SUSPENDED, SCIPclockStart(), SCIPclockStop(), SCIPdebugMessage, SCIPerrorMessage, and SCIPrelaxMarkUnsolved().

Referenced by solveNodeRelax().

SCIP_RELAXDATA* SCIPrelaxGetData ( SCIP_RELAX relax)

gets user data of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 354 of file relax.c.

References NULL, and SCIP_Relax::relaxdata.

Referenced by SCIP_DECL_RELAXCOPY(), SCIP_DECL_RELAXEXEC(), SCIP_DECL_RELAXEXIT(), SCIP_DECL_RELAXEXITSOL(), SCIP_DECL_RELAXFREE(), SCIP_DECL_RELAXINIT(), SCIP_DECL_RELAXINITSOL(), SCIPfindObjRelax(), and SCIPgetObjRelax().

void SCIPrelaxSetData ( SCIP_RELAX relax,
SCIP_RELAXDATA relaxdata 
)

sets user data of relaxation handler; user has to free old data in advance!

Parameters
relaxrelaxation handler
relaxdatanew relaxation handler user data

Definition at line 364 of file relax.c.

References NULL, and SCIP_Relax::relaxdata.

Referenced by SCIP_DECL_RELAXFREE().

void SCIPrelaxSetCopy ( SCIP_RELAX relax,
SCIP_DECL_RELAXCOPY((*relaxcopy))   
)

set copy method of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 375 of file relax.c.

References NULL.

Referenced by SCIPsetRelaxCopy().

void SCIPrelaxSetFree ( SCIP_RELAX relax,
SCIP_DECL_RELAXFREE((*relaxfree))   
)

set destructor of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 386 of file relax.c.

References NULL.

Referenced by SCIPsetRelaxFree().

void SCIPrelaxSetInit ( SCIP_RELAX relax,
SCIP_DECL_RELAXINIT((*relaxinit))   
)

set initialization method of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 397 of file relax.c.

References NULL.

Referenced by SCIPsetRelaxInit().

void SCIPrelaxSetExit ( SCIP_RELAX relax,
SCIP_DECL_RELAXEXIT((*relaxexit))   
)

set deinitialization method of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 408 of file relax.c.

References NULL.

Referenced by SCIPsetRelaxExit().

void SCIPrelaxSetInitsol ( SCIP_RELAX relax,
SCIP_DECL_RELAXINITSOL((*relaxinitsol))   
)

set solving process initialization method of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 419 of file relax.c.

References NULL.

Referenced by SCIPsetRelaxInitsol().

void SCIPrelaxSetExitsol ( SCIP_RELAX relax,
SCIP_DECL_RELAXEXITSOL((*relaxexitsol))   
)

set solving process deinitialization method of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 430 of file relax.c.

References NULL.

Referenced by SCIPsetRelaxExitsol().

const char* SCIPrelaxGetName ( SCIP_RELAX relax)

gets name of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 441 of file relax.c.

References SCIP_Relax::name, and NULL.

Referenced by printRelaxatorStatistics(), SCIP_DECL_DIALOGEXEC(), SCIP_DECL_SORTPTRCOMP(), SCIPrelaxCopyInclude(), SCIPsetSortPresols(), and solveNodeRelax().

const char* SCIPrelaxGetDesc ( SCIP_RELAX relax)

gets description of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 451 of file relax.c.

References SCIP_Relax::desc, and NULL.

Referenced by SCIP_DECL_DIALOGEXEC().

int SCIPrelaxGetPriority ( SCIP_RELAX relax)

gets priority of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 461 of file relax.c.

References NULL, and SCIP_Relax::priority.

Referenced by SCIP_DECL_DIALOGEXEC(), and solveNodeRelax().

void SCIPrelaxSetPriority ( SCIP_RELAX relax,
SCIP_SET set,
int  priority 
)

sets priority of relaxation handler

Parameters
relaxrelaxation handler
setglobal SCIP settings
prioritynew priority of the relaxation handler

Definition at line 471 of file relax.c.

References FALSE, NULL, and SCIP_Relax::priority.

Referenced by SCIPsetRelaxPriority().

int SCIPrelaxGetFreq ( SCIP_RELAX relax)

gets frequency of relaxation handler

Parameters
relaxrelaxation handler

Definition at line 485 of file relax.c.

References SCIP_Relax::freq, and NULL.

Referenced by SCIP_DECL_DIALOGEXEC().

SCIP_Real SCIPrelaxGetSetupTime ( SCIP_RELAX relax)

gets time in seconds used in this relaxator for setting up for next stages

Parameters
relaxrelaxator

Definition at line 495 of file relax.c.

References NULL, SCIPclockGetTime(), and SCIP_Relax::setuptime.

void SCIPrelaxEnableOrDisableClocks ( SCIP_RELAX relax,
SCIP_Bool  enable 
)

enables or disables all clocks of relax, depending on the value of the flag

Parameters
relaxthe relaxation handler for which all clocks should be enabled or disabled
enableshould the clocks of the relaxation handler be enabled?

Definition at line 505 of file relax.c.

References NULL, SCIP_Relax::relaxclock, SCIPclockEnableOrDisable(), and SCIP_Relax::setuptime.

Referenced by SCIPsetSetReoptimizationParams().

SCIP_Real SCIPrelaxGetTime ( SCIP_RELAX relax)

gets time in seconds used in this relaxation handler

Parameters
relaxrelaxation handler

Definition at line 517 of file relax.c.

References NULL, SCIP_Relax::relaxclock, and SCIPclockGetTime().

Referenced by printRelaxatorStatistics().

SCIP_Longint SCIPrelaxGetNCalls ( SCIP_RELAX relax)

gets the total number of times, the relaxation handler was called

Parameters
relaxrelaxation handler

Definition at line 527 of file relax.c.

References SCIP_Relax::ncalls, and NULL.

Referenced by printRelaxatorStatistics().

SCIP_Bool SCIPrelaxIsInitialized ( SCIP_RELAX relax)

is relaxation handler initialized?

Parameters
relaxrelaxation handler

Definition at line 537 of file relax.c.

References SCIP_Relax::initialized, and NULL.

Referenced by SCIPsetFindPresol().

SCIP_Bool SCIPrelaxIsSolved ( SCIP_RELAX relax,
SCIP_STAT stat 
)

returns whether the relaxation was completely solved at the current node

Parameters
relaxrelaxation handler
statdynamic problem statistics

Definition at line 547 of file relax.c.

References SCIP_Relax::lastsolvednode, SCIP_Stat::ntotalnodes, and NULL.

Referenced by updateLoopStatus().

void SCIPrelaxMarkUnsolved ( SCIP_RELAX relax)

marks the current relaxation unsolved, s.t. the relaxation handler is called again in the next solving round

Parameters
relaxrelaxation handler

Definition at line 559 of file relax.c.

References SCIP_Relax::lastsolvednode, and NULL.

Referenced by markRelaxsUnsolved(), and SCIPrelaxExec().

SCIP_RETCODE SCIPrelaxationCreate ( SCIP_RELAXATION **  relaxation)

creates global relaxation data

Parameters
relaxationglobal relaxation data

Definition at line 573 of file relax.c.

References BMSallocMemory, FALSE, NULL, SCIP_ALLOC, SCIP_OKAY, and TRUE.

Referenced by SCIPtransformProb().

SCIP_RETCODE SCIPrelaxationFree ( SCIP_RELAXATION **  relaxation)

frees global relaxation data

Parameters
relaxationglobal relaxation data

Definition at line 587 of file relax.c.

References BMSfreeMemory, NULL, and SCIP_OKAY.

Referenced by freeTransform().

void SCIPrelaxationSetSolZero ( SCIP_RELAXATION relaxation,
SCIP_Bool  iszero 
)

sets the relaxsolzero flag in the relaxation data to the given value

Parameters
relaxationglobal relaxation data
iszeroare all values of the relaxation solution set to zero?

Definition at line 599 of file relax.c.

References NULL, and SCIP_Relaxation::relaxsolzero.

Referenced by SCIPclearRelaxSolVals(), SCIPsetRelaxSolVal(), SCIPsetRelaxSolVals(), and SCIPsetRelaxSolValsSol().

SCIP_Bool SCIPrelaxationIsSolZero ( SCIP_RELAXATION relaxation)

returns whether the global relaxation solution is cleared and all values are set to zero

Parameters
relaxationglobal relaxation data

Definition at line 610 of file relax.c.

References NULL, and SCIP_Relaxation::relaxsolzero.

Referenced by SCIPclearRelaxSolVals().

void SCIPrelaxationSetSolValid ( SCIP_RELAXATION relaxation,
SCIP_Bool  isvalid 
)

sets the relaxsolvalid flag in the relaxation data to the given value

Parameters
relaxationglobal relaxation data
isvalidis the stored solution valid?

Definition at line 620 of file relax.c.

References NULL, and SCIP_Relaxation::relaxsolvalid.

Referenced by markRelaxsUnsolved(), SCIPmarkRelaxSolInvalid(), SCIPmarkRelaxSolValid(), SCIPsetRelaxSolVal(), SCIPsetRelaxSolVals(), SCIPsetRelaxSolValsSol(), and solveNode().

SCIP_Bool SCIPrelaxationIsSolValid ( SCIP_RELAXATION relaxation)

returns whether the global relaxation solution is valid

Parameters
relaxationglobal relaxation data

Definition at line 631 of file relax.c.

References NULL, and SCIP_Relaxation::relaxsolvalid.

Referenced by SCIPcreateRelaxSol(), SCIPgetRelaxSolObj(), SCIPgetRelaxSolVal(), SCIPisRelaxSolValid(), SCIPlinkRelaxSol(), SCIPsolCreateRelaxSol(), and SCIPsolLinkRelaxSol().

void SCIPrelaxationSetSolObj ( SCIP_RELAXATION relaxation,
SCIP_Real  obj 
)

sets the objective value of the global relaxation solution

Parameters
relaxationglobal relaxation data
objobjective value

Definition at line 641 of file relax.c.

References NULL, and SCIP_Relaxation::relaxsolobjval.

Referenced by SCIPclearRelaxSolVals(), and SCIPsetRelaxSolValsSol().

SCIP_Real SCIPrelaxationGetSolObj ( SCIP_RELAXATION relaxation)

returns the objective value of the global relaxation solution w.r.t. the transformed problem

Parameters
relaxationglobal relaxation data

Definition at line 652 of file relax.c.

References NULL, and SCIP_Relaxation::relaxsolobjval.

Referenced by SCIPgetRelaxSolObj(), and SCIPsolLinkRelaxSol().

void SCIPrelaxationSolObjAdd ( SCIP_RELAXATION relaxation,
SCIP_Real  val 
)

adds the given value to the global relaxation solution's objective value

Parameters
relaxationglobal relaxation data
valvalue to add to the objective value

Definition at line 662 of file relax.c.

References NULL, and SCIP_Relaxation::relaxsolobjval.

Referenced by SCIPvarSetRelaxSol().