Detailed Description
event handler for writing primal and dual bound for all open nodes
This event handler writes to a specified file at a given frequency the dual bounds of all open nodes and the current primal bound.
setting "set misc boundwriting freq 1000" will lead to write every 1000 nodes the primal bound and the dual bound front of all open nodes
setting "set misc boundwriting filename bounds.txt" will write the bounds to the files ascending from bounds1.txt over bounds2.txt to boundsN.txt were N is the last number for writing bounds (no filename means to write to standard out)
setting "set misc writesubmipdualbound TRUE" will lead to resolve each open node in a subSCIP until the root in the subSCIP is solved and as a result will print this resulting dual bound
An output could look as follows (here writesubmipdualbound is set to TRUE):
PB 201
5913 34 192.1 193.5
2884 26 162.1 162.1
The first line above shows the Primalbound. All following lines will show first the node number, second the depth of this open node, third the dual bound of the open node, and last the dual bound of the root node in a subSCIP of the resolved node.
- Note
- you can write all bounds to a single file by adding the line and recompiling this example.#define ONEFILE
-
If you want to get a better human readable format for printing, define and recompile this example.#define LONGSTATS
Definition in file event_boundwriting.c.
Go to the source code of this file.
Macros | |
#define | EVENTHDLR_NAME "boundwriting" |
#define | EVENTHDLR_DESC "event handler for writing current primalbound and global dualbound and for all open nodes the dualbound" |
#define | DEFAULT_FREQ 0LL |
#define | DEFAULT_FILENAME "" |
#define | DEFAULT_WRITESUBMIPDUALBOUND FALSE |
Functions | |
static void | initEventhdlrdata (SCIP_EVENTHDLRDATA *eventhdlrdata) |
static SCIP_RETCODE | applyDomainChanges (SCIP *subscip, SCIP_VAR **vars, SCIP_Real *bounds, SCIP_BOUNDTYPE *boundtypes, int nvars, SCIP_HASHMAP *varmap) |
static SCIP_RETCODE | writeBounds (SCIP *scip, FILE *file, SCIP_Bool writesubmipdualbound) |
static | SCIP_DECL_EVENTCOPY (eventCopyBoundwriting) |
static | SCIP_DECL_EVENTFREE (eventFreeBoundwriting) |
static | SCIP_DECL_EVENTINIT (eventInitBoundwriting) |
static | SCIP_DECL_EVENTEXIT (eventExitBoundwriting) |
static | SCIP_DECL_EVENTEXEC (eventExecBoundwriting) |
SCIP_RETCODE | SCIPincludeEventHdlrBoundwriting (SCIP *scip) |
Macro Definition Documentation
◆ EVENTHDLR_NAME
#define EVENTHDLR_NAME "boundwriting" |
Definition at line 68 of file event_boundwriting.c.
Referenced by SCIP_DECL_EVENTCOPY(), SCIP_DECL_EVENTEXEC(), SCIP_DECL_EVENTEXIT(), SCIP_DECL_EVENTINIT(), and SCIPincludeEventHdlrBoundwriting().
◆ EVENTHDLR_DESC
#define EVENTHDLR_DESC "event handler for writing current primalbound and global dualbound and for all open nodes the dualbound" |
Definition at line 69 of file event_boundwriting.c.
Referenced by SCIPincludeEventHdlrBoundwriting().
◆ DEFAULT_FREQ
#define DEFAULT_FREQ 0LL |
frequency for writing primal and dual bounds
Definition at line 71 of file event_boundwriting.c.
Referenced by SCIPincludeEventHdlrBoundwriting().
◆ DEFAULT_FILENAME
#define DEFAULT_FILENAME "" |
filename to write to
Definition at line 72 of file event_boundwriting.c.
Referenced by SCIPincludeEventHdlrBoundwriting().
◆ DEFAULT_WRITESUBMIPDUALBOUND
#define DEFAULT_WRITESUBMIPDUALBOUND FALSE |
write dualbound after solving supmip root for all open node
Definition at line 73 of file event_boundwriting.c.
Referenced by SCIPincludeEventHdlrBoundwriting().
Function Documentation
◆ initEventhdlrdata()
|
static |
initializes the reader data
- Parameters
-
eventhdlrdata event handler data
Definition at line 108 of file event_boundwriting.c.
Referenced by SCIPincludeEventHdlrBoundwriting().
◆ applyDomainChanges()
|
static |
- Parameters
-
subscip scip to apply domain changes vars variables in original scip instance bounds bounds which should be applied boundtypes bound types for bounds which should be applied nvars number of variables varmap hashmap for identifiing the corresponding variables in subscip
Definition at line 124 of file event_boundwriting.c.
References FALSE, NULL, SCIP_Bool, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_INVALID, SCIP_NODETYPE_PROBINGNODE, SCIP_OKAY, SCIP_PARAMSETTING_OFF, SCIP_Real, SCIP_STATUS_INFEASIBLE, SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPcopy(), SCIPcreate(), SCIPfree(), SCIPgetCurrentNode(), SCIPgetCutoffbound(), SCIPgetDualbound(), SCIPgetNNodes(), SCIPgetNNodesLeft(), SCIPgetNodeDualbound(), SCIPgetPrimalbound(), SCIPgetStatus(), SCIPgetTransObjoffset(), SCIPgetTransObjscale(), SCIPhashmapGetImage(), SCIPinfoMessage(), SCIPisEQ(), SCIPisInfinity(), SCIPnodeGetDepth(), SCIPnodeGetNumber(), SCIPnodeGetType(), SCIPsetBoolParam(), SCIPsetHeuristics(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetObjlimit(), SCIPsolve(), and TRUE.
Referenced by writeBounds().
◆ writeBounds()
|
static |
call writing method
- Parameters
-
scip SCIP data structure file file to write to or NULL writesubmipdualbound write dualbounds of submip roots for all open nodes
Definition at line 271 of file event_boundwriting.c.
References applyDomainChanges(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIP_STATUS_INFEASIBLE, SCIPallocBufferArray, SCIPblkmem(), SCIPcopy(), SCIPcreate(), SCIPfree(), SCIPfreeBufferArray, SCIPgetChildren(), SCIPgetCutoffbound(), SCIPgetDualbound(), SCIPgetLeaves(), SCIPgetNNodes(), SCIPgetNNodesLeft(), SCIPgetNodeDualbound(), SCIPgetPrimalbound(), SCIPgetSiblings(), SCIPgetStatus(), SCIPgetTransObjoffset(), SCIPgetTransObjscale(), SCIPgetVarsData(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPinfoMessage(), SCIPisStopped(), SCIPnodeGetAncestorBranchings(), SCIPnodeGetDepth(), SCIPnodeGetNumber(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetObjlimit(), SCIPsolve(), and TRUE.
Referenced by SCIP_DECL_EVENTEXEC().
◆ SCIP_DECL_EVENTCOPY()
|
static |
copy method for event handler plugins (called when SCIP copies plugins)
Definition at line 434 of file event_boundwriting.c.
References EVENTHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPeventhdlrGetName(), and SCIPincludeEventHdlrBoundwriting().
◆ SCIP_DECL_EVENTFREE()
|
static |
destructor of event handler to free user data (called when SCIP is exiting)
Definition at line 450 of file event_boundwriting.c.
References NULL, SCIP_OKAY, SCIPeventhdlrGetData(), and SCIPfreeBlockMemory.
◆ SCIP_DECL_EVENTINIT()
|
static |
initialization method of event handler (called after problem was transformed)
Definition at line 469 of file event_boundwriting.c.
References EVENTHDLR_NAME, NULL, SCIP_CALL, SCIP_EVENTTYPE_NODESOLVED, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIPcatchEvent(), SCIPeventhdlrGetData(), SCIPeventhdlrGetName(), SCIPgetObjsense(), and SCIPinfinity().
◆ SCIP_DECL_EVENTEXIT()
|
static |
deinitialization method of event handler (called before transformed problem is freed)
Definition at line 489 of file event_boundwriting.c.
References EVENTHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_EVENTTYPE_NODESOLVED, SCIP_OKAY, SCIPdropEvent(), SCIPeventhdlrGetData(), and SCIPeventhdlrGetName().
◆ SCIP_DECL_EVENTEXEC()
|
static |
execution method of event handler
Definition at line 517 of file event_boundwriting.c.
References EVENTHDLR_NAME, FALSE, NULL, number, SCIP_CALL, SCIP_EVENTTYPE_NODEBRANCHED, SCIP_EVENTTYPE_NODEFEASIBLE, SCIP_EVENTTYPE_NODEINFEASIBLE, SCIP_EVENTTYPE_NODESOLVED, SCIP_FILECREATEERROR, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPdebugMsg, SCIPerrorMessage, SCIPeventGetType(), SCIPeventhdlrGetData(), SCIPeventhdlrGetName(), SCIPgetNBinVars(), SCIPgetNConss(), SCIPgetNContVars(), SCIPgetNImplVars(), SCIPgetNIntVars(), SCIPgetNNodes(), SCIPgetNOrigConss(), SCIPgetNOrigVars(), SCIPgetNVars(), SCIPgetProbName(), SCIPinfoMessage(), SCIPprintSysError(), TRUE, and writeBounds().
◆ SCIPincludeEventHdlrBoundwriting()
SCIP_RETCODE SCIPincludeEventHdlrBoundwriting | ( | SCIP * | scip | ) |
includes event handler for writing primal- and dualbound for all open nodes
- Parameters
-
scip SCIP data structure
Definition at line 667 of file event_boundwriting.c.
References DEFAULT_FILENAME, DEFAULT_FREQ, DEFAULT_WRITESUBMIPDUALBOUND, EVENTHDLR_DESC, EVENTHDLR_NAME, FALSE, initEventhdlrdata(), NULL, SCIP_CALL, SCIP_LONGINT_MAX, SCIP_OKAY, SCIPaddBoolParam(), SCIPaddLongintParam(), SCIPaddStringParam(), SCIPallocBlockMemory, SCIPincludeEventhdlrBasic(), SCIPsetEventhdlrCopy(), SCIPsetEventhdlrExit(), SCIPsetEventhdlrFree(), and SCIPsetEventhdlrInit().
Referenced by runShell(), and SCIP_DECL_EVENTCOPY().