Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

internal methods for dealing with hypergraphs

Author
Matthias Walter

Definition in file hypergraph.c.

#include <assert.h>
#include "scip/hypergraph.h"
#include "scip/misc.h"
#include "scip/pub_message.h"
#include "scip/struct_hypergraph.h"

Go to the source code of this file.

Functions

static SCIP_RETCODE ensureNumVertices (SCIP_HYPERGRAPH *hypergraph, int required)
 enlarges vertex arrays to have capacity for at least required vertices More...
 
static SCIP_RETCODE ensureNumEdges (SCIP_HYPERGRAPH *hypergraph, int required)
 enlarges edge arrays to have capacity for at least required edges More...
 
static SCIP_RETCODE ensureNumEdgesVertices (SCIP_HYPERGRAPH *hypergraph, int required)
 enlarges arrays for incident vertex/edge pairs to have capacity for at least required More...
 
static SCIP_RETCODE ensureNumOverlaps (SCIP_HYPERGRAPH *hypergraph, int required)
 enlarges overlap arrays to have capacity for at least required overlaps More...
 
static SCIP_RETCODE ensureNumOverlapsVertices (SCIP_HYPERGRAPH *hypergraph, int required)
 enlarges overlapVertices array to have capacity for at least required overlaps' vertices More...
 
SCIP_RETCODE SCIPhypergraphCreate (SCIP_HYPERGRAPH **phypergraph, BMS_BLKMEM *blkmem, int memvertices, int memedges, int memoverlaps, int memedgesvertices, size_t sizevertexdata, size_t sizeedgedata, size_t sizeoverlapdata)
 creates a hypergraph More...
 
SCIP_RETCODE SCIPhypergraphFree (SCIP_HYPERGRAPH **phypergraph)
 frees a hypergraph More...
 
SCIP_RETCODE SCIPhypergraphClear (SCIP_HYPERGRAPH *hypergraph)
 clears a hypergraph, deleting all vertices and edges More...
 
SCIP_RETCODE SCIPhypergraphAddVertex (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX *pvertex, SCIP_HYPERGRAPH_VERTEXDATA **pvertexdata)
 adds a new vertex to the hypergraph More...
 
SCIP_RETCODE SCIPhypergraphAddEdge (SCIP_HYPERGRAPH *hypergraph, int nvertices, SCIP_HYPERGRAPH_VERTEX *vertices, SCIP_HYPERGRAPH_EDGE *pedge, SCIP_HYPERGRAPH_EDGEDATA **pedgedata)
 adds a new edge to the hypergraph More...
 
static SCIP_DECL_HASHGETKEY (overlapHashGetKey)
 get-key function for overlap hashtable More...
 
static SCIP_DECL_HASHKEYEQ (overlapHashKeyEqPtr)
 equality function for overlap hashtable More...
 
static SCIP_DECL_HASHKEYVAL (overlapHashKeyValPtr)
 hash function for overlap hashtable More...
 
static SCIP_RETCODE findOverlap (SCIP_HYPERGRAPH *hypergraph, int nvertices, int *vertices, int *poverlap, SCIP_Bool add, SCIP_Bool *padded)
 finds an overlap specified by a sorted vertex set, potentially adding it More...
 
SCIP_RETCODE SCIPhypergraphComputeOverlaps (SCIP_HYPERGRAPH *hypergraph, SCIP_DECL_HYPERGRAPH_OVERLAP((*handler)), void *userdata)
 computes all overlaps and stores overlaps' vertices and all edges' overlaps More...
 
SCIP_RETCODE SCIPhypergraphComputeVerticesEdges (SCIP_HYPERGRAPH *hypergraph)
 computes each vertex' list of incident edges More...
 
SCIP_RETCODE SCIPhypergraphOverlapFind (SCIP_HYPERGRAPH *hypergraph, int nvertices, SCIP_HYPERGRAPH_VERTEX *vertices, SCIP_HYPERGRAPH_OVERLAP *poverlap)
 finds the overlap corresponding to vertex set vertices; returns -1 if it is not found More...
 
SCIP_RETCODE SCIPhypergraphIntersectEdges (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE first, SCIP_HYPERGRAPH_EDGE second, SCIP_HYPERGRAPH_OVERLAP *poverlap, SCIP_HYPERGRAPH_VERTEX *pvertex)
 finds the overlap or singleton vertex corresponding to the intersection of edges first and second More...
 
SCIP_RETCODE SCIPhypergraphComputeOverlapsEdges (SCIP_HYPERGRAPH *hypergraph)
 computes all overlaps' lists of incident edges More...
 
SCIP_RETCODE SCIPhypergraphComputeVerticesOverlaps (SCIP_HYPERGRAPH *hypergraph)
 computes all vertices' lists of incident overlaps More...
 
SCIP_Bool SCIPhypergraphOverlapsDisjoint (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap1, SCIP_HYPERGRAPH_OVERLAP overlap2)
 returns whether overlaps overlap1 and overlap2 are disjoint More...
 
SCIP_Bool SCIPhypergraphIsValid (SCIP_HYPERGRAPH *hypergraph, FILE *file)
 asserts that the hypergraph data structures are valid More...
 
SCIP_RETCODE SCIPhypergraphIterInit (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
 initializes a hypergraph iterator's internal memory More...
 
void SCIPhypergraphIterClear (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
 frees a hypergraph iterator's internal memory More...
 
void SCIPhypergraphIterStart (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator, SCIP_HYPERGRAPH_EDGE base, unsigned int minoverlapsize, SCIP_Bool onlylater, SCIP_Bool findoverlaps)
 initializes the iterator to the first adjacent edge of base More...
 
SCIP_Bool SCIPhypergraphIterValid (SCIP_HYPERGRAPH_ITER *iterator)
 returns whether the iterator is valid More...
 
void SCIPhypergraphIterNext (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
 initializes the iterator to the first adjacent edge of base More...
 
SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterBase (SCIP_HYPERGRAPH_ITER *iterator)
 returns the base edge More...
 
SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterAdjacent (SCIP_HYPERGRAPH_ITER *iterator)
 returns the current adjacent edge More...
 
SCIP_HYPERGRAPH_VERTEX SCIPhypergraphIterMinVertex (SCIP_HYPERGRAPH_ITER *iterator)
 returns the minimum vertex in the intersection of the base and the current adjacent edge More...
 
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphIterOverlap (SCIP_HYPERGRAPH_ITER *iterator)
 returns the overlap for the intersection of the base and the current adjacent edge More...
 
int SCIPhypergraphGetNVertices (SCIP_HYPERGRAPH *hypergraph)
 returns the number of vertices More...
 
int SCIPhypergraphGetNEdges (SCIP_HYPERGRAPH *hypergraph)
 returns the number of edges More...
 
BMS_BLKMEMSCIPhypergraphBlkmem (SCIP_HYPERGRAPH *hypergraph)
 returns the hypergraph's block memory structure More...
 
int SCIPhypergraphGetNOverlaps (SCIP_HYPERGRAPH *hypergraph)
 returns the number of overlaps More...
 
int SCIPhypergraphGetNIncidences (SCIP_HYPERGRAPH *hypergraph)
 returns the number of edge-vertex incidences More...
 
SCIP_HYPERGRAPH_VERTEXDATASCIPhypergraphVertexData (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
 returns additional data of vertex More...
 
SCIP_HYPERGRAPH_EDGEDATASCIPhypergraphEdgeData (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
 returns additional data of edge More...
 
SCIP_HYPERGRAPH_OVERLAPDATASCIPhypergraphOverlapData (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
 returns additional data of overlap More...
 
int SCIPhypergraphEdgeSize (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
 returns the number of vertices of edge More...
 
SCIP_HYPERGRAPH_VERTEXSCIPhypergraphEdgeVertices (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
 returns the array of vertices of edge More...
 
SCIP_Bool SCIPhypergraphHasVertexEdges (SCIP_HYPERGRAPH *hypergraph)
 returns whether vertices' incident edges are known. More...
 
int SCIPhypergraphVertexEdgesFirst (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
 returns an index for the first edge incident to vertex More...
 
int SCIPhypergraphVertexEdgesBeyond (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
 returns an index beyond the last edge incident to vertex More...
 
SCIP_HYPERGRAPH_EDGE SCIPhypergraphVertexEdgesGetAtIndex (SCIP_HYPERGRAPH *hypergraph, int idx)
 returns the edge corresponding to index that is incident to a vertex More...
 
SCIP_Bool SCIPhypergraphHasOverlaps (SCIP_HYPERGRAPH *hypergraph)
 returns whether edges' overlaps and overlaps' vertices are known. More...
 
int SCIPhypergraphOverlapSize (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
 returns the number of vertices of overlap More...
 
SCIP_HYPERGRAPH_VERTEXSCIPhypergraphOverlapVertices (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
 returns the array of sorted vertices of overlap More...
 
int SCIPhypergraphEdgesOverlapsFirst (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
 returns an index for the first overlap incident to edge More...
 
int SCIPhypergraphEdgesOverlapsBeyond (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
 returns an index beyond the last overlap incident to edge More...
 
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphEdgesOverlapsGetAtIndex (SCIP_HYPERGRAPH *hypergraph, int idx)
 returns the overlap corresponding to idx that is incident to an edge More...
 
SCIP_Bool SCIPhypergraphHasOverlapsEdges (SCIP_HYPERGRAPH *hypergraph)
 returns whether overlaps' incident edges are known. More...
 
int SCIPhypergraphOverlapsEdgesFirst (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
 returns an index for the first edge incident to overlap More...
 
int SCIPhypergraphOverlapsEdgesBeyond (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
 returns an index beyond the last edge incident to overlap More...
 
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphOverlapsEdgesGetAtIndex (SCIP_HYPERGRAPH *hypergraph, int idx)
 returns the edge corresponding to idx that is incident to an overlap More...
 
SCIP_Bool SCIPhypergraphHasVertexOverlaps (SCIP_HYPERGRAPH *hypergraph)
 returns whether vertices' incident overlaps are known More...
 
int SCIPhypergraphVertexOverlapsFirst (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
 returns an index for the first overlap containing vertex More...
 
int SCIPhypergraphVertexOverlapsBeyond (SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
 returns an index beyond the last overlap incident to vertex More...
 
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphVertexOverlapsGetAtIndex (SCIP_HYPERGRAPH *hypergraph, int idx)
 returns the overlap corresponding to idx that is incident to a vertex More...
 

Function Documentation

◆ ensureNumVertices()

static SCIP_RETCODE ensureNumVertices ( SCIP_HYPERGRAPH hypergraph,
int  required 
)
static

enlarges vertex arrays to have capacity for at least required vertices

Parameters
hypergraphThe hypergraph.
requiredRequired vertex capacity.

Definition at line 45 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSreallocBlockMemoryArray, MAX, SCIP_Hypergraph::memvertices, SCIP_ALLOC, SCIP_OKAY, SCIPdebugMessage, SCIP_Hypergraph::sizevertexdata, and SCIP_Hypergraph::verticesdata.

Referenced by SCIPhypergraphAddVertex(), and SCIPhypergraphCreate().

◆ ensureNumEdges()

static SCIP_RETCODE ensureNumEdges ( SCIP_HYPERGRAPH hypergraph,
int  required 
)
static

enlarges edge arrays to have capacity for at least required edges

Parameters
hypergraphThe hypergraph.
requiredRequired edge capacity.

Definition at line 73 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSallocBlockMemoryArray, BMSreallocBlockMemoryArray, SCIP_Hypergraph::edgesdata, SCIP_Hypergraph::edgesverticesbeg, MAX, SCIP_Hypergraph::memedges, SCIP_ALLOC, SCIP_OKAY, SCIPdebugMessage, and SCIP_Hypergraph::sizeedgedata.

Referenced by SCIPhypergraphAddEdge(), and SCIPhypergraphCreate().

◆ ensureNumEdgesVertices()

static SCIP_RETCODE ensureNumEdgesVertices ( SCIP_HYPERGRAPH hypergraph,
int  required 
)
static

enlarges arrays for incident vertex/edge pairs to have capacity for at least required

Parameters
hypergraphThe hypergraph.
requiredRequired incident vertex/edge capacity.

Definition at line 113 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSreallocBlockMemoryArray, SCIP_Hypergraph::edgesvertices, MAX, SCIP_Hypergraph::memedgesvertices, SCIP_ALLOC, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIPhypergraphAddEdge(), and SCIPhypergraphCreate().

◆ ensureNumOverlaps()

static SCIP_RETCODE ensureNumOverlaps ( SCIP_HYPERGRAPH hypergraph,
int  required 
)
static

enlarges overlap arrays to have capacity for at least required overlaps

Parameters
hypergraphThe hypergraph.
requiredRequired overlap capacity.

Definition at line 139 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSallocBlockMemoryArray, BMSreallocBlockMemoryArray, MAX, SCIP_Hypergraph::memoverlaps, SCIP_Hypergraph::overlapsdata, SCIP_Hypergraph::overlapsverticesbeg, SCIP_ALLOC, SCIP_OKAY, SCIPdebugMessage, and SCIP_Hypergraph::sizeoverlapdata.

Referenced by findOverlap(), and SCIPhypergraphCreate().

◆ ensureNumOverlapsVertices()

static SCIP_RETCODE ensureNumOverlapsVertices ( SCIP_HYPERGRAPH hypergraph,
int  required 
)
static

enlarges overlapVertices array to have capacity for at least required overlaps' vertices

Parameters
hypergraphThe hypergraph.
requiredRequired overlapVertices capacity.

Definition at line 185 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSreallocBlockMemoryArray, MAX, SCIP_Hypergraph::memoverlapsvertices, SCIP_Hypergraph::overlapsvertices, SCIP_ALLOC, SCIP_OKAY, and SCIPdebugMessage.

Referenced by findOverlap().

◆ SCIPhypergraphCreate()

SCIP_RETCODE SCIPhypergraphCreate ( SCIP_HYPERGRAPH **  phypergraph,
BMS_BLKMEM blkmem,
int  memvertices,
int  memedges,
int  memoverlaps,
int  memedgesvertices,
size_t  sizevertexdata,
size_t  sizeedgedata,
size_t  sizeoverlapdata 
)

creates a hypergraph

Parameters
phypergraphPointer for storing the hypergraph.
blkmemBlock memory for storage.
memverticesUpper bound on expected number of vertices.
memedgesUpper bound on expected number of edges.
memoverlapsUpper bound on expected number of overlaps.
memedgesverticesUpper bound on expected average size of edges.
sizevertexdataSize (in bytes) of additional vertex data.
sizeedgedataSize (in bytes) of additional edge data.
sizeoverlapdataSize (in bytes) of additional overlap data.

Definition at line 210 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSallocBlockMemory, SCIP_Hypergraph::edgesdata, SCIP_Hypergraph::edgesoverlaps, SCIP_Hypergraph::edgesoverlapsbeg, SCIP_Hypergraph::edgesvertices, SCIP_Hypergraph::edgesverticesbeg, ensureNumEdges(), ensureNumEdgesVertices(), ensureNumOverlaps(), ensureNumVertices(), SCIP_Hypergraph::memedges, SCIP_Hypergraph::memedgesoverlaps, SCIP_Hypergraph::memedgesoverlapsbeg, SCIP_Hypergraph::memedgesvertices, SCIP_Hypergraph::memoverlaps, SCIP_Hypergraph::memoverlapsedges, SCIP_Hypergraph::memoverlapsedgesbeg, SCIP_Hypergraph::memoverlapsvertices, SCIP_Hypergraph::memvertices, SCIP_Hypergraph::memverticesedges, SCIP_Hypergraph::memverticesedgesbeg, SCIP_Hypergraph::memverticesoverlaps, SCIP_Hypergraph::memverticesoverlapsbeg, NULL, SCIP_Hypergraph::overlaphashtable, SCIP_Hypergraph::overlapsdata, SCIP_Hypergraph::overlapsedges, SCIP_Hypergraph::overlapsedgesbeg, SCIP_Hypergraph::overlapsvertices, SCIP_Hypergraph::overlapsverticesbeg, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPhypergraphClear(), SCIP_Hypergraph::sizeedgedata, SCIP_Hypergraph::sizeoverlapdata, SCIP_Hypergraph::sizevertexdata, SCIP_Hypergraph::verticesdata, SCIP_Hypergraph::verticesedges, SCIP_Hypergraph::verticesedgesbeg, SCIP_Hypergraph::verticesoverlaps, and SCIP_Hypergraph::verticesoverlapsbeg.

Referenced by constructHypergraph().

◆ SCIPhypergraphFree()

SCIP_RETCODE SCIPhypergraphFree ( SCIP_HYPERGRAPH **  phypergraph)

◆ SCIPhypergraphClear()

◆ SCIPhypergraphAddVertex()

SCIP_RETCODE SCIPhypergraphAddVertex ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_VERTEX pvertex,
SCIP_HYPERGRAPH_VERTEXDATA **  pvertexdata 
)

adds a new vertex to the hypergraph

Parameters
hypergraphThe hypergraph.
pvertexPointer for storing the new vertex.
pvertexdataPointer for returning the vertex's data (may be NULL).

Definition at line 386 of file hypergraph.c.

References ensureNumVertices(), FALSE, SCIP_Hypergraph::hasvertexedges, NULL, SCIP_Hypergraph::nvertices, SCIP_CALL, SCIP_OKAY, SCIP_Hypergraph::sizevertexdata, and SCIP_Hypergraph::verticesdata.

Referenced by constructHypergraph().

◆ SCIPhypergraphAddEdge()

SCIP_RETCODE SCIPhypergraphAddEdge ( SCIP_HYPERGRAPH hypergraph,
int  nvertices,
SCIP_HYPERGRAPH_VERTEX vertices,
SCIP_HYPERGRAPH_EDGE pedge,
SCIP_HYPERGRAPH_EDGEDATA **  pedgedata 
)

adds a new edge to the hypergraph

Does not update the vertices' or overlaps' lists of incident edges.

Parameters
hypergraphThe hypergraph.
nverticesNumber of vertices of this edge.
verticesArray with vertices.
pedgePointer for storing the new edge.
pedgedataPointer for returning the edge's data (may be NULL).

Definition at line 416 of file hypergraph.c.

References SCIP_Hypergraph::edgesdata, SCIP_Hypergraph::edgesvertices, SCIP_Hypergraph::edgesverticesbeg, ensureNumEdges(), ensureNumEdgesVertices(), FALSE, SCIP_Hypergraph::hasvertexedges, SCIP_Hypergraph::nedges, NULL, SCIP_CALL, SCIP_OKAY, SCIPsortInt(), and SCIP_Hypergraph::sizeedgedata.

Referenced by constructHypergraph().

◆ SCIP_DECL_HASHGETKEY()

static SCIP_DECL_HASHGETKEY ( overlapHashGetKey  )
static

get-key function for overlap hashtable

Definition at line 456 of file hypergraph.c.

◆ SCIP_DECL_HASHKEYEQ()

static SCIP_DECL_HASHKEYEQ ( overlapHashKeyEqPtr  )
static

equality function for overlap hashtable

Definition at line 463 of file hypergraph.c.

References FALSE, SCIP_Hypergraph::overlapsvertices, SCIP_Hypergraph::overlapsverticesbeg, and TRUE.

◆ SCIP_DECL_HASHKEYVAL()

static SCIP_DECL_HASHKEYVAL ( overlapHashKeyValPtr  )
static

hash function for overlap hashtable

Definition at line 498 of file hypergraph.c.

References SCIP_Hypergraph::overlapsvertices, SCIP_Hypergraph::overlapsverticesbeg, SCIPhashFour, SCIPhashThree, and SCIPhashTwo.

◆ findOverlap()

static SCIP_RETCODE findOverlap ( SCIP_HYPERGRAPH hypergraph,
int  nvertices,
int *  vertices,
int *  poverlap,
SCIP_Bool  add,
SCIP_Bool padded 
)
static

finds an overlap specified by a sorted vertex set, potentially adding it

Parameters
hypergraphHypergraph.
nverticesNumber of vertices.
verticesSorted array of vertices.
poverlapPointer for storing the overlap.
addWhether a missing overlap set should be added.
paddedWhether a missing overlap set was added.

Definition at line 530 of file hypergraph.c.

References ensureNumOverlaps(), ensureNumOverlapsVertices(), FALSE, SCIP_Hypergraph::noverlaps, NULL, SCIP_Hypergraph::overlaphashtable, SCIP_Hypergraph::overlapsvertices, SCIP_Hypergraph::overlapsverticesbeg, SCIP_CALL, SCIP_CALL_ABORT, SCIP_OKAY, SCIPhashtableInsert(), SCIPhashtableRetrieve(), and TRUE.

Referenced by SCIPhypergraphComputeOverlaps(), SCIPhypergraphIntersectEdges(), SCIPhypergraphIterNext(), and SCIPhypergraphOverlapFind().

◆ SCIPhypergraphComputeOverlaps()

◆ SCIPhypergraphComputeVerticesEdges()

◆ SCIPhypergraphOverlapFind()

SCIP_RETCODE SCIPhypergraphOverlapFind ( SCIP_HYPERGRAPH hypergraph,
int  nvertices,
SCIP_HYPERGRAPH_VERTEX vertices,
SCIP_HYPERGRAPH_OVERLAP poverlap 
)

finds the overlap corresponding to vertex set vertices; returns -1 if it is not found

Requires SCIPhypergraphHasOverlaps to be TRUE which results from SCIPhypergraphComputeOverlaps.

Parameters
hypergraphThe hypergraph.
nverticesNumber of vertices.
verticesSorted array of vertices.
poverlapPointer for storing the overlap.

Definition at line 906 of file hypergraph.c.

References FALSE, findOverlap(), SCIP_Hypergraph::hasoverlaps, NULL, SCIP_CALL, and SCIP_OKAY.

◆ SCIPhypergraphIntersectEdges()

SCIP_RETCODE SCIPhypergraphIntersectEdges ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_EDGE  first,
SCIP_HYPERGRAPH_EDGE  second,
SCIP_HYPERGRAPH_OVERLAP poverlap,
SCIP_HYPERGRAPH_VERTEX pvertex 
)

finds the overlap or singleton vertex corresponding to the intersection of edges first and second

Requires SCIPhypergraphHasOverlaps to be TRUE which results from SCIPhypergraphComputeOverlaps.

Parameters
hypergraphThe hypergraph.
firstFirst edge to intersect.
secondSecond edge to intersect.
poverlapPointer for storing the overlap.
pvertexPointer for storing the vertex.

Definition at line 929 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_Hypergraph::edgesvertices, SCIP_Hypergraph::edgesverticesbeg, FALSE, findOverlap(), SCIP_Hypergraph::hasoverlaps, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPhypergraphEdgeSize(), and w.

◆ SCIPhypergraphComputeOverlapsEdges()

◆ SCIPhypergraphComputeVerticesOverlaps()

◆ SCIPhypergraphOverlapsDisjoint()

SCIP_Bool SCIPhypergraphOverlapsDisjoint ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_OVERLAP  overlap1,
SCIP_HYPERGRAPH_OVERLAP  overlap2 
)

returns whether overlaps overlap1 and overlap2 are disjoint

Parameters
hypergraphThe hypergraph.
overlap1First overlap.
overlap2Second overlap.

Definition at line 1187 of file hypergraph.c.

References FALSE, SCIPhypergraphOverlapSize(), SCIPhypergraphOverlapVertices(), and TRUE.

Referenced by separateTwoFlower().

◆ SCIPhypergraphIsValid()

◆ SCIPhypergraphIterInit()

◆ SCIPhypergraphIterClear()

void SCIPhypergraphIterClear ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_ITER iterator 
)

frees a hypergraph iterator's internal memory

Parameters
hypergraphThe hypergraph of this iterator.
iteratorIterator to be cleared.

Definition at line 1494 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, BMSfreeBlockMemoryArray, SCIP_Hypergraph_Iter::commonvertices, and SCIP_Hypergraph_Iter::sizecommonvertices.

◆ SCIPhypergraphIterStart()

void SCIPhypergraphIterStart ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_ITER iterator,
SCIP_HYPERGRAPH_EDGE  base,
unsigned int  minoverlapsize,
SCIP_Bool  onlylater,
SCIP_Bool  findoverlaps 
)

initializes the iterator to the first adjacent edge of base

findoverlaps indicates whether the overlap corresponding to each edge intersection shall be determined. This requires SCIPhypergraphHasOverlaps.

Parameters
hypergraphThe hypergraph of this iterator.
iteratorIterator to be initialized.
baseBase edge.
minoverlapsizeMinimum size of the overlap.
onlylaterWhether to only consider edges greater than base.
findoverlapsWhether to compute the overlap sets.

Definition at line 1506 of file hypergraph.c.

References SCIP_Hypergraph_Iter::adjacent, SCIP_Hypergraph_Iter::base, SCIP_Hypergraph_Iter::edgeidx, SCIP_Hypergraph_Iter::findoverlaps, SCIP_Hypergraph::hasoverlaps, SCIP_Hypergraph::hasvertexedges, SCIP_Hypergraph_Iter::minoverlapsize, SCIP_Hypergraph_Iter::minvertex, SCIP_Hypergraph_Iter::ncommonvertices, SCIP_Hypergraph_Iter::onlylater, SCIP_Hypergraph_Iter::overlap, SCIPhypergraphIterNext(), and SCIP_Hypergraph_Iter::vertexidx.

◆ SCIPhypergraphIterValid()

SCIP_Bool SCIPhypergraphIterValid ( SCIP_HYPERGRAPH_ITER iterator)

returns whether the iterator is valid

Parameters
iteratorIterator.

Definition at line 1537 of file hypergraph.c.

References SCIP_Hypergraph_Iter::vertexidx.

◆ SCIPhypergraphIterNext()

◆ SCIPhypergraphIterBase()

SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterBase ( SCIP_HYPERGRAPH_ITER iterator)

returns the base edge

Parameters
iteratorIterator.

Definition at line 1685 of file hypergraph.c.

References SCIP_Hypergraph_Iter::base.

◆ SCIPhypergraphIterAdjacent()

SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterAdjacent ( SCIP_HYPERGRAPH_ITER iterator)

returns the current adjacent edge

Parameters
iteratorIterator.

Definition at line 1693 of file hypergraph.c.

References SCIP_Hypergraph_Iter::adjacent.

◆ SCIPhypergraphIterMinVertex()

SCIP_HYPERGRAPH_VERTEX SCIPhypergraphIterMinVertex ( SCIP_HYPERGRAPH_ITER iterator)

returns the minimum vertex in the intersection of the base and the current adjacent edge

Parameters
iteratorIterator.

Definition at line 1701 of file hypergraph.c.

References SCIP_Hypergraph_Iter::minvertex.

◆ SCIPhypergraphIterOverlap()

SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphIterOverlap ( SCIP_HYPERGRAPH_ITER iterator)

returns the overlap for the intersection of the base and the current adjacent edge

If the intersection of the two edges has only one element, then -1 is returned, and if overlap information was not requested in SCIPhypergraphIterStart, then -2 is returned.

Parameters
iteratorIterator.

Definition at line 1714 of file hypergraph.c.

References SCIP_Hypergraph_Iter::overlap.

◆ SCIPhypergraphGetNVertices()

int SCIPhypergraphGetNVertices ( SCIP_HYPERGRAPH hypergraph)

returns the number of vertices

Parameters
hypergraphThe hypergraph.

Definition at line 1764 of file hypergraph.c.

References SCIP_Hypergraph::nvertices.

Referenced by constructHypergraph(), prepareSeparation(), and SCIPhypergraphIsValid().

◆ SCIPhypergraphGetNEdges()

int SCIPhypergraphGetNEdges ( SCIP_HYPERGRAPH hypergraph)

returns the number of edges

Parameters
hypergraphThe hypergraph.

Definition at line 1774 of file hypergraph.c.

References SCIP_Hypergraph::nedges.

Referenced by constructHypergraph(), prepareSeparation(), SCIPhypergraphIsValid(), separateOneFlower(), separateStandard(), and separateTwoFlower().

◆ SCIPhypergraphBlkmem()

BMS_BLKMEM * SCIPhypergraphBlkmem ( SCIP_HYPERGRAPH hypergraph)

returns the hypergraph's block memory structure

Parameters
hypergraphThe hypergraph.

Definition at line 1784 of file hypergraph.c.

References SCIP_Hypergraph::blkmem, and NULL.

◆ SCIPhypergraphGetNOverlaps()

int SCIPhypergraphGetNOverlaps ( SCIP_HYPERGRAPH hypergraph)

returns the number of overlaps

Parameters
hypergraphThe hypergraph.

Definition at line 1794 of file hypergraph.c.

References SCIP_Hypergraph::noverlaps.

Referenced by constructHypergraph(), prepareSeparation(), and separate().

◆ SCIPhypergraphGetNIncidences()

int SCIPhypergraphGetNIncidences ( SCIP_HYPERGRAPH hypergraph)

returns the number of edge-vertex incidences

returns the number of vertex-edge incidences.

Parameters
hypergraphThe hypergraph.

Definition at line 1804 of file hypergraph.c.

References SCIP_Hypergraph::edgesverticesbeg, and SCIP_Hypergraph::nedges.

Referenced by SCIPhypergraphIsValid().

◆ SCIPhypergraphVertexData()

SCIP_HYPERGRAPH_VERTEXDATA * SCIPhypergraphVertexData ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_VERTEX  vertex 
)

returns additional data of vertex

Parameters
hypergraphThe hypergraph.
vertexA vertex.

Definition at line 1814 of file hypergraph.c.

References NULL, SCIP_Hypergraph::sizevertexdata, and SCIP_Hypergraph::verticesdata.

Referenced by prepareSeparation(), separateOneFlower(), separateStandard(), and separateTwoFlower().

◆ SCIPhypergraphEdgeData()

SCIP_HYPERGRAPH_EDGEDATA * SCIPhypergraphEdgeData ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_EDGE  edge 
)

returns additional data of edge

Parameters
hypergraphThe hypergraph.
edgeAn edge.

Definition at line 1826 of file hypergraph.c.

References SCIP_Hypergraph::edgesdata, NULL, and SCIP_Hypergraph::sizeedgedata.

Referenced by prepareSeparation(), separateOneFlower(), separateStandard(), and separateTwoFlower().

◆ SCIPhypergraphOverlapData()

SCIP_HYPERGRAPH_OVERLAPDATA * SCIPhypergraphOverlapData ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_OVERLAP  overlap 
)

returns additional data of overlap

Parameters
hypergraphThe hypergraph.
overlapAn overlap.

Definition at line 1838 of file hypergraph.c.

References NULL, SCIP_Hypergraph::overlapsdata, and SCIP_Hypergraph::sizeoverlapdata.

Referenced by prepareSeparation(), SCIPhypergraphComputeOverlaps(), separateOneFlower(), and separateTwoFlower().

◆ SCIPhypergraphEdgeSize()

int SCIPhypergraphEdgeSize ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_EDGE  edge 
)

returns the number of vertices of edge

Parameters
hypergraphThe hypergraph.
edgeAn edge.

Definition at line 1850 of file hypergraph.c.

References SCIP_Hypergraph::edgesverticesbeg.

Referenced by prepareSeparation(), SCIPhypergraphIntersectEdges(), SCIPhypergraphIsValid(), separateOneFlower(), separateStandard(), and separateTwoFlower().

◆ SCIPhypergraphEdgeVertices()

SCIP_HYPERGRAPH_VERTEX * SCIPhypergraphEdgeVertices ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_EDGE  edge 
)

returns the array of vertices of edge

The length of the array is SCIPhypergraphEdgeSize.

Parameters
hypergraphThe hypergraph.
edgeAn edge.

Definition at line 1867 of file hypergraph.c.

References SCIP_Hypergraph::edgesvertices, and SCIP_Hypergraph::edgesverticesbeg.

Referenced by prepareSeparation(), SCIPhypergraphIsValid(), separateOneFlower(), separateStandard(), and separateTwoFlower().

◆ SCIPhypergraphHasVertexEdges()

SCIP_Bool SCIPhypergraphHasVertexEdges ( SCIP_HYPERGRAPH hypergraph)

returns whether vertices' incident edges are known.

Use SCIPhypergraphComputeVerticesEdges to compute them.

Parameters
hypergraphThe hypergraph.

Definition at line 1883 of file hypergraph.c.

References SCIP_Hypergraph::hasvertexedges.

Referenced by SCIPhypergraphIsValid().

◆ SCIPhypergraphVertexEdgesFirst()

int SCIPhypergraphVertexEdgesFirst ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_VERTEX  vertex 
)

returns an index for the first edge incident to vertex

Parameters
hypergraphThe hypergraph.
vertexA vertex.

Definition at line 1893 of file hypergraph.c.

References SCIP_Hypergraph::hasvertexedges, and SCIP_Hypergraph::verticesedgesbeg.

Referenced by SCIPhypergraphIsValid().

◆ SCIPhypergraphVertexEdgesBeyond()

int SCIPhypergraphVertexEdgesBeyond ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_VERTEX  vertex 
)

returns an index beyond the last edge incident to vertex

Parameters
hypergraphThe hypergraph.
vertexA vertex.

Definition at line 1905 of file hypergraph.c.

References SCIP_Hypergraph::hasvertexedges, and SCIP_Hypergraph::verticesedgesbeg.

Referenced by SCIPhypergraphIsValid().

◆ SCIPhypergraphVertexEdgesGetAtIndex()

SCIP_HYPERGRAPH_EDGE SCIPhypergraphVertexEdgesGetAtIndex ( SCIP_HYPERGRAPH hypergraph,
int  idx 
)

returns the edge corresponding to index that is incident to a vertex

See SCIPhypergraphVertexEdgesFirst and SCIPhypergraphVertexEdgesBeyond to obtain such indices for a vertex.

Parameters
hypergraphThe hypergraph.
idxIndex.

Definition at line 1921 of file hypergraph.c.

References SCIP_Hypergraph::hasvertexedges, and SCIP_Hypergraph::verticesedges.

Referenced by SCIPhypergraphIsValid().

◆ SCIPhypergraphHasOverlaps()

SCIP_Bool SCIPhypergraphHasOverlaps ( SCIP_HYPERGRAPH hypergraph)

returns whether edges' overlaps and overlaps' vertices are known.

Use SCIPhypergraphComputeOverlaps to compute them.

Parameters
hypergraphThe hypergraph.

Definition at line 1937 of file hypergraph.c.

References SCIP_Hypergraph::hasoverlaps.

Referenced by SCIPhypergraphIsValid().

◆ SCIPhypergraphOverlapSize()

int SCIPhypergraphOverlapSize ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_OVERLAP  overlap 
)

returns the number of vertices of overlap

Requires SCIPhypergraphHasOverlaps to be TRUE which results from SCIPhypergraphComputeOverlaps.

Parameters
hypergraphThe hypergraph.
overlapOverlap.

Definition at line 1951 of file hypergraph.c.

References SCIP_Hypergraph::hasoverlaps, and SCIP_Hypergraph::overlapsverticesbeg.

Referenced by prepareSeparation(), SCIPhypergraphIsValid(), SCIPhypergraphOverlapsDisjoint(), separateOneFlower(), and separateTwoFlower().

◆ SCIPhypergraphOverlapVertices()

SCIP_HYPERGRAPH_VERTEX * SCIPhypergraphOverlapVertices ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_OVERLAP  overlap 
)

returns the array of sorted vertices of overlap

The length of the array is SCIPhypergraphOverlapSize. Requires SCIPhypergraphHasOverlaps to be TRUE which results from SCIPhypergraphComputeOverlaps.

Parameters
hypergraphThe hypergraph.
overlapOverlap.

Definition at line 1969 of file hypergraph.c.

References SCIP_Hypergraph::hasoverlaps, SCIP_Hypergraph::overlapsvertices, and SCIP_Hypergraph::overlapsverticesbeg.

Referenced by prepareSeparation(), SCIPhypergraphIsValid(), SCIPhypergraphOverlapsDisjoint(), separateOneFlower(), and separateTwoFlower().

◆ SCIPhypergraphEdgesOverlapsFirst()

int SCIPhypergraphEdgesOverlapsFirst ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_EDGE  edge 
)

returns an index for the first overlap incident to edge

Parameters
hypergraphThe hypergraph.
edgeEdge.

Definition at line 1982 of file hypergraph.c.

References SCIP_Hypergraph::edgesoverlapsbeg, and SCIP_Hypergraph::hasoverlaps.

Referenced by prepareSeparation(), SCIPhypergraphIsValid(), separateOneFlower(), and separateTwoFlower().

◆ SCIPhypergraphEdgesOverlapsBeyond()

int SCIPhypergraphEdgesOverlapsBeyond ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_EDGE  edge 
)

returns an index beyond the last overlap incident to edge

Parameters
hypergraphThe hypergraph.
edgeEdge.

Definition at line 1995 of file hypergraph.c.

References SCIP_Hypergraph::edgesoverlapsbeg, and SCIP_Hypergraph::hasoverlaps.

Referenced by prepareSeparation(), SCIPhypergraphIsValid(), separateOneFlower(), and separateTwoFlower().

◆ SCIPhypergraphEdgesOverlapsGetAtIndex()

SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphEdgesOverlapsGetAtIndex ( SCIP_HYPERGRAPH hypergraph,
int  idx 
)

returns the overlap corresponding to idx that is incident to an edge

returns the overlap corresponding to index that is incident to an edge

See SCIPhypergraphEdgesOverlapsFirst and SCIPhypergraphEdgesOverlapsBeyond to obtain such indices for an edge.

Parameters
hypergraphThe hypergraph.
idxIndex.

Definition at line 2013 of file hypergraph.c.

References SCIP_Hypergraph::edgesoverlaps, and SCIP_Hypergraph::hasoverlaps.

Referenced by prepareSeparation(), SCIPhypergraphIsValid(), separateOneFlower(), and separateTwoFlower().

◆ SCIPhypergraphHasOverlapsEdges()

SCIP_Bool SCIPhypergraphHasOverlapsEdges ( SCIP_HYPERGRAPH hypergraph)

returns whether overlaps' incident edges are known.

Use SCIPhypergraphComputeOverlapsEdges to compute them.

Parameters
hypergraphThe hypergraph.

Definition at line 2029 of file hypergraph.c.

References SCIP_Hypergraph::hasoverlapsedges.

◆ SCIPhypergraphOverlapsEdgesFirst()

int SCIPhypergraphOverlapsEdgesFirst ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_OVERLAP  overlap 
)

returns an index for the first edge incident to overlap

Parameters
hypergraphThe hypergraph.
overlapOverlap.

Definition at line 2039 of file hypergraph.c.

References SCIP_Hypergraph::hasoverlapsedges, and SCIP_Hypergraph::overlapsedgesbeg.

◆ SCIPhypergraphOverlapsEdgesBeyond()

int SCIPhypergraphOverlapsEdgesBeyond ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_OVERLAP  overlap 
)

returns an index beyond the last edge incident to overlap

Parameters
hypergraphThe hypergraph.
overlapOverlap.

Definition at line 2051 of file hypergraph.c.

References SCIP_Hypergraph::hasoverlapsedges, and SCIP_Hypergraph::overlapsedgesbeg.

◆ SCIPhypergraphOverlapsEdgesGetAtIndex()

SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphOverlapsEdgesGetAtIndex ( SCIP_HYPERGRAPH hypergraph,
int  idx 
)

returns the edge corresponding to idx that is incident to an overlap

returns the edge corresponding to index that is incident to an overlap

See SCIPhypergraphOverlapsEdgesFirst and SCIPhypergraphOverlapsEdgesBeyond to obtain such indices for an overlap.

Parameters
hypergraphThe hypergraph.
idxIndex.

Definition at line 2068 of file hypergraph.c.

References SCIP_Hypergraph::hasoverlapsedges, and SCIP_Hypergraph::overlapsedges.

◆ SCIPhypergraphHasVertexOverlaps()

SCIP_Bool SCIPhypergraphHasVertexOverlaps ( SCIP_HYPERGRAPH hypergraph)

returns whether vertices' incident overlaps are known

Use SCIPhypergraphComputeOverlaps to compute them.

Parameters
hypergraphThe hypergraph.

Definition at line 2085 of file hypergraph.c.

References SCIP_Hypergraph::hasverticesoverlaps.

◆ SCIPhypergraphVertexOverlapsFirst()

int SCIPhypergraphVertexOverlapsFirst ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_VERTEX  vertex 
)

returns an index for the first overlap containing vertex

Parameters
hypergraphThe hypergraph.
vertexA vertex.

Definition at line 2095 of file hypergraph.c.

References SCIP_Hypergraph::hasverticesoverlaps, and SCIP_Hypergraph::verticesoverlapsbeg.

◆ SCIPhypergraphVertexOverlapsBeyond()

int SCIPhypergraphVertexOverlapsBeyond ( SCIP_HYPERGRAPH hypergraph,
SCIP_HYPERGRAPH_VERTEX  vertex 
)

returns an index beyond the last overlap incident to vertex

Parameters
hypergraphThe hypergraph.
vertexA vertex.

Definition at line 2107 of file hypergraph.c.

References SCIP_Hypergraph::hasverticesoverlaps, and SCIP_Hypergraph::verticesoverlapsbeg.

◆ SCIPhypergraphVertexOverlapsGetAtIndex()

SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphVertexOverlapsGetAtIndex ( SCIP_HYPERGRAPH hypergraph,
int  idx 
)

returns the overlap corresponding to idx that is incident to a vertex

returns the overlap corresponding to index that is incident to a vertex

See SCIPhypergraphVertexOverlapsFirst and SCIPhypergraphVertexOverlapsBeyond to obtain such indices for a vertex.

Parameters
hypergraphThe hypergraph.
idxIndex.

Definition at line 2124 of file hypergraph.c.

References SCIP_Hypergraph::hasverticesoverlaps, and SCIP_Hypergraph::verticesoverlaps.