1
function [c,phi,flag]=min_lcost_flow2(g)
4
if rhs<>1 then error(39), end
8
ma=prod(size(g('tail')))
10
mincap=g('edge_min_cap')
11
maxcap=g('edge_max_cap')
20
error('Minimum capacities must be equal to zero')
24
error('Maximum capacities must be non negative')
26
if or(maxcap<>round(maxcap)) then
27
error('Maximum capacities must be integer')
34
if or(costs<>round(costs)) then
35
error('Costs must be integer')
38
demand=g('node_demand')
42
if or(demand<>round(demand)) then
43
error('Demands must be integer')
45
if sum(demand)<>0 then
46
error('Sum of demands must be equal to zero')
48
// compute linear min cost flow by relaxation method (Bertsekas)
49
[c,phi,flag]=m6relax(g('head'),g('tail'),costs,maxcap,demand,arc_number(g),n)