relax4 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -67,6 +67,11 @@ A lower-level interface is also available; see the docs for the Relax4 module.
67
67
 
68
68
  == REQUIREMENTS
69
69
 
70
+ Has been tested on:
71
+ * x86-linux (Ubuntu 10.04) with Ruby 1.8.7p249
72
+ * x86-linux (Ubuntu 10.04) with Ruby 1.9.1p378
73
+ * x86_64-linux (CentOS) with Ruby 1.8.7-p72
74
+
70
75
  The following packages were required to install on Ubuntu 10.04:
71
76
 
72
77
  * ruby, ruby-dev, rubygems, rake
@@ -74,11 +79,6 @@ The following packages were required to install on Ubuntu 10.04:
74
79
  The bindings were generated with f2c (FORTRAN to C converter) and SWIG
75
80
  (www.swig.org), but you don't need either to build the gem.
76
81
 
77
- Has been tested on:
78
- * x86-linux (Ubuntu 10.04) with Ruby 1.8.7-p302
79
- * x86-linux (Ubuntu 10.04) with Ruby 1.9.2-p0
80
- * x86_64-linux (CentOS) with Ruby 1.8.7-p72
81
-
82
82
  == INSTALL
83
83
 
84
84
  You should be able to install with
@@ -98,6 +98,7 @@ and run
98
98
 
99
99
  * there are some hard-coded parameters that could be exposed
100
100
  * problem state is global (cf. FORTRAN), so can have only one instance at a time
101
+ * add some wrappers for transportation and assignment problems
101
102
 
102
103
  == LICENSE
103
104
 
data/ext/relax4.c CHANGED
@@ -11,47 +11,66 @@
11
11
  #include "stdlib.h"
12
12
  /*#include "stdio.h" */ /* just for tracing*/
13
13
  #include "assert.h"
14
- #include "relax4_f2c.h"
15
14
  #include "relax4.h"
16
15
 
17
- /* Common Block Declarations */
16
+ /*
17
+ * The following are the required parts from f2c.h -- the Standard Fortran to C
18
+ * header file. They're included here to avoid having a dependency on f2c,
19
+ * because we really just need a few defines.
20
+ *
21
+ * barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
22
+ * - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition)
23
+ *
24
+ * (yes, the quotation above is a required part of f2c.h)
25
+ */
26
+
27
+ typedef char logical1;
28
+ #define TRUE_ (1)
29
+ #define FALSE_ (0)
30
+ #define min(a,b) ((a) <= (b) ? (a) : (b))
31
+
32
+ /*
33
+ * Begin translated RELAX4 code...
34
+ *
35
+ * Common Block Declarations
36
+ */
18
37
 
19
38
  struct {
20
- integer n, na, large;
39
+ RELAX4_INT n, na, large;
21
40
  } input_;
22
41
 
23
42
  #define input_1 input_
24
43
 
25
44
  struct {
26
- integer *startn;
45
+ RELAX4_INT *startn;
27
46
  } arrays_;
28
47
 
29
48
  #define arrays_1 arrays_
30
49
 
31
50
  struct {
32
- integer *endn;
51
+ RELAX4_INT *endn;
33
52
  } arraye_;
34
53
 
35
54
  #define arraye_1 arraye_
36
55
 
37
56
  struct {
38
- integer *c__;
57
+ RELAX4_INT *c__;
39
58
  } arrayc_;
40
59
 
41
60
  #define arrayc_1 arrayc_
42
61
 
43
62
  struct {
44
- integer *u;
63
+ RELAX4_INT *u;
45
64
  } arrayu_;
46
65
 
47
66
  #define arrayu_1 arrayu_
48
67
 
49
68
  union {
50
69
  struct {
51
- integer *b;
70
+ RELAX4_INT *b;
52
71
  } _1;
53
72
  struct {
54
- integer *dfct;
73
+ RELAX4_INT *dfct;
55
74
  } _2;
56
75
  } arrayb_;
57
76
 
@@ -59,35 +78,35 @@ union {
59
78
  #define arrayb_2 (arrayb_._2)
60
79
 
61
80
  struct {
62
- integer *x;
81
+ RELAX4_INT *x;
63
82
  } arrayx_;
64
83
 
65
84
  #define arrayx_1 arrayx_
66
85
 
67
86
  struct {
68
- integer *rc;
87
+ RELAX4_INT *rc;
69
88
  } arrayrc_;
70
89
 
71
90
  #define arrayrc_1 arrayrc_
72
91
 
73
92
  struct {
74
- integer nmultinode, iter, num_augm__, num_ascnt__, nsp;
93
+ RELAX4_INT nmultinode, iter, num_augm__, num_ascnt__, nsp;
75
94
  } output_;
76
95
 
77
96
  #define output_1 output_
78
97
 
79
98
  union {
80
99
  struct {
81
- integer *i1;
100
+ RELAX4_INT *i1;
82
101
  } _1;
83
102
  struct {
84
- integer *tempin;
103
+ RELAX4_INT *tempin;
85
104
  } _2;
86
105
  struct {
87
- integer *label;
106
+ RELAX4_INT *label;
88
107
  } _3;
89
108
  struct {
90
- integer *p;
109
+ RELAX4_INT *p;
91
110
  } _4;
92
111
  } blk1_;
93
112
 
@@ -98,16 +117,16 @@ union {
98
117
 
99
118
  union {
100
119
  struct {
101
- integer *i2;
120
+ RELAX4_INT *i2;
102
121
  } _1;
103
122
  struct {
104
- integer *tempou;
123
+ RELAX4_INT *tempou;
105
124
  } _2;
106
125
  struct {
107
- integer *prdcsr;
126
+ RELAX4_INT *prdcsr;
108
127
  } _3;
109
128
  struct {
110
- integer *price;
129
+ RELAX4_INT *price;
111
130
  } _4;
112
131
  } blk2_;
113
132
 
@@ -118,10 +137,10 @@ union {
118
137
 
119
138
  union {
120
139
  struct {
121
- integer *i3;
140
+ RELAX4_INT *i3;
122
141
  } _1;
123
142
  struct {
124
- integer *fou;
143
+ RELAX4_INT *fou;
125
144
  } _2;
126
145
  } blk3_;
127
146
 
@@ -130,10 +149,10 @@ union {
130
149
 
131
150
  union {
132
151
  struct {
133
- integer *i4;
152
+ RELAX4_INT *i4;
134
153
  } _1;
135
154
  struct {
136
- integer *nxtou;
155
+ RELAX4_INT *nxtou;
137
156
  } _2;
138
157
  } blk4_;
139
158
 
@@ -142,10 +161,10 @@ union {
142
161
 
143
162
  union {
144
163
  struct {
145
- integer *i5;
164
+ RELAX4_INT *i5;
146
165
  } _1;
147
166
  struct {
148
- integer *fin;
167
+ RELAX4_INT *fin;
149
168
  } _2;
150
169
  } blk5_;
151
170
 
@@ -154,10 +173,10 @@ union {
154
173
 
155
174
  union {
156
175
  struct {
157
- integer *i6;
176
+ RELAX4_INT *i6;
158
177
  } _1;
159
178
  struct {
160
- integer *nxtin;
179
+ RELAX4_INT *nxtin;
161
180
  } _2;
162
181
  } blk6_;
163
182
 
@@ -166,10 +185,10 @@ union {
166
185
 
167
186
  union {
168
187
  struct {
169
- integer *i7;
188
+ RELAX4_INT *i7;
170
189
  } _1;
171
190
  struct {
172
- integer *save;
191
+ RELAX4_INT *save;
173
192
  } _2;
174
193
  } blk7_;
175
194
 
@@ -196,10 +215,10 @@ union {
196
215
 
197
216
  union {
198
217
  struct {
199
- integer *tfstou; /* AKA ddpos */
218
+ RELAX4_INT *tfstou; /* AKA ddpos */
200
219
  } _1;
201
220
  struct {
202
- integer *fpushf;
221
+ RELAX4_INT *fpushf;
203
222
  } _2;
204
223
  } blk10_;
205
224
 
@@ -208,10 +227,10 @@ union {
208
227
 
209
228
  union {
210
229
  struct {
211
- integer *tnxtou;
230
+ RELAX4_INT *tnxtou;
212
231
  } _1;
213
232
  struct {
214
- integer *nxtpushf;
233
+ RELAX4_INT *nxtpushf;
215
234
  } _2;
216
235
  } blk11_;
217
236
 
@@ -220,10 +239,10 @@ union {
220
239
 
221
240
  union {
222
241
  struct {
223
- integer *tfstin; /* AKA ddneg */
242
+ RELAX4_INT *tfstin; /* AKA ddneg */
224
243
  } _1;
225
244
  struct {
226
- integer *fpushb;
245
+ RELAX4_INT *fpushb;
227
246
  } _2;
228
247
  } blk12_;
229
248
 
@@ -232,10 +251,10 @@ union {
232
251
 
233
252
  union {
234
253
  struct {
235
- integer *tnxtin;
254
+ RELAX4_INT *tnxtin;
236
255
  } _1;
237
256
  struct {
238
- integer *nxtpushb;
257
+ RELAX4_INT *nxtpushb;
239
258
  } _2;
240
259
  } blk13_;
241
260
 
@@ -244,10 +263,10 @@ union {
244
263
 
245
264
  union {
246
265
  struct {
247
- integer *i14;
266
+ RELAX4_INT *i14;
248
267
  } _1;
249
268
  struct {
250
- integer *nxtqueue;
269
+ RELAX4_INT *nxtqueue;
251
270
  } _2;
252
271
  } blk14_;
253
272
 
@@ -256,10 +275,10 @@ union {
256
275
 
257
276
  union {
258
277
  struct {
259
- integer *i15;
278
+ RELAX4_INT *i15;
260
279
  } _1;
261
280
  struct {
262
- integer *extend_arc__;
281
+ RELAX4_INT *extend_arc__;
263
282
  } _2;
264
283
  } blk15_;
265
284
 
@@ -268,10 +287,10 @@ union {
268
287
 
269
288
  union {
270
289
  struct {
271
- integer *i16;
290
+ RELAX4_INT *i16;
272
291
  } _1;
273
292
  struct {
274
- integer *sb_level__;
293
+ RELAX4_INT *sb_level__;
275
294
  } _2;
276
295
  } blk16_;
277
296
 
@@ -280,10 +299,10 @@ union {
280
299
 
281
300
  union {
282
301
  struct {
283
- integer *i17;
302
+ RELAX4_INT *i17;
284
303
  } _1;
285
304
  struct {
286
- integer *sb_arc__;
305
+ RELAX4_INT *sb_arc__;
287
306
  } _2;
288
307
  } blk17_;
289
308
 
@@ -291,7 +310,7 @@ union {
291
310
  #define blk17_2 (blk17_._2)
292
311
 
293
312
  struct {
294
- integer crash;
313
+ RELAX4_INT crash;
295
314
  } cr_;
296
315
 
297
316
  #define cr_1 cr_
@@ -299,10 +318,10 @@ struct {
299
318
  /* Subroutine */ int inidat_(void)
300
319
  {
301
320
  /* System generated locals */
302
- integer i__1;
321
+ RELAX4_INT i__1;
303
322
 
304
323
  /* Local variables */
305
- static integer i__, i1, i2;
324
+ static RELAX4_INT i__, i1, i2;
306
325
 
307
326
 
308
327
  /* --------------------------------------------------------------- */
@@ -387,8 +406,8 @@ struct {
387
406
  */
388
407
  int relax4_init_phase_1(void) {
389
408
 
390
- integer i__1, i__2;
391
- integer node, arc, node_def__, maxcap, scapou, scapin, capout, capin;
409
+ RELAX4_INT i__1, i__2;
410
+ RELAX4_INT node, arc, node_def__, maxcap, scapou, scapin, capout, capin;
392
411
 
393
412
  /* CONSTRUCT LINKED LISTS FOR THE PROBLEM */
394
413
  inidat_();
@@ -478,8 +497,8 @@ L10:
478
497
  /* ALSO COMPUTE THE DIRECTIONAL DERIVATIVES FOR EACH COORDINATE */
479
498
  /* AND COMPUTE THE ACTUAL DEFICITS. */
480
499
  int relax4_init_phase_2(void) {
481
- integer i__1, i__2;
482
- integer numpasses, node, arc, t, t1, t2, passes, delprc, trc, nxtbrk;
500
+ RELAX4_INT i__1, i__2;
501
+ RELAX4_INT numpasses, node, arc, t, t1, t2, passes, delprc, trc, nxtbrk;
483
502
 
484
503
  i__1 = input_1.na;
485
504
  for (arc = 1; arc <= i__1; ++arc) {
@@ -808,31 +827,31 @@ L40:
808
827
  /* Subroutine */ int relax4_(void)
809
828
  {
810
829
  /* System generated locals */
811
- integer i__1, i__2, i__3;
830
+ RELAX4_INT i__1, i__2, i__3;
812
831
 
813
832
  /* Local variables */
814
- static integer prevnode, i__, j, t1, t2, lastqueue,
833
+ static RELAX4_INT prevnode, i__, j, t1, t2, lastqueue,
815
834
  numnz_new__, ib, nb, dp, dm, dx, tp, ts, num_passes__,
816
835
  arc;
817
- static integer narc, node, delx;
836
+ static RELAX4_INT narc, node, delx;
818
837
  static logical1 quit;
819
- static integer node2;
820
- static integer indef;
821
- static integer nscan;
838
+ static RELAX4_INT node2;
839
+ static RELAX4_INT indef;
840
+ static RELAX4_INT nscan;
822
841
  static logical1 posit;
823
- static integer numnz;
824
- extern /* Subroutine */ int ascnt1_(integer *, integer *, integer *,
825
- logical1 *, logical1 *, integer *, integer *, integer *), ascnt2_(
826
- integer *, integer *, integer *, logical1 *, logical1 *, integer *
827
- , integer *, integer *);
842
+ static RELAX4_INT numnz;
843
+ extern /* Subroutine */ int ascnt1_(RELAX4_INT *, RELAX4_INT *, RELAX4_INT *,
844
+ logical1 *, logical1 *, RELAX4_INT *, RELAX4_INT *, RELAX4_INT *), ascnt2_(
845
+ RELAX4_INT *, RELAX4_INT *, RELAX4_INT *, logical1 *, logical1 *, RELAX4_INT *
846
+ , RELAX4_INT *, RELAX4_INT *);
828
847
  static logical1 feasbl;
829
- static integer nlabel, defcit, delprc, augnod, tmparc,
848
+ static RELAX4_INT nlabel, defcit, delprc, augnod, tmparc,
830
849
  rdcost, nxtarc;
831
850
  static logical1 switch__;
832
- static integer prvarc;
851
+ static RELAX4_INT prvarc;
833
852
  static logical1 pchange;
834
- static integer naugnod;
835
- static integer nxtnode;
853
+ static RELAX4_INT naugnod;
854
+ static RELAX4_INT nxtnode;
836
855
 
837
856
  /* --------------------------------------------------------------- */
838
857
 
@@ -2147,12 +2166,10 @@ L4400:
2147
2166
  /* Subroutine */ int auction_(void)
2148
2167
  {
2149
2168
  /* System generated locals */
2150
- integer i__1;
2151
-
2152
- /* Subroutine */ int s_stop(char *, ftnlen);
2169
+ RELAX4_INT i__1;
2153
2170
 
2154
2171
  /* Local variables */
2155
- static integer seclevel, red_cost__, bstlevel, prevnode, i__, new_level__,
2172
+ static RELAX4_INT seclevel, red_cost__, bstlevel, prevnode, i__, new_level__,
2156
2173
  prevlevel, lastqueue, num_passes__, arc, end, nas, prd, eps,
2157
2174
  thresh_dfct__, node, pend, naug, incr, last, pass, term, flow,
2158
2175
  root, resid, pterm, start, secarc, factor, extarc, rdcost, nolist,
@@ -2999,15 +3016,15 @@ L3000:
2999
3016
 
3000
3017
 
3001
3018
 
3002
- /* Subroutine */ int ascnt1_(integer *dm, integer *delx, integer *nlabel,
3003
- logical1 *feasbl, logical1 *switch__, integer *nscan, integer *
3004
- curnode, integer *prevnode)
3019
+ /* Subroutine */ int ascnt1_(RELAX4_INT *dm, RELAX4_INT *delx, RELAX4_INT *nlabel,
3020
+ logical1 *feasbl, logical1 *switch__, RELAX4_INT *nscan, RELAX4_INT *
3021
+ curnode, RELAX4_INT *prevnode)
3005
3022
  {
3006
3023
  /* System generated locals */
3007
- integer i__1;
3024
+ RELAX4_INT i__1;
3008
3025
 
3009
3026
  /* Local variables */
3010
- static integer i__, j, t1, t2, t3, nb, arc, dlx, node, node2, nsave,
3027
+ static RELAX4_INT i__, j, t1, t2, t3, nb, arc, dlx, node, node2, nsave,
3011
3028
  delprc, rdcost;
3012
3029
 
3013
3030
 
@@ -3396,15 +3413,15 @@ L4:
3396
3413
 
3397
3414
 
3398
3415
 
3399
- /* Subroutine */ int ascnt2_(integer *dm, integer *delx, integer *nlabel,
3400
- logical1 *feasbl, logical1 *switch__, integer *nscan, integer *
3401
- curnode, integer *prevnode)
3416
+ /* Subroutine */ int ascnt2_(RELAX4_INT *dm, RELAX4_INT *delx, RELAX4_INT *nlabel,
3417
+ logical1 *feasbl, logical1 *switch__, RELAX4_INT *nscan, RELAX4_INT *
3418
+ curnode, RELAX4_INT *prevnode)
3402
3419
  {
3403
3420
  /* System generated locals */
3404
- integer i__1;
3421
+ RELAX4_INT i__1;
3405
3422
 
3406
3423
  /* Local variables */
3407
- static integer i__, j, t1, t2, t3, nb, arc, dlx, node, node2, nsave,
3424
+ static RELAX4_INT i__, j, t1, t2, t3, nb, arc, dlx, node, node2, nsave,
3408
3425
  delprc, rdcost;
3409
3426
 
3410
3427
 
@@ -3693,9 +3710,9 @@ L4:
3693
3710
  return 0;
3694
3711
  } /* ascnt2_ */
3695
3712
 
3696
- /* Subroutine */ int addtr_(integer *arc)
3713
+ /* Subroutine */ int addtr_(RELAX4_INT *arc)
3697
3714
  {
3698
- static integer arc1, node;
3715
+ static RELAX4_INT arc1, node;
3699
3716
 
3700
3717
 
3701
3718
  /* --------------------------------------------------------------- */
@@ -3738,14 +3755,14 @@ L30:
3738
3755
  return 0;
3739
3756
  } /* addtr_ */
3740
3757
 
3741
- int relax4_init(integer num_nodes, integer num_arcs,
3742
- integer start_nodes[],
3743
- integer end_nodes[],
3744
- integer costs[],
3745
- integer capacities[],
3746
- integer demands[],
3747
- integer flows[],
3748
- integer large)
3758
+ int relax4_init(RELAX4_INT num_nodes, RELAX4_INT num_arcs,
3759
+ RELAX4_INT start_nodes[],
3760
+ RELAX4_INT end_nodes[],
3761
+ RELAX4_INT costs[],
3762
+ RELAX4_INT capacities[],
3763
+ RELAX4_INT demands[],
3764
+ RELAX4_INT flows[],
3765
+ RELAX4_INT large)
3749
3766
  {
3750
3767
  /* Set input/output pointers. */
3751
3768
  input_1.n = num_nodes;
@@ -3781,24 +3798,24 @@ int relax4_init(integer num_nodes, integer num_arcs,
3781
3798
  blk16_1.i16 = NULL;
3782
3799
  blk17_1.i17 = NULL;
3783
3800
 
3784
- arrayrc_1.rc = malloc(num_arcs*sizeof(integer));
3785
- blk1_1.i1 = malloc(num_nodes*sizeof(integer));
3786
- blk2_1.i2 = malloc(num_nodes*sizeof(integer));
3787
- blk3_1.i3 = malloc(num_nodes*sizeof(integer));
3788
- blk4_1.i4 = malloc(num_arcs*sizeof(integer));
3789
- blk5_1.i5 = malloc(num_nodes*sizeof(integer));
3790
- blk6_1.i6 = malloc(num_arcs*sizeof(integer));
3791
- blk7_1.i7 = malloc(num_arcs*sizeof(integer));
3801
+ arrayrc_1.rc = malloc(num_arcs*sizeof(RELAX4_INT));
3802
+ blk1_1.i1 = malloc(num_nodes*sizeof(RELAX4_INT));
3803
+ blk2_1.i2 = malloc(num_nodes*sizeof(RELAX4_INT));
3804
+ blk3_1.i3 = malloc(num_nodes*sizeof(RELAX4_INT));
3805
+ blk4_1.i4 = malloc(num_arcs*sizeof(RELAX4_INT));
3806
+ blk5_1.i5 = malloc(num_nodes*sizeof(RELAX4_INT));
3807
+ blk6_1.i6 = malloc(num_arcs*sizeof(RELAX4_INT));
3808
+ blk7_1.i7 = malloc(num_arcs*sizeof(RELAX4_INT));
3792
3809
  blk8_1.scan = malloc(num_nodes*sizeof(logical1));
3793
3810
  blk9_1.mark = malloc(num_nodes*sizeof(logical1));
3794
- blk10_1.tfstou = malloc(num_nodes*sizeof(integer));
3795
- blk11_1.tnxtou = malloc(num_arcs*sizeof(integer));
3796
- blk12_1.tfstin = malloc(num_nodes*sizeof(integer));
3797
- blk13_1.tnxtin = malloc(num_arcs*sizeof(integer));
3798
- blk14_1.i14 = malloc(num_nodes*sizeof(integer));
3799
- blk15_1.i15 = malloc(num_nodes*sizeof(integer));
3800
- blk16_1.i16 = malloc(num_nodes*sizeof(integer));
3801
- blk17_1.i17 = malloc(num_nodes*sizeof(integer));
3811
+ blk10_1.tfstou = malloc(num_nodes*sizeof(RELAX4_INT));
3812
+ blk11_1.tnxtou = malloc(num_arcs*sizeof(RELAX4_INT));
3813
+ blk12_1.tfstin = malloc(num_nodes*sizeof(RELAX4_INT));
3814
+ blk13_1.tnxtin = malloc(num_arcs*sizeof(RELAX4_INT));
3815
+ blk14_1.i14 = malloc(num_nodes*sizeof(RELAX4_INT));
3816
+ blk15_1.i15 = malloc(num_nodes*sizeof(RELAX4_INT));
3817
+ blk16_1.i16 = malloc(num_nodes*sizeof(RELAX4_INT));
3818
+ blk17_1.i17 = malloc(num_nodes*sizeof(RELAX4_INT));
3802
3819
 
3803
3820
  if (arrayrc_1.rc == NULL ||
3804
3821
  blk1_1.i1 == NULL ||
@@ -3827,7 +3844,7 @@ int relax4_init(integer num_nodes, integer num_arcs,
3827
3844
 
3828
3845
  int relax4_check_inputs(int max_cost)
3829
3846
  {
3830
- integer i;
3847
+ RELAX4_INT i;
3831
3848
 
3832
3849
  if (input_1.n < 1 || input_1.na < 1) {
3833
3850
  return RELAX4_FAIL_BAD_SIZE;
@@ -3891,7 +3908,7 @@ int relax4_run()
3891
3908
 
3892
3909
  int relax4_check_output()
3893
3910
  {
3894
- integer i;
3911
+ RELAX4_INT i;
3895
3912
 
3896
3913
  for (i = 1; i <= input_1.n; ++i) {
3897
3914
  if (arrayb_1.b[i - 1] != 0)
data/ext/relax4.h CHANGED
@@ -12,6 +12,11 @@
12
12
  #define RELAX4_OUTPUT_FAIL_NONZERO_DEMAND 101
13
13
  #define RELAX4_OUTPUT_FAIL_COMPLEMENTARY_SLACKNESS 102
14
14
 
15
+ /* Just use int by default; must have at least 32 bits. */
16
+ #ifndef RELAX4_INT
17
+ #define RELAX4_INT int
18
+ #endif
19
+
15
20
  /**
16
21
  * The default value used for the <tt>large</tt> parameter. It is set to 500
17
22
  * million, which is the value in the original relax4 source.
@@ -39,6 +44,17 @@
39
44
  */
40
45
  #define RELAX4_DEFAULT_MAX_COST (RELAX4_DEFAULT_LARGE/10)
41
46
 
47
+ /**
48
+ * Suggested capacity to use for arcs in uncapacitated problems.
49
+ *
50
+ * The guidance in the original relax4 source was that LARGE should be used, but
51
+ * this has been known to cause overflow problems. Moreover, when relax4 read
52
+ * its input, it only read the first eight digits of each number, so it read
53
+ * 500 million (nine decimal digits) as 50 million; so, this is a reasonable
54
+ * value to use, if you don't have a tighter upper bound.
55
+ */
56
+ #define RELAX4_UNCAPACITATED (RELAX4_DEFAULT_LARGE/10)
57
+
42
58
  /**
43
59
  * Set global state and allocate memory for internal arrays.
44
60
  *
@@ -72,8 +88,8 @@
72
88
  * RELAX4_DEFAULT_MAX_COST).
73
89
  *
74
90
  * @param[in] capacities capacity for each arc; for an uncapacitated problem,
75
- * set these to a suitably large value (such as <tt>large</tt>); capacities
76
- * must be in [0, <tt>large</tt>].
91
+ * set these to a suitably large value (such as +RELAX4_UNCAPACITATED+);
92
+ * capacities must be in [0, <tt>large</tt>].
77
93
  *
78
94
  * @param[in] demands demand for each node; a node with negative demand is a
79
95
  * surplus node; demands should balance (sum to zero), or else the problem will
@@ -88,14 +104,14 @@
88
104
  * @return RELAX4_OK if allocations succeeded, or RELAX4_FAIL_OUT_OF_MEMORY if
89
105
  * any failed.
90
106
  */
91
- int relax4_init(integer num_nodes, integer num_arcs,
92
- integer start_nodes[],
93
- integer end_nodes[],
94
- integer costs[],
95
- integer capacities[],
96
- integer demands[],
97
- integer flows[],
98
- integer large);
107
+ int relax4_init(RELAX4_INT num_nodes, RELAX4_INT num_arcs,
108
+ RELAX4_INT start_nodes[],
109
+ RELAX4_INT end_nodes[],
110
+ RELAX4_INT costs[],
111
+ RELAX4_INT capacities[],
112
+ RELAX4_INT demands[],
113
+ RELAX4_INT flows[],
114
+ RELAX4_INT large);
99
115
 
100
116
  /**
101
117
  * Basic checks on the parameters given to relax4_init.