1
min_lcost_flow1 Scilab Group Scilab function min_lcost_flow1
3
min_lcost_flow1 - minimum linear cost flow
6
[c,phi,flag] = min_lcost_flow1(g)
13
: row vector of the value of flow on the arcs
16
: feasible problem flag (0 or 1)
19
min_lcost_flow1 computes the minimum linear cost flow in the network g.
20
It returns the total cost of the flows on the arcs c and the row vector
21
of the flows on the arcs phi. If the problem is not feasible (impossible
22
to find a compatible flow for instance), flag is equal to 0, otherwise
23
it is equal to 1. The bounds of the flow are given by the elements
24
edge_min_cap and edge_max_cap of the graph list. The value of the
25
minimum capacity and of the maximum capacity must be non negative and
26
must be integer numbers. The value of the maximum capacity must be
27
greater than or equal to the value of the minimum capacity. If the value
28
of edge_min_cap or edge_max_cap is not given (empty row vector []), it is
29
assumed to be equal to 0 on each edge. The costs on the edges are given
30
by the element edge_cost of the graph list. The costs must be non
31
negative. If the value of edge_cost is not given (empty row vector []),
32
it is assumed to be equal to 0 on each edge. The demands, element
33
node_demand of the graph list, must be equal to zero. This function uses
34
the out-of-kilter algorithm.
37
ta=[1 1 2 2 2 3 4 4 5 6 6 6 7 7 7 8 9 10 12 12 13 13 13 14 15 14 9 11 10 1 8];
38
he=[2 6 3 4 5 1 3 5 1 7 10 11 5 8 9 5 8 11 10 11 9 11 15 13 14 4 6 9 1 12 14];
39
g=make_graph('foo',1,15,ta,he);
40
g('node_x')=[194 191 106 194 296 305 305 418 422 432 552 550 549 416 548];
41
g('node_y')=[56 221 316 318 316 143 214 321 217 126 215 80 330 437 439];
43
g1=g;ma=arc_number(g1);
46
g1('edge_min_cap')=round(20*rand(1,ma));
47
g1('edge_max_cap')=round(20*rand(1,ma))+g1('edge_min_cap')+33*ones(1,ma);
48
g1('edge_cost')=round(10*rand(1,ma))+ones(1,ma);
49
[c,phi,flag]=min_lcost_flow1(g1);
50
if flag==1 then break; end;
52
x_message(['The cost is: '+string(c);
53
'Showing the flow on the arcs ']);
54
ii=find(phi<>0); edgecolor=phi; edgecolor(ii)=11*ones(ii);
55
g1('edge_color')=edgecolor;
56
edgefontsize=8*ones(1,ma); edgefontsize(ii)=18*ones(ii);
57
g1('edge_font_size')=edgefontsize;
58
g1('edge_label')=string(phi);
61
min_lcost_cflow, min_lcost_flow2, min_qcost_flow