cudd  3.0.0
The University of Colorado Decision Diagram Package
Data Structures | Macros | Typedefs | Functions | Variables
ntrMflow.c File Reference

Symbolic maxflow algorithm. More...

#include "ntr.h"
Include dependency graph for ntrMflow.c:

Data Structures

struct  flowStatsStruct
 Structure to hold statistics. More...
 

Macros

#define MAXPHASE   1000
 
#define MAXLAYER   1000
 
#define MAXFPIT   100000
 
#define MANY_TIMES   3.0
 
#define PRUNE   /* If defined, enables pruning of E */
 

Typedefs

typedef struct flowStatsStruct flowStats
 Structure to hold statistics.
 

Functions

double Ntr_maximum01Flow (DdManager *bdd, DdNode *sx, DdNode *ty, DdNode *E, DdNode **F, DdNode **cut, DdNode **x, DdNode **y, DdNode **z, int n, int pr)
 Symbolic Dinit's algorithm. More...
 
static void maximal_pull (DdManager *bdd, int l, DdNode *ty, DdNode **neW, DdNode **U, DdNode *E, DdNode **F, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Selects set of edge-disjoint paths from layered network. More...
 
static void propagate_maximal_flow (DdManager *bdd, int m, DdNode **neW, DdNode **U, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Pulls flow though a layer. More...
 
static void trellis (DdManager *bdd, int m, DdNode **neW, DdNode **U, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Selects edges from a trellis-type bilayer. More...
 
static void rhombus (DdManager *bdd, int m, DdNode **neW, DdNode **U, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Selects edges from a rhombus-type bilayer. More...
 
static void hourglass (DdManager *bdd, int m, DdNode **neW, DdNode **U, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Selects edges from a hourglass-type bilayer. More...
 
static void maximal_push (DdManager *bdd, int l, DdNode **U, DdNode **F, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Pushes flow through useful edges. More...
 
static void trellisPush (DdManager *bdd, int m, DdNode **U, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Pushes flow through a trellis. More...
 
static void rhombusPush (DdManager *bdd, int m, DdNode **U, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Pushes flow through a rhombus. More...
 
static void hourglassPush (DdManager *bdd, int m, DdNode **U, DdNode **x, DdNode **y, DdNode **z, int n, DdNode *pryz, DdNode *prxz, flowStats *stats)
 Pushes flow through an hourglass. More...
 

Variables

static DdNodexcube
 
static DdNodeycube
 
static DdNodezcube
 

Detailed Description

Symbolic maxflow algorithm.

This file contains the functions that implement the symbolic version of Dinits's maxflow algorithm described in the ICCAD93 paper. The present implementation differs from the algorithm described in the paper in that more than one matching techniques is used. The technique of the paper is the one applied to hourglass-type bilayers here.

Author
Fabio Somenzi, Gary Hachtel

Function Documentation

◆ hourglass()

static void hourglass ( DdManager bdd,
int  m,
DdNode **  neW,
DdNode **  U,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Selects edges from a hourglass-type bilayer.

Used to pull flow. Method described in paper. More general, but more expensive than the others.

Side effects None
See also
trellis rhombus hourglassPush
Parameters
bddDD manager
mcenter level of current bilayer
neWarray for flow propagation
Uarray for flow propagation
xarray of variables for rows and columns
yarray of variables for rows and columns
zarray of variables for rows and columns
nnumber of x variables
pryzpriority function
prxzpriority function
statsstatistics

◆ hourglassPush()

static void hourglassPush ( DdManager bdd,
int  m,
DdNode **  U,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Pushes flow through an hourglass.

Side effects None
Parameters
bddDD manager
mCurrent layer
UArray of edge sets for flow propagation
xArray of variables for rows and columns
yArray of variables for rows and columns
zArray of variables for rows and columns
nNumber of x variables
pryzPriority function
prxzPriority function
statsstatistics

◆ maximal_pull()

static void maximal_pull ( DdManager bdd,
int  l,
DdNode ty,
DdNode **  neW,
DdNode **  U,
DdNode E,
DdNode **  F,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Selects set of edge-disjoint paths from layered network.

maximal_pull is called when the BFS constructing the layered graph reaches a sink. At this point the new sets of the BFS have been formed, and we know every vertex in these sets is reachable from the source vertex (or vertices) s. The new sets are used to compute the set of useful edges exiting each layer to the right. In each layer, propagate_maximal_flow is called to select a maximal subset of these useful edges. This subset is then used to prune new and U.

Side effects None
See also
maximal_push
Parameters
bddmanager
ldepth of layered network for current phase
tysink node
neWarray of BFS layers
Uarray of useful edges
Eedge relation
Fflow relation
xarray of variables for rows and columns
yarray of variables for rows and columns
zarray of variables for rows and columns
nnumber of x variables
pryzpriority function
prxzpriority function
statsstatistics

◆ maximal_push()

static void maximal_push ( DdManager bdd,
int  l,
DdNode **  U,
DdNode **  F,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Pushes flow through useful edges.

Pushes flow from the source(s) to the sink(s) through useful edges.

Side effects None
Parameters
bddDD manager
lDepth of layered network for current phase
Uarray of edge sets for flow propagation
Fedge and flow relations
xarray of variables for rows and columns
yarray of variables for rows and columns
zarray of variables for rows and columns
nnumber of x variables
pryzpriority function
prxzpriority function
statsstatistics

◆ Ntr_maximum01Flow()

double Ntr_maximum01Flow ( DdManager bdd,
DdNode sx,
DdNode ty,
DdNode E,
DdNode **  F,
DdNode **  cut,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
int  pr 
)

Symbolic Dinit's algorithm.

This function implements Dinits's algorithm for (0-1) max flow, using BDDs and a symbolic technique to trace multiple edge-disjoint augmenting paths to complete a phase. The outer forever loop is over phases, and the inner forever loop is to propagate a (not yet) maximal flow of edge-disjoint augmenting paths from one layer to the previous. The subprocedure call implements a least fixed point iteration to compute a (not yet) maximal flow update between layers. At the end of each phase (except the last one) the flow is actually pushed from the source to the sink.

Data items:

  • sx(ty) BDD representations of s(t).
  • x(y) The variables encoding the from(to)-node u(v) of an edge (u,v) in the given digraph.
  • z Another set of variables.
  • E(x,y) The edge relation.
  • F(x,y) BDD representation of the current flow, initialized to 0 for each arc, and updated by +1, -1, or 0 at the end of each phase.
  • Ms Mt The maximum flow, that is, the cardinality of a minimum cut, measured at the source and at the sink, respectively. The two values should be identical.
  • reached The set of nodes already visited in the BFS of the digraph.
  • fos fanout of the source node s.
  • fit fanin of the sink node t.

Side effects The flow realtion F and the cutset relation cut are returned
as side effects.
Parameters
bddmanager
sxsource node
tysink node
Eedge relation
Fflow relation
cutcutset relation
xarray of row variables
yarray of column variables
zarrays of auxiliary variables
nnumber of variables in each array
prverbosity level

◆ propagate_maximal_flow()

static void propagate_maximal_flow ( DdManager bdd,
int  m,
DdNode **  neW,
DdNode **  U,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Pulls flow though a layer.

propagate_maximal_flow only affects U[m-1 and new[m-1]. At the end of this function, the edges in U[m] are guaranteed to drain all the flow supplied by the edges in U[m-1]. This effect is obtained by pruning U[m-1]. After the pruned U[m-1] is computed, new[m-1] is updated to keep track of what nodes are still useful.

The pruning is performed without actually measuring the in-potential and the out-potential of each node. Instead, pairs of nodes from U[m-1] and U[m] are matched. To avoid counting, the procedure computes sets of paths that connect layer m-1 to layer m+1 and are edge-disjoint.

Two paths from layer m-1 to layer m+1 are disjoint if they have distinct end-point or if they have distinct middle points. What condition to enforce depends on the "shape" of the layers.]

Side effects Changes U[m-1 and new[m-1]]
See also
trellis rhombus hourglass
Parameters
bddDD manager
mcenter of current bilayer
neWarray of reachable or useful nodes
Uarray of usable or useful edges
xarray of variables for rows and columns
yarray of variables for rows and columns
zarray of variables for rows and columns
nnumber of x variables
pryzpriority function
prxzpriority function
statsstatistics

◆ rhombus()

static void rhombus ( DdManager bdd,
int  m,
DdNode **  neW,
DdNode **  U,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Selects edges from a rhombus-type bilayer.

Used to pull flow. Makes the left layer left-unique and the right layer right-unique. Prunes and repeats until convergence to a maximal flow. It makes sure that all intermediate points of the two-arc paths are disjoint at each iteration.

Side effects None
See also
trellis hourglass rhombusPush
Parameters
bddDD manager
mcenter of current bilayer
neWarray for flow propagation
Uarray for flow propagation
xarray of variables for rows and columns
yarray of variables for rows and columns
zarray of variables for rows and columns
nnumber of x variables
pryzpriority function
prxzpriority function
statsstatistics

◆ rhombusPush()

static void rhombusPush ( DdManager bdd,
int  m,
DdNode **  U,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Pushes flow through a rhombus.

Side effects None
Parameters
bddDD manager
mCurrent layer
UArray of edge sets for flow propagation
xArray of variables for rows and columns
yArray of variables for rows and columns
zArray of variables for rows and columns
nNumber of x variables
pryzPriority function
prxzPriority function
statsstatistics

◆ trellis()

static void trellis ( DdManager bdd,
int  m,
DdNode **  neW,
DdNode **  U,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Selects edges from a trellis-type bilayer.

Used to pull flow. First a matching is found in the left layer. Then the paths are extended (if possible) through the right layer. This process is repeated until a maximal flow is found.

Side effects None
See also
rhombus hourglass trellisPush
Parameters
bddDD manager
mcenter level of current bilayer
neWarray of node levels
Uarray of edge layers
xarray of variables for rows and columns
yarray of variables for rows and columns
zarray of variables for rows and columns
nnumber of x variables
pryzpriority function
prxzpriority function
statsstatistics

◆ trellisPush()

static void trellisPush ( DdManager bdd,
int  m,
DdNode **  U,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  n,
DdNode pryz,
DdNode prxz,
flowStats stats 
)
static

Pushes flow through a trellis.

Side effects None
Parameters
bddDD manager
mCurrent layer
UArray of edge sets for flow propagation
xArray of variables for rows and columns
yArray of variables for rows and columns
zArray of variables for rows and columns
nNumber of x variables
pryzPriority function
prxzPriority function
statsstatistics