relax4 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = relax4_ruby
1
+ = relax4
2
2
 
3
3
  http://relax4.rubyforge.org
4
4
 
@@ -70,11 +70,11 @@ A lower-level interface is also available; see the docs for the Relax4 module.
70
70
  Has been tested on:
71
71
  * x86-linux (Ubuntu 10.04) with Ruby 1.8.7p249
72
72
  * x86-linux (Ubuntu 10.04) with Ruby 1.9.1p378
73
- * x86_64-linux (CentOS) with Ruby 1.8.7-p72
73
+ * x86_64-linux (CentOS) with Ruby 1.8.7p72
74
74
 
75
75
  The following packages were required to install on Ubuntu 10.04:
76
76
 
77
- * ruby, ruby-dev, rubygems, rake
77
+ * ruby, ruby-dev, rubygems
78
78
 
79
79
  The bindings were generated with f2c (FORTRAN to C converter) and SWIG
80
80
  (www.swig.org), but you don't need either to build the gem.
data/ext/relax4.c CHANGED
@@ -2,7 +2,14 @@
2
2
  * This file was translated by f2c (FORTRAN to C) (version 20090411) from
3
3
  * relax4.f (see http://www.netlib.org/f2c).
4
4
  *
5
- * It has been modified (JLM) for use as a library (see relax4.h).
5
+ * It has been modified (JLM) for use as a library (see relax4.h for interface).
6
+ * The main changes are:
7
+ *
8
+ * 1) Now using dynamic (malloc'd) rather than static arrays.
9
+ * 2) An apparent bug in ascnt2_ has been fixed: the prdcsr array is a
10
+ * node-length array, but it was indexed by the 'nb' variable, which can become
11
+ * larger than the number of nodes. A new arc-length array (temp_nb) has been
12
+ * added to avoid this.
6
13
  *
7
14
  * The f2c linkage dependencies have been removed, but the FORTRAN character of
8
15
  * the code has been largely preserved -- you have been warned.
@@ -315,6 +322,10 @@ struct {
315
322
 
316
323
  #define cr_1 cr_
317
324
 
325
+ /* Temporary added by JLM to avoid out-of-bounds problem caused by using the
326
+ * prdcsr array in ascnt2_. */
327
+ RELAX4_INT *temp_nb;
328
+
318
329
  /* Subroutine */ int inidat_(void)
319
330
  {
320
331
  /* System generated locals */
@@ -3659,7 +3670,7 @@ L4:
3659
3670
  if (arrayrc_1.rc[arc - 1] == 0) {
3660
3671
  *delx += arrayu_1.u[arc - 1];
3661
3672
  ++nb;
3662
- blk2_3.prdcsr[nb - 1] = arc;
3673
+ temp_nb[nb - 1] = arc; /* was blk2_3.prdcsr */
3663
3674
  }
3664
3675
  }
3665
3676
  /* L6: */
@@ -3694,7 +3705,7 @@ L4:
3694
3705
 
3695
3706
  i__1 = nb;
3696
3707
  for (i__ = 1; i__ <= i__1; ++i__) {
3697
- arc = blk2_3.prdcsr[i__ - 1];
3708
+ arc = temp_nb[i__ - 1]; /* was blk2_3.prdcsr */
3698
3709
  if (blk13_1.tnxtin[arc - 1] == -1) {
3699
3710
  j = arraye_1.endn[arc - 1];
3700
3711
  blk13_1.tnxtin[arc - 1] = blk12_1.tfstin[j - 1];
@@ -3797,6 +3808,7 @@ int relax4_init(RELAX4_INT num_nodes, RELAX4_INT num_arcs,
3797
3808
  blk15_1.i15 = NULL;
3798
3809
  blk16_1.i16 = NULL;
3799
3810
  blk17_1.i17 = NULL;
3811
+ temp_nb = NULL;
3800
3812
 
3801
3813
  arrayrc_1.rc = malloc(num_arcs*sizeof(RELAX4_INT));
3802
3814
  blk1_1.i1 = malloc(num_nodes*sizeof(RELAX4_INT));
@@ -3816,6 +3828,7 @@ int relax4_init(RELAX4_INT num_nodes, RELAX4_INT num_arcs,
3816
3828
  blk15_1.i15 = malloc(num_nodes*sizeof(RELAX4_INT));
3817
3829
  blk16_1.i16 = malloc(num_nodes*sizeof(RELAX4_INT));
3818
3830
  blk17_1.i17 = malloc(num_nodes*sizeof(RELAX4_INT));
3831
+ temp_nb = malloc(num_arcs*sizeof(RELAX4_INT));
3819
3832
 
3820
3833
  if (arrayrc_1.rc == NULL ||
3821
3834
  blk1_1.i1 == NULL ||
@@ -3834,7 +3847,8 @@ int relax4_init(RELAX4_INT num_nodes, RELAX4_INT num_arcs,
3834
3847
  blk14_1.i14 == NULL ||
3835
3848
  blk15_1.i15 == NULL ||
3836
3849
  blk16_1.i16 == NULL ||
3837
- blk17_1.i17 == NULL) {
3850
+ blk17_1.i17 == NULL ||
3851
+ temp_nb == NULL) {
3838
3852
  relax4_free();
3839
3853
  return RELAX4_FAIL_OUT_OF_MEMORY;
3840
3854
  }
@@ -3948,5 +3962,6 @@ void relax4_free()
3948
3962
  if(blk15_1.i15 ) free(blk15_1.i15 );
3949
3963
  if(blk16_1.i16 ) free(blk16_1.i16 );
3950
3964
  if(blk17_1.i17 ) free(blk17_1.i17 );
3965
+ if(temp_nb ) free(temp_nb );
3951
3966
  }
3952
3967
 
@@ -1,3 +1,3 @@
1
1
  module Relax4
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
data/test/RELAX4.INP ADDED
@@ -0,0 +1,101 @@
1
+ 20 80
2
+ 1 10 -4 215
3
+ 1 16 -8 138
4
+ 8 18 2 215
5
+ 8 14 -5 76
6
+ 8 20 -6 193
7
+ 10 8 -9 215
8
+ 10 16 -4 215
9
+ 10 6 9 190
10
+ 10 20 -8 141
11
+ 10 4 -5 152
12
+ 10 11 2 63
13
+ 2 15 5 266
14
+ 2 4 -5 186
15
+ 2 6 -3 162
16
+ 2 17 7 84
17
+ 2 11 6 94
18
+ 2 18 -6 113
19
+ 12 18 -6 266
20
+ 12 7 9 106
21
+ 12 9 4 143
22
+ 12 17 7 95
23
+ 12 15 7 181
24
+ 12 4 9 104
25
+ 12 20 -9 84
26
+ 15 12 8 266
27
+ 15 16 -4 266
28
+ 15 17 5 154
29
+ 15 20 3 132
30
+ 15 4 2 164
31
+ 3 6 2 50
32
+ 3 18 -7 131
33
+ 3 19 -8 89
34
+ 6 7 -2 50
35
+ 6 19 -6 102
36
+ 6 9 6 56
37
+ 7 9 -7 50
38
+ 7 6 3 129
39
+ 7 5 -7 141
40
+ 9 19 -1 50
41
+ 9 17 -2 50
42
+ 9 18 4 50
43
+ 9 13 -7 162
44
+ 9 16 -2 121
45
+ 9 11 10 115
46
+ 9 10 -3 166
47
+ 9 4 1 111
48
+ 4 13 -10 195
49
+ 4 19 8 112
50
+ 4 16 2 195
51
+ 4 10 -9 143
52
+ 4 9 -10 135
53
+ 4 14 -4 191
54
+ 13 18 -9 195
55
+ 13 19 -10 195
56
+ 13 8 -8 165
57
+ 13 17 0 132
58
+ 5 11 -8 319
59
+ 5 7 -8 70
60
+ 5 20 0 63
61
+ 5 9 -9 194
62
+ 11 14 -3 319
63
+ 11 19 2 125
64
+ 11 12 -9 177
65
+ 14 20 -7 319
66
+ 14 16 7 319
67
+ 14 8 9 174
68
+ 14 11 10 77
69
+ 14 5 -4 123
70
+ 14 18 5 125
71
+ 14 12 -10 69
72
+ 16 19 -3 128
73
+ 16 10 -4 56
74
+ 16 6 0 145
75
+ 16 17 10 104
76
+ 16 12 2 199
77
+ 16 5 -5 159
78
+ 17 7 2 68
79
+ 17 12 -3 57
80
+ 17 18 -3 113
81
+ 17 11 -2 130
82
+ 215
83
+ 266
84
+ 5
85
+ 195
86
+ 319
87
+ 0
88
+ 0
89
+ 0
90
+ 0
91
+ 0
92
+ 0
93
+ 0
94
+ 0
95
+ 0
96
+ 0
97
+ -386
98
+ -1
99
+ -399
100
+ -54
101
+ -160
@@ -0,0 +1,284 @@
1
+ require "test/unit"
2
+ require "relax4"
3
+
4
+ class TestRelax4< Test::Unit::TestCase
5
+ def test_solve_1
6
+ # From Figure 7.14 of Bertsimas and Tsitsiklis (1997). Introduction to
7
+ # Linear Optimization.
8
+ prob = {
9
+ :demands => [-1, 0, 0, 0, 1],
10
+ :start_nodes => [ 1, 1, 2, 3, 4, 4],
11
+ :end_nodes => [ 2, 3, 4, 5, 3, 5],
12
+ :costs => [ 0, 1, 0, 0, 0, 1]}
13
+ soln = [ 1, 0, 1, 1, 1, 0]
14
+ assert_equal soln, Relax4.solve(prob)
15
+ assert_equal soln, Relax4.solve(prob.merge(:auction_init => true))
16
+ end
17
+
18
+ def test_solve_2
19
+ # From Figure 29.3 of Cormen, Leiserson, Rivest and Stein (2001).
20
+ # Introduction to Algorithms, 2nd Edition.
21
+ prob = {
22
+ :demands => [-4, 0, 0, 4],
23
+ :start_nodes => [ 1, 1, 2, 2, 3],
24
+ :end_nodes => [ 2, 3, 3, 4, 4],
25
+ :costs => [ 2, 5, 3, 7, 1],
26
+ :capacities => [ 5, 2, 1, 2, 4]}
27
+ soln = [ 2, 2, 1, 1, 3]
28
+ flows = Relax4.solve(prob)
29
+ assert_equal soln, flows
30
+ assert_equal 27, problem_cost(prob, flows)
31
+
32
+ assert_equal soln, Relax4.solve(prob.merge(:auction_init => true))
33
+ end
34
+
35
+ # Load problem from relax4_input format.
36
+ # Note that the input format has node surpluses rather than demands.
37
+ # No error checking.
38
+ def problem_from_relax4_inp file_name
39
+ require 'scanf'
40
+ File.open(file_name) {|f|
41
+ num_nodes, num_arcs = f.scanf('%d %d')
42
+ arcs = num_arcs.times.collect {f.scanf('%d %d %d %d')}
43
+ demands = num_nodes.times.collect {-f.scanf('%d').first}
44
+ {
45
+ :demands => demands,
46
+ :start_nodes => arcs.map{|x| x[0].to_i},
47
+ :end_nodes => arcs.map{|x| x[1].to_i},
48
+ :costs => arcs.map{|x| x[2].to_i},
49
+ :capacities => arcs.map{|x| x[3].to_i}
50
+ }
51
+ }
52
+ end
53
+
54
+ # Compute cost of flows.
55
+ def problem_cost prob, flows
56
+ flows.zip(prob[:costs]).map{|f,c|f*c}.inject(:+)
57
+ end
58
+
59
+ def test_solve_3
60
+ prob = problem_from_relax4_inp 'test/RELAX4.INP'
61
+
62
+ flows = Relax4.solve(prob)
63
+ assert_equal(-26464, problem_cost(prob, flows))
64
+
65
+ flows = Relax4.solve(prob.merge(:auction_init => true))
66
+ assert_equal(-26464, problem_cost(prob, flows))
67
+ end
68
+
69
+ def test_solve_4
70
+ # This problem appears to fail due to overflow. Its arc capacities are set
71
+ # to 500 million (equal to the default LARGE constant), and this causes the
72
+ # solver to incorrectly report that the problem is infeasible. Reducing the
73
+ # capacities by a factor of 10 makes it work OK.
74
+ #
75
+ # Note that giving this file to the original application works, because it
76
+ # only reads the first 8 digits of any input number (format I8) -- i.e. it
77
+ # sets the capacities to 50M not 500M.
78
+ prob = problem_from_relax4_inp 'test/test_solve_4.inp'
79
+ prob[:capacities].map! {|x| [x, Relax4::RELAX4_UNCAPACITATED].min}
80
+ flows = Relax4.solve(prob)
81
+ assert_equal 1381, problem_cost(prob, flows)
82
+ end
83
+
84
+ def test_solve_5
85
+ # This problem caused either a memory error or an infinite loop due to an
86
+ # apparent bug in the ascnt2_ routine (out of bounds on the prdcsr array,
87
+ # which was not long enough to record the number of newly balanced arcs).
88
+ # This bug affected versions 1.0.3 and earlier.
89
+ prob = problem_from_relax4_inp 'test/test_solve_5.inp'
90
+ prob[:capacities].map! {|x| [x, Relax4::RELAX4_UNCAPACITATED].min}
91
+ flows = Relax4.solve(prob)
92
+ assert_equal 28759, problem_cost(prob, flows)
93
+ end
94
+
95
+ def test_solve_lemon_1
96
+ # Some tests stolen from LEMON version 1.2 (test/min_cost_flow_test.cc).
97
+ # Note that we can't handle minimum flows, so we can only run tests with the
98
+ # 'low1' series.
99
+ nodes_text = <<NODES.lines.drop(1).join("\n")
100
+ label sup1 sup2 sup3 sup4 sup5 sup6
101
+ 1 20 27 0 30 20 30
102
+ 2 -4 0 0 0 -8 -3
103
+ 3 0 0 0 0 0 0
104
+ 4 0 0 0 0 0 0
105
+ 5 9 0 0 0 6 11
106
+ 6 -6 0 0 0 -5 -6
107
+ 7 0 0 0 0 0 0
108
+ 8 0 0 0 0 0 3
109
+ 9 3 0 0 0 0 0
110
+ 10 -2 0 0 0 -7 -2
111
+ 11 0 0 0 0 -10 0
112
+ 12 -20 -27 0 -30 -30 -20
113
+ NODES
114
+ node_rx = /^\s*\d#{'+\s+(-?\d+)'*6}\s*$/
115
+ demands = (0...6).map{|i| nodes_text.scan(node_rx).map{|x| -x[i].to_i}}
116
+
117
+ arcs_text = <<ARCS.lines.drop(1).join("\n")
118
+ cost cap
119
+ 1 2 70 11
120
+ 1 3 150 3
121
+ 1 4 80 15
122
+ 2 8 80 12
123
+ 3 5 140 5
124
+ 4 6 60 10
125
+ 4 7 80 2
126
+ 4 8 110 3
127
+ 5 7 60 14
128
+ 5 11 120 12
129
+ 6 3 0 3
130
+ 6 9 140 4
131
+ 6 10 90 8
132
+ 7 1 30 5
133
+ 8 12 60 16
134
+ 9 12 50 6
135
+ 10 12 70 13
136
+ 10 2 100 7
137
+ 10 7 60 10
138
+ 11 10 20 14
139
+ 12 11 30 10
140
+ ARCS
141
+
142
+ arc_rx = /^\s*(\d+)\s+(\d+)\s+(-?\d+)\s+(\d+)\s*$/
143
+ prob = {
144
+ :start_nodes => arcs_text.scan(arc_rx).map{|x| x[0].to_i},
145
+ :end_nodes => arcs_text.scan(arc_rx).map{|x| x[1].to_i},
146
+ :costs => arcs_text.scan(arc_rx).map{|x| x[2].to_i},
147
+ :capacities => arcs_text.scan(arc_rx).map{|x| x[3].to_i}}
148
+
149
+ # l1, s1
150
+ flows = Relax4.solve(prob.merge(:demands => demands[0]))
151
+ assert_equal 5240, problem_cost(prob, flows)
152
+
153
+ # l1, s2
154
+ flows = Relax4.solve(prob.merge(:demands => demands[1]))
155
+ assert_equal 7620, problem_cost(prob, flows)
156
+
157
+ # l1, s5 is infeasible because s5 doesn't have balanced supply and demand
158
+ assert_raise Relax4::InfeasibleError do
159
+ Relax4.solve(prob.merge(:demands => demands[4]))
160
+ end
161
+
162
+ # unit costs and no capacities (corresponding to "cc" and "cu")
163
+ prob_unit = {
164
+ :start_nodes => arcs_text.scan(arc_rx).map{|x| x[0].to_i},
165
+ :end_nodes => arcs_text.scan(arc_rx).map{|x| x[1].to_i},
166
+ :costs => [1]*21}
167
+
168
+ # l1, s1
169
+ flows = Relax4.solve(prob_unit.merge(:demands => demands[0]))
170
+ assert_equal 74, problem_cost(prob_unit, flows)
171
+
172
+ # l1, s3
173
+ flows = Relax4.solve(prob_unit.merge(:demands => demands[2]))
174
+ assert_equal 0, problem_cost(prob_unit, flows)
175
+ end
176
+
177
+ def test_solve_lemon_2
178
+ # From test_neg1_lgf in test/min_cost_flow_test.cc. This contains a negative
179
+ # cost cycle (5, 6, 7). The result is that edges in the cycle are at
180
+ # capacity; if capacities are not specified, they go to the
181
+ # RELAX4_UNCAPACITATED constant.
182
+ prob = {
183
+ :demands => [-100, 0, 0, 100, 0, 0, 0],
184
+ :start_nodes => [ 1, 1, 2, 3, 3, 5, 5, 6, 7],
185
+ :end_nodes => [ 2, 3, 4, 4, 2, 3, 6, 7, 5],
186
+ :costs => [100,30,20,80,50,10,80,30,-120],
187
+ }
188
+
189
+ flows = Relax4.solve(prob)
190
+ big = Relax4::RELAX4_UNCAPACITATED
191
+ assert_equal [0,100,100,0,100,0,big,big,big], flows
192
+
193
+ flows = Relax4.solve(prob.merge(:auction_init => true))
194
+ assert_equal [0,100,100,0,100,0,big,big,big], flows
195
+
196
+ # If we put capacity bounds on, we get less flow around the -ve cost cycle.
197
+ flows = Relax4.solve(prob.merge(:capacities=>[5000]*9))
198
+ assert_equal(-40000, problem_cost(prob, flows))
199
+
200
+ # If we put capacity bounds on, we get less flow around the -ve cost cycle.
201
+ flows = Relax4.solve(prob.merge(:capacities=>[5000]*9, :auction_init=>true))
202
+ assert_equal(-40000, problem_cost(prob, flows))
203
+ end
204
+
205
+ def test_bad_args_1
206
+ # Empty problem is invalid.
207
+ assert_raise ArgumentError do
208
+ Relax4.solve(:start_nodes => [],
209
+ :end_nodes => [],
210
+ :costs => [],
211
+ :demands => [])
212
+ end
213
+
214
+ # Mismatch in array lengths.
215
+ assert_raise ArgumentError do
216
+ Relax4.solve(:start_nodes => [1,2],
217
+ :end_nodes => [2,1],
218
+ :costs => [1,1,1], # too many
219
+ :demands => [-1,1])
220
+ end
221
+
222
+ # Node out of range.
223
+ assert_raise ArgumentError do
224
+ Relax4.solve(:start_nodes => [1,3], # bad node: 3
225
+ :end_nodes => [2,1],
226
+ :costs => [1,1],
227
+ :demands => [-1,1])
228
+ end
229
+ assert_raise ArgumentError do
230
+ Relax4.solve(:start_nodes => [1,2],
231
+ :end_nodes => [2,3], # bad node: 3
232
+ :costs => [1,1],
233
+ :demands => [-1,1])
234
+ end
235
+
236
+ # Cost out of range.
237
+ assert_raise ArgumentError do
238
+ Relax4.solve(:start_nodes => [1,2],
239
+ :end_nodes => [2,1],
240
+ :costs => [99,101], # bad cost: 100
241
+ :demands => [-1,1],
242
+ :large => 1000,
243
+ :max_cost => 100)
244
+ end
245
+
246
+ # Capacity out of range.
247
+ assert_raise ArgumentError do
248
+ Relax4.solve(:start_nodes => [1,2],
249
+ :end_nodes => [2,1],
250
+ :costs => [99,100],
251
+ :capacities => [1000,1001], # bad capacity: 1001
252
+ :demands => [-1,1],
253
+ :large => 1000,
254
+ :max_cost => 100)
255
+ end
256
+ end
257
+
258
+ def test_infeasible
259
+ #
260
+ # A problem for which the phase 1 init doesn't detect infeasibility.
261
+ #
262
+ # (1) (6) all edges have capacity 1
263
+ # \ / 1 unit surplus for 1, 2
264
+ # \ / 1 unit deficit for 6, 7
265
+ # (3)-->--(4) link (3, 4) is the bottleneck
266
+ # / \
267
+ # / \
268
+ # (2) (7)
269
+ #
270
+ prob = {
271
+ :demands => [-1, -1, 0, 0, 1, 1],
272
+ :start_nodes => [ 1, 2, 3, 4, 4],
273
+ :end_nodes => [ 3, 3, 4, 5, 6],
274
+ :costs => [ 1, 1, 1, 1, 1],
275
+ :capacities => [ 1, 1, 1, 1, 1]}
276
+
277
+ assert_raise Relax4::InfeasibleError do
278
+ Relax4.solve(prob)
279
+ end
280
+ assert_raise Relax4::InfeasibleError do
281
+ Relax4.solve(prob.merge(:auction_init => true))
282
+ end
283
+ end
284
+ end
@@ -0,0 +1,258 @@
1
+ 17 240
2
+ 1 2 244 500000000
3
+ 1 3 738 500000000
4
+ 1 4 643 500000000
5
+ 1 5 578 500000000
6
+ 1 6 514 500000000
7
+ 1 7 433 500000000
8
+ 1 8 365 500000000
9
+ 1 9 294 500000000
10
+ 1 10 140 500000000
11
+ 1 11 79 500000000
12
+ 1 12 169 500000000
13
+ 1 13 287 500000000
14
+ 1 14 359 500000000
15
+ 1 15 207 500000000
16
+ 2 1 32 500000000
17
+ 2 3 769 500000000
18
+ 2 4 674 500000000
19
+ 2 5 609 500000000
20
+ 2 6 545 500000000
21
+ 2 7 464 500000000
22
+ 2 8 396 500000000
23
+ 2 9 325 500000000
24
+ 2 10 171 500000000
25
+ 2 11 110 500000000
26
+ 2 12 200 500000000
27
+ 2 13 318 500000000
28
+ 2 14 390 500000000
29
+ 2 15 238 500000000
30
+ 3 1 103 500000000
31
+ 3 2 72 500000000
32
+ 3 4 745 500000000
33
+ 3 5 680 500000000
34
+ 3 6 616 500000000
35
+ 3 7 535 500000000
36
+ 3 8 467 500000000
37
+ 3 9 396 500000000
38
+ 3 10 242 500000000
39
+ 3 11 181 500000000
40
+ 3 12 271 500000000
41
+ 3 13 389 500000000
42
+ 3 14 461 500000000
43
+ 3 15 309 500000000
44
+ 4 1 198 500000000
45
+ 4 2 167 500000000
46
+ 4 3 96 500000000
47
+ 4 5 775 500000000
48
+ 4 6 711 500000000
49
+ 4 7 630 500000000
50
+ 4 8 562 500000000
51
+ 4 9 491 500000000
52
+ 4 10 337 500000000
53
+ 4 11 276 500000000
54
+ 4 12 366 500000000
55
+ 4 13 484 500000000
56
+ 4 14 556 500000000
57
+ 4 15 404 500000000
58
+ 5 1 263 500000000
59
+ 5 2 232 500000000
60
+ 5 3 161 500000000
61
+ 5 4 66 500000000
62
+ 5 6 776 500000000
63
+ 5 7 695 500000000
64
+ 5 8 627 500000000
65
+ 5 9 556 500000000
66
+ 5 10 402 500000000
67
+ 5 11 341 500000000
68
+ 5 12 431 500000000
69
+ 5 13 549 500000000
70
+ 5 14 621 500000000
71
+ 5 15 469 500000000
72
+ 6 1 327 500000000
73
+ 6 2 296 500000000
74
+ 6 3 225 500000000
75
+ 6 4 130 500000000
76
+ 6 5 65 500000000
77
+ 6 7 759 500000000
78
+ 6 8 691 500000000
79
+ 6 9 620 500000000
80
+ 6 10 466 500000000
81
+ 6 11 405 500000000
82
+ 6 12 495 500000000
83
+ 6 13 613 500000000
84
+ 6 14 685 500000000
85
+ 6 15 533 500000000
86
+ 7 1 408 500000000
87
+ 7 2 377 500000000
88
+ 7 3 306 500000000
89
+ 7 4 211 500000000
90
+ 7 5 146 500000000
91
+ 7 6 82 500000000
92
+ 7 8 772 500000000
93
+ 7 9 701 500000000
94
+ 7 10 547 500000000
95
+ 7 11 486 500000000
96
+ 7 12 576 500000000
97
+ 7 13 694 500000000
98
+ 7 14 766 500000000
99
+ 7 15 614 500000000
100
+ 8 1 476 500000000
101
+ 8 2 445 500000000
102
+ 8 3 374 500000000
103
+ 8 4 279 500000000
104
+ 8 5 214 500000000
105
+ 8 6 150 500000000
106
+ 8 7 69 500000000
107
+ 8 9 769 500000000
108
+ 8 10 615 500000000
109
+ 8 11 554 500000000
110
+ 8 12 644 500000000
111
+ 8 13 762 500000000
112
+ 8 14 834 500000000
113
+ 8 15 682 500000000
114
+ 9 1 547 500000000
115
+ 9 2 516 500000000
116
+ 9 3 445 500000000
117
+ 9 4 350 500000000
118
+ 9 5 285 500000000
119
+ 9 6 221 500000000
120
+ 9 7 140 500000000
121
+ 9 8 72 500000000
122
+ 9 10 686 500000000
123
+ 9 11 625 500000000
124
+ 9 12 715 500000000
125
+ 9 13 833 500000000
126
+ 9 14 905 500000000
127
+ 9 15 753 500000000
128
+ 10 1 136 500000000
129
+ 10 2 105 500000000
130
+ 10 3 599 500000000
131
+ 10 4 504 500000000
132
+ 10 5 439 500000000
133
+ 10 6 375 500000000
134
+ 10 7 294 500000000
135
+ 10 8 226 500000000
136
+ 10 9 155 500000000
137
+ 10 11 214 500000000
138
+ 10 12 304 500000000
139
+ 10 13 422 500000000
140
+ 10 14 494 500000000
141
+ 10 15 342 500000000
142
+ 11 1 231 500000000
143
+ 11 2 200 500000000
144
+ 11 3 968 500000000
145
+ 11 4 873 500000000
146
+ 11 5 808 500000000
147
+ 11 6 744 500000000
148
+ 11 7 663 500000000
149
+ 11 8 595 500000000
150
+ 11 9 524 500000000
151
+ 11 10 370 500000000
152
+ 11 12 91 500000000
153
+ 11 13 209 500000000
154
+ 11 14 281 500000000
155
+ 11 15 129 500000000
156
+ 12 1 388 500000000
157
+ 12 2 357 500000000
158
+ 12 3 1125 500000000
159
+ 12 4 1030 500000000
160
+ 12 5 965 500000000
161
+ 12 6 901 500000000
162
+ 12 7 820 500000000
163
+ 12 8 752 500000000
164
+ 12 9 681 500000000
165
+ 12 10 527 500000000
166
+ 12 11 466 500000000
167
+ 12 13 119 500000000
168
+ 12 14 191 500000000
169
+ 12 15 286 500000000
170
+ 13 1 270 500000000
171
+ 13 2 239 500000000
172
+ 13 3 1007 500000000
173
+ 13 4 912 500000000
174
+ 13 5 847 500000000
175
+ 13 6 783 500000000
176
+ 13 7 702 500000000
177
+ 13 8 634 500000000
178
+ 13 9 563 500000000
179
+ 13 10 409 500000000
180
+ 13 11 348 500000000
181
+ 13 12 438 500000000
182
+ 13 14 73 500000000
183
+ 13 15 168 500000000
184
+ 14 1 198 500000000
185
+ 14 2 167 500000000
186
+ 14 3 935 500000000
187
+ 14 4 840 500000000
188
+ 14 5 775 500000000
189
+ 14 6 711 500000000
190
+ 14 7 630 500000000
191
+ 14 8 562 500000000
192
+ 14 9 491 500000000
193
+ 14 10 337 500000000
194
+ 14 11 276 500000000
195
+ 14 12 366 500000000
196
+ 14 13 484 500000000
197
+ 14 15 96 500000000
198
+ 15 1 103 500000000
199
+ 15 2 72 500000000
200
+ 15 3 840 500000000
201
+ 15 4 745 500000000
202
+ 15 5 680 500000000
203
+ 15 6 616 500000000
204
+ 15 7 535 500000000
205
+ 15 8 467 500000000
206
+ 15 9 396 500000000
207
+ 15 10 242 500000000
208
+ 15 11 181 500000000
209
+ 15 12 271 500000000
210
+ 15 13 389 500000000
211
+ 15 14 461 500000000
212
+ 16 1 0 500000000
213
+ 16 2 0 500000000
214
+ 16 3 0 500000000
215
+ 16 4 0 500000000
216
+ 16 5 0 500000000
217
+ 16 6 0 500000000
218
+ 16 7 0 500000000
219
+ 16 8 0 500000000
220
+ 16 9 0 500000000
221
+ 16 10 0 500000000
222
+ 16 11 0 500000000
223
+ 16 12 0 500000000
224
+ 16 13 0 500000000
225
+ 16 14 0 500000000
226
+ 16 15 0 500000000
227
+ 1 17 0 500000000
228
+ 2 17 0 500000000
229
+ 3 17 0 500000000
230
+ 4 17 0 500000000
231
+ 5 17 0 500000000
232
+ 6 17 0 500000000
233
+ 7 17 0 500000000
234
+ 8 17 0 500000000
235
+ 9 17 0 500000000
236
+ 10 17 0 500000000
237
+ 11 17 0 500000000
238
+ 12 17 0 500000000
239
+ 13 17 0 500000000
240
+ 14 17 0 500000000
241
+ 15 17 0 500000000
242
+ 4
243
+ 78
244
+ -1
245
+ -1
246
+ 0
247
+ 0
248
+ 0
249
+ 0
250
+ 0
251
+ 0
252
+ 3
253
+ 3
254
+ 22
255
+ 11
256
+ 20
257
+ 0
258
+ -139
@@ -0,0 +1,259 @@
1
+ 17 240
2
+ 1 2 244 50000000
3
+ 1 3 738 50000000
4
+ 1 4 643 50000000
5
+ 1 5 578 50000000
6
+ 1 6 514 50000000
7
+ 1 7 433 50000000
8
+ 1 8 365 50000000
9
+ 1 9 294 50000000
10
+ 1 10 140 50000000
11
+ 1 11 79 50000000
12
+ 1 12 169 50000000
13
+ 1 13 287 50000000
14
+ 1 14 359 50000000
15
+ 1 15 207 50000000
16
+ 2 1 32 50000000
17
+ 2 3 769 50000000
18
+ 2 4 674 50000000
19
+ 2 5 609 50000000
20
+ 2 6 545 50000000
21
+ 2 7 464 50000000
22
+ 2 8 396 50000000
23
+ 2 9 325 50000000
24
+ 2 10 171 50000000
25
+ 2 11 110 50000000
26
+ 2 12 200 50000000
27
+ 2 13 318 50000000
28
+ 2 14 390 50000000
29
+ 2 15 238 50000000
30
+ 3 1 103 50000000
31
+ 3 2 72 50000000
32
+ 3 4 745 50000000
33
+ 3 5 680 50000000
34
+ 3 6 616 50000000
35
+ 3 7 535 50000000
36
+ 3 8 467 50000000
37
+ 3 9 396 50000000
38
+ 3 10 242 50000000
39
+ 3 11 181 50000000
40
+ 3 12 271 50000000
41
+ 3 13 389 50000000
42
+ 3 14 461 50000000
43
+ 3 15 309 50000000
44
+ 4 1 198 50000000
45
+ 4 2 167 50000000
46
+ 4 3 96 50000000
47
+ 4 5 775 50000000
48
+ 4 6 711 50000000
49
+ 4 7 630 50000000
50
+ 4 8 562 50000000
51
+ 4 9 491 50000000
52
+ 4 10 337 50000000
53
+ 4 11 276 50000000
54
+ 4 12 366 50000000
55
+ 4 13 484 50000000
56
+ 4 14 556 50000000
57
+ 4 15 404 50000000
58
+ 5 1 263 50000000
59
+ 5 2 232 50000000
60
+ 5 3 161 50000000
61
+ 5 4 66 50000000
62
+ 5 6 776 50000000
63
+ 5 7 695 50000000
64
+ 5 8 627 50000000
65
+ 5 9 556 50000000
66
+ 5 10 402 50000000
67
+ 5 11 341 50000000
68
+ 5 12 431 50000000
69
+ 5 13 549 50000000
70
+ 5 14 621 50000000
71
+ 5 15 469 50000000
72
+ 6 1 327 50000000
73
+ 6 2 296 50000000
74
+ 6 3 225 50000000
75
+ 6 4 130 50000000
76
+ 6 5 65 50000000
77
+ 6 7 759 50000000
78
+ 6 8 691 50000000
79
+ 6 9 620 50000000
80
+ 6 10 466 50000000
81
+ 6 11 405 50000000
82
+ 6 12 495 50000000
83
+ 6 13 613 50000000
84
+ 6 14 685 50000000
85
+ 6 15 533 50000000
86
+ 7 1 408 50000000
87
+ 7 2 377 50000000
88
+ 7 3 306 50000000
89
+ 7 4 211 50000000
90
+ 7 5 146 50000000
91
+ 7 6 82 50000000
92
+ 7 8 772 50000000
93
+ 7 9 701 50000000
94
+ 7 10 547 50000000
95
+ 7 11 486 50000000
96
+ 7 12 576 50000000
97
+ 7 13 694 50000000
98
+ 7 14 766 50000000
99
+ 7 15 614 50000000
100
+ 8 1 476 50000000
101
+ 8 2 445 50000000
102
+ 8 3 374 50000000
103
+ 8 4 279 50000000
104
+ 8 5 214 50000000
105
+ 8 6 150 50000000
106
+ 8 7 69 50000000
107
+ 8 9 769 50000000
108
+ 8 10 615 50000000
109
+ 8 11 554 50000000
110
+ 8 12 644 50000000
111
+ 8 13 762 50000000
112
+ 8 14 834 50000000
113
+ 8 15 682 50000000
114
+ 9 1 547 50000000
115
+ 9 2 516 50000000
116
+ 9 3 445 50000000
117
+ 9 4 350 50000000
118
+ 9 5 285 50000000
119
+ 9 6 221 50000000
120
+ 9 7 140 50000000
121
+ 9 8 72 50000000
122
+ 9 10 686 50000000
123
+ 9 11 625 50000000
124
+ 9 12 715 50000000
125
+ 9 13 833 50000000
126
+ 9 14 905 50000000
127
+ 9 15 753 50000000
128
+ 10 1 136 50000000
129
+ 10 2 105 50000000
130
+ 10 3 599 50000000
131
+ 10 4 504 50000000
132
+ 10 5 439 50000000
133
+ 10 6 375 50000000
134
+ 10 7 294 50000000
135
+ 10 8 226 50000000
136
+ 10 9 155 50000000
137
+ 10 11 214 50000000
138
+ 10 12 304 50000000
139
+ 10 13 422 50000000
140
+ 10 14 494 50000000
141
+ 10 15 342 50000000
142
+ 11 1 231 50000000
143
+ 11 2 200 50000000
144
+ 11 3 968 50000000
145
+ 11 4 873 50000000
146
+ 11 5 808 50000000
147
+ 11 6 744 50000000
148
+ 11 7 663 50000000
149
+ 11 8 595 50000000
150
+ 11 9 524 50000000
151
+ 11 10 370 50000000
152
+ 11 12 91 50000000
153
+ 11 13 209 50000000
154
+ 11 14 281 50000000
155
+ 11 15 129 50000000
156
+ 12 1 388 50000000
157
+ 12 2 357 50000000
158
+ 12 3 1125 50000000
159
+ 12 4 1030 50000000
160
+ 12 5 965 50000000
161
+ 12 6 901 50000000
162
+ 12 7 820 50000000
163
+ 12 8 752 50000000
164
+ 12 9 681 50000000
165
+ 12 10 527 50000000
166
+ 12 11 466 50000000
167
+ 12 13 119 50000000
168
+ 12 14 191 50000000
169
+ 12 15 286 50000000
170
+ 13 1 270 50000000
171
+ 13 2 239 50000000
172
+ 13 3 1007 50000000
173
+ 13 4 912 50000000
174
+ 13 5 847 50000000
175
+ 13 6 783 50000000
176
+ 13 7 702 50000000
177
+ 13 8 634 50000000
178
+ 13 9 563 50000000
179
+ 13 10 409 50000000
180
+ 13 11 348 50000000
181
+ 13 12 438 50000000
182
+ 13 14 73 50000000
183
+ 13 15 168 50000000
184
+ 14 1 198 50000000
185
+ 14 2 167 50000000
186
+ 14 3 935 50000000
187
+ 14 4 840 50000000
188
+ 14 5 775 50000000
189
+ 14 6 711 50000000
190
+ 14 7 630 50000000
191
+ 14 8 562 50000000
192
+ 14 9 491 50000000
193
+ 14 10 337 50000000
194
+ 14 11 276 50000000
195
+ 14 12 366 50000000
196
+ 14 13 484 50000000
197
+ 14 15 96 50000000
198
+ 15 1 103 50000000
199
+ 15 2 72 50000000
200
+ 15 3 840 50000000
201
+ 15 4 745 50000000
202
+ 15 5 680 50000000
203
+ 15 6 616 50000000
204
+ 15 7 535 50000000
205
+ 15 8 467 50000000
206
+ 15 9 396 50000000
207
+ 15 10 242 50000000
208
+ 15 11 181 50000000
209
+ 15 12 271 50000000
210
+ 15 13 389 50000000
211
+ 15 14 461 50000000
212
+ 16 1 0 50000000
213
+ 16 2 0 50000000
214
+ 16 3 0 50000000
215
+ 16 4 0 50000000
216
+ 16 5 0 50000000
217
+ 16 6 0 50000000
218
+ 16 7 0 50000000
219
+ 16 8 0 50000000
220
+ 16 9 0 50000000
221
+ 16 10 0 50000000
222
+ 16 11 0 50000000
223
+ 16 12 0 50000000
224
+ 16 13 0 50000000
225
+ 16 14 0 50000000
226
+ 16 15 0 50000000
227
+ 1 17 0 50000000
228
+ 2 17 0 50000000
229
+ 3 17 0 50000000
230
+ 4 17 0 50000000
231
+ 5 17 0 50000000
232
+ 6 17 0 50000000
233
+ 7 17 0 50000000
234
+ 8 17 0 50000000
235
+ 9 17 0 50000000
236
+ 10 17 0 50000000
237
+ 11 17 0 50000000
238
+ 12 17 0 50000000
239
+ 13 17 0 50000000
240
+ 14 17 0 50000000
241
+ 15 17 0 50000000
242
+ 2
243
+ -2
244
+ -6
245
+ -12
246
+ -13
247
+ -5
248
+ -5
249
+ 1
250
+ 2
251
+ 1
252
+ 10
253
+ 11
254
+ 8
255
+ 2
256
+ 1
257
+ 5
258
+ 0
259
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relax4
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 3
10
- version: 1.0.3
9
+ - 4
10
+ version: 1.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Lees-Miller
@@ -15,19 +15,21 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-07 00:00:00 +01:00
18
+ date: 2010-09-24 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description: Ruby interface for the RELAX IV code by D.P. Bertsekas and P. Tseng.
22
+ description: |
23
+ Ruby interface for the RELAX IV code by D.P. Bertsekas and P. Tseng.
24
+
23
25
  email:
24
26
  - jdleesmiller@gmail.com
25
27
  executables: []
26
28
 
27
29
  extensions:
28
30
  - ext/extconf.rb
29
- extra_rdoc_files: []
30
-
31
+ extra_rdoc_files:
32
+ - README.rdoc
31
33
  files:
32
34
  - lib/relax4.rb
33
35
  - lib/relax4/version.rb
@@ -36,16 +38,20 @@ files:
36
38
  - ext/relax4.h
37
39
  - ext/relax4_wrap.c
38
40
  - README.rdoc
41
+ - test/RELAX4.INP
42
+ - test/test_solve_4.inp
43
+ - test/test_solve_5.inp
44
+ - test/test_relax4.rb
39
45
  has_rdoc: true
40
46
  homepage: http://relax4.rubyforge.org/
41
47
  licenses: []
42
48
 
43
49
  post_install_message:
44
- rdoc_options: []
45
-
50
+ rdoc_options:
51
+ - --main
52
+ - README.rdoc
46
53
  require_paths:
47
54
  - lib
48
- - lib
49
55
  - ext
50
56
  required_ruby_version: !ruby/object:Gem::Requirement
51
57
  none: false
@@ -72,5 +78,5 @@ rubygems_version: 1.3.7
72
78
  signing_key:
73
79
  specification_version: 3
74
80
  summary: The RELAX IV code for the Minimum Cost Network Flow Problem
75
- test_files: []
76
-
81
+ test_files:
82
+ - test/test_relax4.rb