Scippy

SCIP

Solving Constraint Integer Programs

completegraph.h File Reference

Detailed Description

includes complete graph methods, in particular for MST calculation

Author
Daniel Rehfeldt

Definition in file completegraph.h.

#include "scip/scip.h"
#include "graph.h"

Go to the source code of this file.

Data Structures

struct  complete_graph
 
struct  complete_graph_node_buffer
 
struct  complete_mst
 

Macros

#define CGRAPH_EDGECOST_UNDEFINED_VALUE   -1.0
 

Typedefs

typedef struct complete_graph CGRAPH
 
typedef struct complete_graph_node_buffer CNBUFF
 
typedef struct complete_mst CMST
 

Functions

SCIP_Bool cgraph_valid (const CGRAPH *)
 
SCIP_Bool cgraph_isEmpty (const CGRAPH *)
 
SCIP_Bool cgraph_idsInSync (const CGRAPH *, const int *, int)
 
SCIP_Bool cgraph_idIsContained (const CGRAPH *, int)
 
SCIP_RETCODE cgraph_init (SCIP *, CGRAPH **, int)
 
void cgraph_free (SCIP *, CGRAPH **)
 
void cgraph_clean (CGRAPH *)
 
SCIP_Bool cgraph_node_hasAdjCosts (const CGRAPH *, int)
 
void cgraph_node_append (CGRAPH *, int)
 
void cgraph_node_applyMinAdjCosts (CGRAPH *, int, int)
 
void cgraph_node_repositionTop (CGRAPH *, int)
 
void cgraph_node_deleteTop (CGRAPH *)
 
void cgraph_node_delete (CGRAPH *, int)
 
int cgraph_node_getTopId (const CGRAPH *)
 
SCIP_Real cgraph_edge_getCost (const CGRAPH *, int, int)
 
SCIP_Bool cmst_isSync (const CGRAPH *, const CMST *)
 
SCIP_RETCODE cmst_init (SCIP *, CMST **, int)
 
void cmst_free (SCIP *, CMST **)
 
void cmst_computeMst (const CGRAPH *, int, CMST *)
 

Macro Definition Documentation

◆ CGRAPH_EDGECOST_UNDEFINED_VALUE

Typedef Documentation

◆ CGRAPH

typedef struct complete_graph CGRAPH

complete, undirected graph storage

◆ CNBUFF

buffer that allows to (partially) restore a complete graph node todo need something more special here that takes dfs depth and a node identifier (which) as input applies corresponding part to graph... maybe whenever you store something you get an identifier back???

◆ CMST

typedef struct complete_mst CMST

complete, undirected graph MST storage; for computing an MST on a CGRAPH

Function Documentation

◆ cgraph_valid()

◆ cgraph_isEmpty()

SCIP_Bool cgraph_isEmpty ( const CGRAPH cgraph)

is the graph empty?

Parameters
cgraphnew graph

Definition at line 347 of file completegraph.c.

References cgraph_valid(), and complete_graph::nnodes_curr.

Referenced by cgraph_clean().

◆ cgraph_idsInSync()

SCIP_Bool cgraph_idsInSync ( const CGRAPH cgraph,
const int *  ids,
int  nids 
)

is the graph in sync with given node id list?

Parameters
cgraphthe graph
idsnode ids
nidsnumber of ids

Definition at line 214 of file completegraph.c.

References FALSE, complete_graph::nnodes_curr, complete_graph::nodeids, SCIPdebugMessage, and TRUE.

◆ cgraph_idIsContained()

SCIP_Bool cgraph_idIsContained ( const CGRAPH cgraph,
int  id 
)

is node with given id in the graph??

Parameters
cgraphthe graph
idthe id

Definition at line 243 of file completegraph.c.

References FALSE, getNnodesCurr(), nnodes, complete_graph::nodeids, and TRUE.

Referenced by cgraph_node_append().

◆ cgraph_init()

◆ cgraph_free()

void cgraph_free ( SCIP scip,
CGRAPH **  cgraph 
)

◆ cgraph_clean()

void cgraph_clean ( CGRAPH cgraph)

cleans, i.e. resets, graph

Parameters
cgraphnew graph

Definition at line 331 of file completegraph.c.

References cgraph_isEmpty(), cgraph_node_deleteTop(), cgraph_valid(), and getNnodesCurr().

◆ cgraph_node_hasAdjCosts()

SCIP_Bool cgraph_node_hasAdjCosts ( const CGRAPH cgraph,
int  nodepos 
)

has the given node adjacency costs?

Parameters
cgraphthe complete graph
nodeposthe node position

Definition at line 358 of file completegraph.c.

References cgraph_valid(), getNnodesCurr(), and complete_graph::node_has_adjcosts.

Referenced by cmst_computeMst().

◆ cgraph_node_append()

void cgraph_node_append ( CGRAPH cgraph,
int  nodeid 
)

◆ cgraph_node_applyMinAdjCosts()

void cgraph_node_applyMinAdjCosts ( CGRAPH cgraph,
int  nodepos,
int  nodeid 
)

applies adjacency costs to node, but only use if smaller than existing ones.

Parameters
cgraphthe complete graph
nodeposthe node position
nodeidthe node id (for debugging only)

Definition at line 371 of file completegraph.c.

References complete_graph::adjedgecosts, CGRAPH_EDGECOST_UNDEFINED_VALUE, cgraph_valid(), complete_graph::edgecosts, EQ, GE, getEdgeStart(), getNnodesCurr(), getNnodesMax(), complete_graph::node_has_adjcosts, complete_graph::nodeids, SCIP_Real, and TRUE.

Referenced by completemst1(), completemst2(), completemst3(), completemst4(), completemst5(), and sdmstGetWeight().

◆ cgraph_node_repositionTop()

void cgraph_node_repositionTop ( CGRAPH cgraph,
int  nodeid_new 
)

replaces node with id 'nodeid_new' by top node

Parameters
cgraphnew graph
nodeid_newthe new node id

Definition at line 463 of file completegraph.c.

References BMScopyMemoryArray, cgraph_node_deleteTop(), cgraph_valid(), complete_graph::edgecosts, EQ, FARAWAY, getEdgeStart(), getNnodesCurr(), getNnodesMax(), getPositionFromId(), complete_graph::nodeids, and SCIP_Real.

Referenced by completemst1().

◆ cgraph_node_deleteTop()

◆ cgraph_node_delete()

void cgraph_node_delete ( CGRAPH cgraph,
int  nodeid 
)

deletes node

Parameters
cgraphnew graph
nodeidthe node id

Definition at line 558 of file completegraph.c.

References cgraph_valid(), complete_graph::nnodes_curr, and complete_graph::nodeids.

◆ cgraph_node_getTopId()

int cgraph_node_getTopId ( const CGRAPH cgraph)

gets id of node at the top

Parameters
cgraphnew graph

Definition at line 581 of file completegraph.c.

References cgraph_valid(), complete_graph::nnodes_curr, and complete_graph::nodeids.

◆ cgraph_edge_getCost()

SCIP_Real cgraph_edge_getCost ( const CGRAPH cgraph,
int  nodeid_tail,
int  nodeid_head 
)

Get edge cost. Note: quite slow, only use for debugging!

Parameters
cgraphnew graph
nodeid_tailthe node id
nodeid_headthe node id

Definition at line 595 of file completegraph.c.

References cgraph_valid().

◆ cmst_isSync()

SCIP_Bool cmst_isSync ( const CGRAPH cgraph,
const CMST cmst 
)

is the MST struct valid?

Parameters
cgraphnew graph
cmstthe MST

Definition at line 610 of file completegraph.c.

References complete_graph::edgecosts, EQ, FALSE, getEdgeStart(), getNnodesCurr(), getNnodesMax(), complete_mst::mstobj, nnodes, complete_mst::nnodes_max, complete_mst::predecessors, SCIP_Real, SCIPdebugMessage, and TRUE.

Referenced by cmst_computeMst().

◆ cmst_init()

SCIP_RETCODE cmst_init ( SCIP scip,
CMST **  cmst,
int  maxnnodes 
)

◆ cmst_free()

void cmst_free ( SCIP scip,
CMST **  cmst 
)

◆ cmst_computeMst()