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.
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) |
#define EVENTHDLR_NAME "boundwriting" |
Definition at line 77 of file event_boundwriting.c.
#define EVENTHDLR_DESC "event handler for writing current primalbound and global dualbound and for all open nodes the dualbound" |
Definition at line 78 of file event_boundwriting.c.
#define DEFAULT_FREQ 0LL |
frequency for writing primal and dual bounds
Definition at line 80 of file event_boundwriting.c.
Referenced by SCIPincludeEventHdlrBoundwriting().
#define DEFAULT_FILENAME "" |
filename to write to
Definition at line 81 of file event_boundwriting.c.
#define DEFAULT_WRITESUBMIPDUALBOUND FALSE |
write dualbound after solving supmip root for all open node
Definition at line 82 of file event_boundwriting.c.
Referenced by SCIPincludeEventHdlrBoundwriting().
|
static |
initializes the reader data
eventhdlrdata | event handler data |
Definition at line 117 of file event_boundwriting.c.
References assert(), FALSE, and NULL.
Referenced by SCIPincludeEventHdlrBoundwriting().
|
static |
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 133 of file event_boundwriting.c.
References assert(), NULL, nvars, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPhashmapGetImage(), and vars.
Referenced by writeBounds().
|
static |
call writing method
scip | SCIP data structure |
file | file to write to or NULL |
writesubmipdualbound | write dualbounds of submip roots for all open nodes |
Definition at line 280 of file event_boundwriting.c.
References applyDomainChanges(), assert(), cutoff, FALSE, NULL, nvars, SCIP_Bool, SCIP_CALL, SCIP_INVALID, SCIP_LONGINT_FORMAT, 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(), TRUE, valid, and vars.
Referenced by SCIP_DECL_EVENTEXEC().
|
static |
copy method for event handler plugins (called when SCIP copies plugins)
Definition at line 443 of file event_boundwriting.c.
References assert(), EVENTHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPeventhdlrGetName(), and SCIPincludeEventHdlrBoundwriting().
|
static |
destructor of event handler to free user data (called when SCIP is exiting)
Definition at line 459 of file event_boundwriting.c.
References assert(), NULL, SCIP_OKAY, SCIPeventhdlrGetData(), and SCIPfreeBlockMemory.
|
static |
initialization method of event handler (called after problem was transformed)
Definition at line 478 of file event_boundwriting.c.
References assert(), EVENTHDLR_NAME, NULL, SCIP_CALL, SCIP_EVENTTYPE_NODESOLVED, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIPcatchEvent(), SCIPeventhdlrGetData(), SCIPeventhdlrGetName(), SCIPgetObjsense(), and SCIPinfinity().
|
static |
deinitialization method of event handler (called before transformed problem is freed)
Definition at line 498 of file event_boundwriting.c.
References assert(), EVENTHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_EVENTTYPE_NODESOLVED, SCIP_OKAY, SCIPdropEvent(), SCIPeventhdlrGetData(), and SCIPeventhdlrGetName().
|
static |
execution method of event handler
Definition at line 526 of file event_boundwriting.c.
References assert(), EVENTHDLR_NAME, FALSE, NULL, number, SCIP_CALL, SCIP_EVENTTYPE_NODEBRANCHED, SCIP_EVENTTYPE_NODEFEASIBLE, SCIP_EVENTTYPE_NODEINFEASIBLE, SCIP_EVENTTYPE_NODESOLVED, SCIP_FILECREATEERROR, SCIP_LONGINT_FORMAT, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPdebugMsg, SCIPerrorMessage, SCIPeventGetType(), SCIPeventhdlrGetData(), SCIPeventhdlrGetName(), SCIPgetNBinVars(), SCIPgetNConss(), SCIPgetNContVars(), SCIPgetNImplVars(), SCIPgetNIntVars(), SCIPgetNNodes(), SCIPgetNOrigConss(), SCIPgetNOrigVars(), SCIPgetNVars(), SCIPgetProbName(), SCIPinfoMessage(), SCIPprintSysError(), SCIPstrncpy(), TRUE, and writeBounds().
SCIP_RETCODE SCIPincludeEventHdlrBoundwriting | ( | SCIP * | scip | ) |
includes event handler for writing primal- and dualbound for all open nodes
scip | SCIP data structure |
Definition at line 672 of file event_boundwriting.c.
References assert(), 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().