| |
- addArbitrarySuppliesAndBounds(N, maxB, maxU)
- Set the supply of all nodes to arbitrary values in (-maxB, maxB), and the
upper bounds of all arcs to arbitrary values in (0, maxU). All values ints.
- addArbitrarySuppliesAndBoundsFloat(N, maxB, maxU, decimal)
- Set the supply of all nodes to arbitrary values in (-maxB, maxB), and the
upper bounds of all arcs to arbitrary values in (0, maxU). All values floats.
- addMaxFlowPercentage(N, p, decimal=0)
- Set the supply and demand of node "s" and "t", resp.,
to (1+p)*max-flow value.
- balanceSupply(N, maxB, decimal=0)
- Balance supply in N, by multiplying all except one supplies with a factor,
the remainder is added to the fixed one.
- balanceSupplyByAddition(N, maxB=inf)
- Substract or add maximal possible supply with respect to maxB from random
nodes until network is balanced.
- ceil(...)
- ceil(x)
Return the ceiling of x as a float.
This is the smallest integral value >= x.
- computeInfeasibleBFactor(N, ssN)
- Return a factor c, such that c*supply-vector will render N infeasible.
- floor(...)
- floor(x)
Return the floor of x as a float.
This is the largest integral value <= x.
- halveBounds(N, deciPlaces)
- Set u = u/2 as long as N is feasible. Then double supply.
- main_graph(args)
- Handle networks resulting from graph-format: undirected graph, no bounds,
no supplies.
- main_max(args)
- Handle networks resulting from max-format: upper bounds, no supplies,
asserts node names "s" and "t".
case p: Set supply of s and t, resp., to (1+p)*max-flow value.
case maxBounds: Set maxBounds upper bounds to 0
- main_min(args)
- Handle networks resulting from min-format: directed graph, supplies,
upper and possibly lower bounds.
- scaleSupplies(N, alpha, decimal)
- Multiply all supplies with alpha and round to decimal places.
- scaledInfeasibleNetwork(N, decimal)
- If N is feasible, scale supplies with a factor, so that N is infeasible
afterwards (requires $b
e 0$).
- setNrBoundsRandom(N, nrBounds)
- Set upper bounds to 0 on a random arc, nrBounds times, and multiply supply
with 2. If network is still infeasible afterwards, repeat.
If it takes too long, aboard and return False.
- setNrBoundsToZero(N, nrBounds)
- Set nr upper bounds to 0.
Take randomly chosen $S\subset V$ and set random bound on outgoing arc to 0,
until GH-ineq. is violated. Take next S, until nr is reached.
Return True if at least one of the chosen S violates GH-ineq.
Note: Network can be infeasible even if False is returned.
General version, where more than one node has a positive supply;
might have lower bounds.
- setNrBoundsToZeroSTCase(N, nrBounds)
- Set nr upper bounds to 0.
Take randomly chosen $S\subset V$ and set random bound on outgoing arc to 0,
until GH-ineq. is violated. Take next S, until nr is reached.
Return True if at least one of the chosen S violates GH-ineq.
Note: Network can be infeasible even if False is returned.
Version for st-networks, where only node 's' has a positive supply.
- supplyFromUpperBoundsSingleSource(N)
- Return the sum of upper bounds on arcs from "s".
- undirectedToRandomlyDirectedGraph(undirN)
- Return a randomly directed copy of dirN.
|