Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

methods for creating output for visualization tools (VBC, BAK)

Author
Tobias Achterberg
Marc Pfetsch

Output can be generated for the following visualization tools:

  • VBCTOOL - a graphical interface for Visualization of Branch Cut algorithms
    See VBCTOOL.
  • BAK: Branch-and-bound Analysis Kit
    BAK is available through COIN-OR, see BAK. A description is available as well.

Definition in file visual.c.

#include <stdio.h>
#include <assert.h>
#include "blockmemshell/memory.h"
#include "scip/scip.h"
#include "scip/set.h"
#include "scip/stat.h"
#include "scip/clock.h"
#include "scip/var.h"
#include "scip/tree.h"
#include "scip/visual.h"
#include "scip/struct_visual.h"

Go to the source code of this file.

Functions

static void getBranchInfo (SCIP_NODE *node, SCIP_VAR **var, SCIP_BOUNDTYPE *boundtype, SCIP_Real *bound)
 
SCIP_RETCODE SCIPvisualCreate (SCIP_VISUAL **visual, SCIP_MESSAGEHDLR *messagehdlr)
 
void SCIPvisualFree (SCIP_VISUAL **visual)
 
SCIP_RETCODE SCIPvisualInit (SCIP_VISUAL *visual, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
 
void SCIPvisualExit (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
 
static void printTime (SCIP_VISUAL *visual, SCIP_STAT *stat, SCIP_Bool vbc)
 
SCIP_RETCODE SCIPvisualNewChild (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_STAT *stat, SCIP_NODE *node)
 
SCIP_RETCODE SCIPvisualUpdateChild (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_STAT *stat, SCIP_NODE *node)
 
static void vbcSetColor (SCIP_VISUAL *visual, SCIP_STAT *stat, SCIP_NODE *node, SCIP_VBCCOLOR color)
 
void SCIPvisualSolvedNode (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_STAT *stat, SCIP_NODE *node)
 
void SCIPvisualCutoffNode (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_STAT *stat, SCIP_NODE *node, SCIP_Bool infeasible)
 
void SCIPvisualFoundConflict (SCIP_VISUAL *visual, SCIP_STAT *stat, SCIP_NODE *node)
 
void SCIPvisualMarkedRepropagateNode (SCIP_VISUAL *visual, SCIP_STAT *stat, SCIP_NODE *node)
 
void SCIPvisualRepropagatedNode (SCIP_VISUAL *visual, SCIP_STAT *stat, SCIP_NODE *node)
 
void SCIPvisualFoundSolution (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_STAT *stat, SCIP_NODE *node, SCIP_Bool bettersol, SCIP_SOL *sol)
 
void SCIPvisualLowerbound (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_STAT *stat, SCIP_Real lowerbound)
 
void SCIPvisualUpperbound (SCIP_VISUAL *visual, SCIP_SET *set, SCIP_STAT *stat, SCIP_Real upperbound)
 

Function Documentation

◆ getBranchInfo()

static void getBranchInfo ( SCIP_NODE node,
SCIP_VAR **  var,
SCIP_BOUNDTYPE boundtype,
SCIP_Real bound 
)
static

returns the branching variable of the node, or NULL

Parameters
nodenode
varpointer to store the branching variable
boundtypepointer to store the branching type: lower or upper bound
boundpointer to store the new bound of the branching variable

Definition at line 58 of file visual.c.

References SCIP_DomChgBound::boundchgs, SCIP_BoundChg::boundtype, SCIP_Node::domchg, SCIP_DomChg::domchgbound, SCIP_DomChgBound::nboundchgs, SCIP_BoundChg::newbound, NULL, SCIP_BOUNDTYPE_LOWER, and SCIP_BoundChg::var.

Referenced by SCIPvisualCutoffNode(), SCIPvisualFoundSolution(), SCIPvisualNewChild(), SCIPvisualSolvedNode(), and SCIPvisualUpdateChild().

◆ SCIPvisualCreate()

SCIP_RETCODE SCIPvisualCreate ( SCIP_VISUAL **  visual,
SCIP_MESSAGEHDLR messagehdlr 
)

creates visualization data structure

Parameters
visualpointer to store visualization information
messagehdlrmessage handler

Definition at line 85 of file visual.c.

References BMSallocMemory, FALSE, SCIP_Visual::messagehdlr, NULL, SCIP_ALLOC, SCIP_INVALID, SCIP_OKAY, and SCIP_VBCCOLOR_NONE.

Referenced by SCIPstatCreate().

◆ SCIPvisualFree()

void SCIPvisualFree ( SCIP_VISUAL **  visual)

frees visualization data structure

Parameters
visualpointer to store visualization information

Definition at line 106 of file visual.c.

References BMSfreeMemory, and NULL.

Referenced by SCIPstatFree().

◆ SCIPvisualInit()

SCIP_RETCODE SCIPvisualInit ( SCIP_VISUAL visual,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_MESSAGEHDLR messagehdlr 
)

initializes visualization information and creates a file for visualization output

Parameters
visualvisualization information
blkmemblock memory
setglobal SCIP settings
messagehdlrmessage handler

Definition at line 120 of file visual.c.

References SCIP_Visual::bakfile, SCIP_Visual::lastcolor, SCIP_Visual::lastlowerbound, SCIP_Visual::lastnode, SCIP_Visual::messagehdlr, SCIP_Visual::nodenum, NULL, SCIP_CALL, SCIP_FILECREATEERROR, SCIP_HASHSIZE_VBC, SCIP_OKAY, SCIP_VBCCOLOR_NONE, SCIP_VERBLEVEL_NORMAL, SCIPerrorMessage, SCIPhashmapCreate(), SCIPmessageFPrintInfo(), SCIPmessagePrintVerbInfo(), SCIPprintSysError(), SCIPsetInfinity(), SCIP_Visual::timestep, SCIP_Visual::userealtime, and SCIP_Visual::vbcfile.

Referenced by initSolve().

◆ SCIPvisualExit()

void SCIPvisualExit ( SCIP_VISUAL visual,
SCIP_SET set,
SCIP_MESSAGEHDLR messagehdlr 
)

closes the visualization output file

Parameters
visualvisualization information
setglobal SCIP settings
messagehdlrmessage handler

Definition at line 189 of file visual.c.

References SCIP_Visual::bakfile, SCIP_Visual::nodenum, NULL, SCIP_VERBLEVEL_FULL, SCIPhashmapFree(), SCIPmessagePrintVerbInfo(), and SCIP_Visual::vbcfile.

Referenced by freeReoptSolve(), and freeSolve().

◆ printTime()

static void printTime ( SCIP_VISUAL visual,
SCIP_STAT stat,
SCIP_Bool  vbc 
)
static

prints current solution time to visualization output file

Parameters
visualvisualization information
statproblem statistics
vbcwhether we use vbc output (bak otherwise)

Definition at line 220 of file visual.c.

References SCIP_Visual::bakfile, SCIP_Visual::messagehdlr, NULL, SCIP_Longint, SCIP_Real, SCIPclockGetTime(), SCIPmessageFPrintInfo(), SCIP_Stat::solvingtime, SCIP_Visual::timestep, SCIP_Visual::userealtime, and SCIP_Visual::vbcfile.

Referenced by SCIPvisualCutoffNode(), SCIPvisualFoundSolution(), SCIPvisualLowerbound(), SCIPvisualNewChild(), SCIPvisualSolvedNode(), SCIPvisualUpdateChild(), SCIPvisualUpperbound(), and vbcSetColor().

◆ SCIPvisualNewChild()

◆ SCIPvisualUpdateChild()

◆ vbcSetColor()

static void vbcSetColor ( SCIP_VISUAL visual,
SCIP_STAT stat,
SCIP_NODE node,
SCIP_VBCCOLOR  color 
)
static

changes the color of the node to the given color

Parameters
visualvisualization information
statproblem statistics
nodenode to change color for
colornew color of node, or SCIP_VBCCOLOR_NONE

Definition at line 449 of file visual.c.

References SCIP_Visual::lastcolor, SCIP_Visual::lastnode, SCIP_Visual::messagehdlr, SCIP_Visual::nodenum, NULL, printTime(), SCIP_VBCCOLOR_NONE, SCIPhashmapGetImageInt(), SCIPmessageFPrintInfo(), TRUE, and SCIP_Visual::vbcfile.

Referenced by SCIPvisualCutoffNode(), SCIPvisualFoundConflict(), SCIPvisualFoundSolution(), SCIPvisualMarkedRepropagateNode(), SCIPvisualRepropagatedNode(), and SCIPvisualSolvedNode().

◆ SCIPvisualSolvedNode()

void SCIPvisualSolvedNode ( SCIP_VISUAL visual,
SCIP_SET set,
SCIP_STAT stat,
SCIP_NODE node 
)

◆ SCIPvisualCutoffNode()

void SCIPvisualCutoffNode ( SCIP_VISUAL visual,
SCIP_SET set,
SCIP_STAT stat,
SCIP_NODE node,
SCIP_Bool  infeasible 
)

changes the color of the node to the color of cutoff nodes

Parameters
visualvisualization information
setglobal SCIP settings
statproblem statistics
nodenode, that was cut off
infeasiblewhether the node is infeasible (otherwise exceeded the cutoff bound)

Definition at line 533 of file visual.c.

References SCIP_Visual::bakfile, FALSE, getBranchInfo(), SCIP_Visual::messagehdlr, SCIP_Stat::nnodes, SCIP_Visual::nodenum, NULL, SCIP_Node::parent, printTime(), SCIP_BOUNDTYPE_LOWER, SCIP_NODETYPE_PROBINGNODE, SCIP_Real, SCIP_VBCCOLOR_CUTOFF, SCIPhashmapGetImageInt(), SCIPmessageFPrintInfo(), SCIPnodeGetDepth(), SCIPnodeGetLowerbound(), SCIPnodeGetType(), SCIPretransformObj(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), TRUE, SCIP_Visual::vbcfile, and vbcSetColor().

Referenced by nodeToLeaf(), SCIPnodeCutoff(), SCIPnodeFocus(), SCIPnodepqBound(), SCIPsolveCIP(), and SCIPtreeCutoff().

◆ SCIPvisualFoundConflict()

void SCIPvisualFoundConflict ( SCIP_VISUAL visual,
SCIP_STAT stat,
SCIP_NODE node 
)

changes the color of the node to the color of nodes where a conflict constraint was found

Parameters
visualvisualization information
statproblem statistics
nodenode, where the conflict was found

Definition at line 612 of file visual.c.

References NULL, SCIP_NODETYPE_PROBINGNODE, SCIP_VBCCOLOR_CONFLICT, SCIPnodeGetType(), and vbcSetColor().

Referenced by SCIPconflictFlushConss().

◆ SCIPvisualMarkedRepropagateNode()

void SCIPvisualMarkedRepropagateNode ( SCIP_VISUAL visual,
SCIP_STAT stat,
SCIP_NODE node 
)

changes the color of the node to the color of nodes that were marked to be repropagated

Parameters
visualvisualization information
statproblem statistics
nodenode, that was marked to be repropagated

Definition at line 630 of file visual.c.

References NULL, SCIP_NODETYPE_PROBINGNODE, SCIP_VBCCOLOR_MARKREPROP, SCIPnodeGetNumber(), SCIPnodeGetType(), and vbcSetColor().

Referenced by SCIPnodePropagateAgain().

◆ SCIPvisualRepropagatedNode()

void SCIPvisualRepropagatedNode ( SCIP_VISUAL visual,
SCIP_STAT stat,
SCIP_NODE node 
)

changes the color of the node to the color of repropagated nodes

Parameters
visualvisualization information
statproblem statistics
nodenode, that was repropagated

Definition at line 651 of file visual.c.

References NULL, SCIP_NODETYPE_PROBINGNODE, SCIP_VBCCOLOR_REPROP, SCIPnodeGetType(), and vbcSetColor().

Referenced by nodeRepropagate().

◆ SCIPvisualFoundSolution()

void SCIPvisualFoundSolution ( SCIP_VISUAL visual,
SCIP_SET set,
SCIP_STAT stat,
SCIP_NODE node,
SCIP_Bool  bettersol,
SCIP_SOL sol 
)

changes the color of the node to the color of nodes with a primal solution

Parameters
visualvisualization information
setglobal SCIP settings
statproblem statistics
nodenode where the solution was found, or NULL
bettersolthe solution was better than the previous ones
solsolution that has been found

Definition at line 669 of file visual.c.

References SCIP_Visual::bakfile, FALSE, getBranchInfo(), SCIP_Visual::messagehdlr, SCIP_Visual::nodenum, NULL, SCIP_Node::parent, printTime(), SCIP_BOUNDTYPE_LOWER, SCIP_NODETYPE_PROBINGNODE, SCIP_Real, SCIP_VBCCOLOR_SOLUTION, SCIPgetSolOrigObj(), SCIPgetSolTransObj(), SCIPhashmapGetImageInt(), SCIPmessageFPrintInfo(), SCIPnodeGetParent(), SCIPnodeGetType(), SCIPsolGetHeur(), TRUE, SCIP_Visual::vbcfile, and vbcSetColor().

Referenced by primalAddSol().

◆ SCIPvisualLowerbound()

void SCIPvisualLowerbound ( SCIP_VISUAL visual,
SCIP_SET set,
SCIP_STAT stat,
SCIP_Real  lowerbound 
)

outputs a new global lower bound to the visualization output file

Parameters
visualvisualization information
setglobal SCIP settings
statproblem statistics
lowerboundnew lower bound

Definition at line 768 of file visual.c.

References SCIP_Visual::lastlowerbound, SCIP_Visual::messagehdlr, NULL, printTime(), SCIP_OBJSENSE_MINIMIZE, SCIPgetObjsense(), SCIPmessageFPrintInfo(), SCIPretransformObj(), SCIPsetIsGT(), SCIPsetIsInfinity(), TRUE, and SCIP_Visual::vbcfile.

Referenced by SCIPnodeUpdateLowerbound().

◆ SCIPvisualUpperbound()

void SCIPvisualUpperbound ( SCIP_VISUAL visual,
SCIP_SET set,
SCIP_STAT stat,
SCIP_Real  upperbound 
)

outputs a new global upper bound to the visualization output file

Parameters
visualvisualization information
setglobal SCIP settings
statproblem statistics
upperboundnew upper bound

Definition at line 805 of file visual.c.

References SCIP_Visual::messagehdlr, NULL, printTime(), SCIP_OBJSENSE_MINIMIZE, SCIPgetObjsense(), SCIPmessageFPrintInfo(), SCIPretransformObj(), TRUE, and SCIP_Visual::vbcfile.

Referenced by primalSetUpperbound().