Scippy

SCIP

Solving Constraint Integer Programs

event_boundwriting.c File Reference

Detailed Description

event handler for writing primal and dual bound for all open nodes

Author
Michael Winkler

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
#define ONEFILE
and recompiling this example.
If you want to get a better human readable format for printing, define
#define LONGSTATS
and recompile this example.

Definition in file event_boundwriting.c.

#include <string.h>
#include "event_boundwriting.h"

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"

◆ EVENTHDLR_DESC

#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.

Referenced by SCIPincludeEventHdlrBoundwriting().

◆ DEFAULT_FREQ

#define DEFAULT_FREQ   0LL

frequency for writing primal and dual bounds

Definition at line 80 of file event_boundwriting.c.

Referenced by SCIPincludeEventHdlrBoundwriting().

◆ DEFAULT_FILENAME

#define DEFAULT_FILENAME   ""

filename to write to

Definition at line 81 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 82 of file event_boundwriting.c.

Referenced by SCIPincludeEventHdlrBoundwriting().

Function Documentation

◆ initEventhdlrdata()

static void initEventhdlrdata ( SCIP_EVENTHDLRDATA eventhdlrdata)
static

initializes the reader data

Parameters
eventhdlrdataevent handler data

Definition at line 117 of file event_boundwriting.c.

References FALSE, and NULL.

Referenced by SCIPincludeEventHdlrBoundwriting().

◆ applyDomainChanges()

static SCIP_RETCODE applyDomainChanges ( SCIP subscip,
SCIP_VAR **  vars,
SCIP_Real bounds,
SCIP_BOUNDTYPE boundtypes,
int  nvars,
SCIP_HASHMAP varmap 
)
static

◆ writeBounds()

◆ SCIP_DECL_EVENTCOPY()

static SCIP_DECL_EVENTCOPY ( eventCopyBoundwriting  )
static

copy method for event handler plugins (called when SCIP copies plugins)

Definition at line 443 of file event_boundwriting.c.

References EVENTHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPeventhdlrGetName(), and SCIPincludeEventHdlrBoundwriting().

◆ SCIP_DECL_EVENTFREE()

static SCIP_DECL_EVENTFREE ( eventFreeBoundwriting  )
static

destructor of event handler to free user data (called when SCIP is exiting)

Definition at line 459 of file event_boundwriting.c.

References NULL, SCIP_OKAY, SCIPeventhdlrGetData(), and SCIPfreeBlockMemory.

◆ SCIP_DECL_EVENTINIT()

static SCIP_DECL_EVENTINIT ( eventInitBoundwriting  )
static

initialization method of event handler (called after problem was transformed)

Definition at line 478 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 SCIP_DECL_EVENTEXIT ( eventExitBoundwriting  )
static

deinitialization method of event handler (called before transformed problem is freed)

Definition at line 498 of file event_boundwriting.c.

References EVENTHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_EVENTTYPE_NODESOLVED, SCIP_OKAY, SCIPdropEvent(), SCIPeventhdlrGetData(), and SCIPeventhdlrGetName().

◆ SCIP_DECL_EVENTEXEC()

◆ SCIPincludeEventHdlrBoundwriting()