Modifier and Type | Field and Description |
---|---|
List<Arc> |
allArcs |
Arc |
blocking |
static boolean |
DEBUG |
static boolean |
DEBUG_ALL |
static int |
DELETED_ARC |
Set<org.jacop.constraints.netflow.simplex.Node> |
infeasibleNodes |
static int |
LARGE_COST |
Arc[] |
lower |
org.jacop.constraints.netflow.simplex.Node[] |
nodes |
int |
numArcs |
protected PivotRule |
pivotRule |
org.jacop.constraints.netflow.simplex.Node |
root |
static int |
TREE_ARC |
Constructor and Description |
---|
NetworkSimplex(List<org.jacop.constraints.netflow.simplex.Node> nodes,
List<Arc> arcs) |
Modifier and Type | Method and Description |
---|---|
protected void |
addArc(Arc arc) |
void |
addArcWithFlow(Arc arc) |
int |
augmentFlow(org.jacop.constraints.netflow.simplex.Node from,
org.jacop.constraints.netflow.simplex.Node to,
int delta)
Augments the flow between two nodes by the maximum amount along the
unique tree path that connects these nodes.
|
long |
cost(long cutoff) |
boolean |
dualPivot(Arc leaving) |
int |
networkSimplex(int maxPivots) |
int |
parametricStep(org.jacop.constraints.netflow.simplex.Node source,
org.jacop.constraints.netflow.simplex.Node sink,
int balance,
int maxPivots)
Given an optimal flow that satisfies all feasibility constraints except
mass balance on two nodes, the parametric simplex algorithm tries to
achieve feasibility while keeping the solution optimal.
|
void |
primalStep(Arc entering)
Performs a primal pivot.
|
void |
print()
Debug
|
void |
removeArc(Arc arc) |
void |
treeSwap(org.jacop.constraints.netflow.simplex.Node a,
org.jacop.constraints.netflow.simplex.Node b,
org.jacop.constraints.netflow.simplex.Node c)
TODO prove (or disprove) correctness
|
void |
updateTree(Arc leaving,
Arc entering)
TODO prove (or disprove) correctness (and efficiency)
|
public static final boolean DEBUG
public static final boolean DEBUG_ALL
public static final int LARGE_COST
public static final int TREE_ARC
public static final int DELETED_ARC
public final org.jacop.constraints.netflow.simplex.Node root
public final org.jacop.constraints.netflow.simplex.Node[] nodes
public final Arc[] lower
public int numArcs
public Arc blocking
protected final PivotRule pivotRule
public final Set<org.jacop.constraints.netflow.simplex.Node> infeasibleNodes
protected void addArc(Arc arc)
arc
- the network arc being addedpublic void addArcWithFlow(Arc arc)
public void removeArc(Arc arc)
public int networkSimplex(int maxPivots)
maxPivots
- max value of the pivotpublic void primalStep(Arc entering)
entering
- a non-tree arc that violates optimalitypublic int augmentFlow(org.jacop.constraints.netflow.simplex.Node from, org.jacop.constraints.netflow.simplex.Node to, int delta)
from
- the source of the flowto
- the sink of the flowdelta
- an upper limit on the flow to sendpublic void updateTree(Arc leaving, Arc entering)
Both arcs must form a cycle in the tree and point in the same direction on that cycle.
leaving
- the tree arc that leaves the treeentering
- the non-tree arc that enters the treepublic void treeSwap(org.jacop.constraints.netflow.simplex.Node a, org.jacop.constraints.netflow.simplex.Node b, org.jacop.constraints.netflow.simplex.Node c)
TODO can be 'inlined' in updateTree (but that would decrease readability)
Changes the parent of a node and updates the thread data structure (This operation invalidates the depth values in the subtree)
Runs in O(T2) amortized time over all treeSwaps performed by an updateTree operation where T2 is the size of the subtree that is being reversed.
a
- the old parent of ab
- the child nodec
- the new parent of apublic int parametricStep(org.jacop.constraints.netflow.simplex.Node source, org.jacop.constraints.netflow.simplex.Node sink, int balance, int maxPivots)
TODO do more tests TODO test whether non-feasibility can actually be detected due to the fact that we have 'artificial' arcs going to the root.
source
- source nodesink
- sink nodebalance
- difference between in flow and out flow
the flow to send from the source to the sinkmaxPivots
- limits the number of dual pivotspublic boolean dualPivot(Arc leaving)
public long cost(long cutoff)
public void print()
Copyright © 2022. All rights reserved.