sets:
sets:
num_i/1..16/;
num_j/1..4/;
link(num_i,num_j):c,x;
endsets
MAX=@sum(link(i,j):c(i,j)*x(i,j));
data:
c=
0.51059 0.55549 0.41665 0.44446
0.42006 0.56554 0.48421 0.42254
0.5581 0.51831 0.38919 0.45405
0.4632 0.58642 0.44015 0.4384
0.52204 0.49866 0.41991 0.44461
0.4198 0.46651 0.58812 0.50017
0.48207 0.5852 0.41732 0.44202
0.46958 0.48207 0.47732 0.44454
0.42533 0.46627 0.56142 0.48075
0.43622 0.44471 0.55223 0.47233
0.53199 0.38852 0.59874 0.61488
0.51427 0.51687 0.47473 0.51687
0.54222 0.45792 0.52291 0.57929
0.4446 0.42805 0.56645 0.49826
0.46857 0.59454 0.3987 0.41863
0.51342 0.49004 0.41129 0.43599
;
enddata
@for(num_j(j):@sum(link(i,j):x(i,j))>=1);
@for(num_i(i):@sum(link(i,j):x(i,j))>=0);
@for(num_j(j):@sum(link(i,j):x(i,j))
可以直接运行的
结果如下:
Global optimal solution found at iteration:10
Objective value: 4.673000
Variable ValueReduced Cost
C( 1, 1) 0.51059000.000000
C( 1, 2) 0.55549000.000000
C( 1, 3) 0.41665000.000000
C( 1, 4) 0.44446000.000000
C( 2, 1) 0.42006000.000000
C( 2, 2) 0.56554000.000000
C( 2, 3) 0.48421000.000000
C( 2, 4) 0.42254000.000000
C( 3, 1) 0.55810000.000000
C( 3, 2) 0.51831000.000000
C( 3, 3) 0.38919000.000000
C( 3, 4) 0.45405000.000000
C( 4, 1) 0.46320000.000000
C( 4, 2) 0.58642000.000000
C( 4, 3) 0.44015000.000000
C( 4, 4) 0.43840000.000000
C( 5, 1) 0.52204000.000000
C( 5, 2) 0.49866000.000000
C( 5, 3) 0.41991000.000000
C( 5, 4) 0.44461000.000000
C( 6, 1) 0.41980000.000000
C( 6, 2) 0.46651000.000000
C( 6, 3) 0.58812000.000000
C( 6, 4) 0.50017000.000000
C( 7, 1) 0.48207000.000000
C( 7, 2) 0.58520000.000000
C( 7, 3) 0.41732000.000000
C( 7, 4) 0.44202000.000000
C( 8, 1) 0.46958000.000000
C( 8, 2) 0.48207000.000000
C( 8, 3) 0.47732000.000000
C( 8, 4) 0.44454000.000000
C( 9, 1) 0.42533000.000000
C( 9, 2) 0.46627000.000000
C( 9, 3) 0.56142000.000000
C( 9, 4) 0.48075000.000000
C( 10, 1) 0.43622000.000000
C( 10, 2) 0.44471000.000000
C( 10, 3) 0.55223000.000000
C( 10, 4) 0.47233000.000000
C( 11, 1) 0.53199000.000000
C( 11, 2) 0.38852000.000000
C( 11, 3) 0.59874000.000000
C( 11, 4) 0.61488000.000000
C( 12, 1) 0.51427000.000000
C( 12, 2) 0.51687000.000000
C( 12, 3) 0.47473000.000000
C( 12, 4) 0.51687000.000000
C( 13, 1) 0.54222000.000000
C( 13, 2) 0.45792000.000000
C( 13, 3) 0.52291000.000000
C( 13, 4) 0.57929000.000000
C( 14, 1) 0.44460000.000000
C( 14, 2) 0.42805000.000000
C( 14, 3) 0.56645000.000000
C( 14, 4) 0.49826000.000000
C( 15, 1) 0.46857000.000000
C( 15, 2) 0.59454000.000000
C( 15, 3) 0.39870000.000000
C( 15, 4) 0.41863000.000000
C( 16, 1) 0.51342000.000000
C( 16, 2) 0.49004000.000000
C( 16, 3) 0.41129000.000000
C( 16, 4) 0.43599000.000000
X( 1, 1)0.000000-0.5105900
X( 1, 2)0.000000-0.5554900
X( 1, 3)0.000000-0.4166500
X( 1, 4)0.000000-0.4444600
X( 2, 1)0.000000-0.4200600
X( 2, 2)0.000000-0.5655400
X( 2, 3)0.000000-0.4842100
X( 2, 4)0.000000-0.4225400
X( 3, 1)1.000000-0.5581000
X( 3, 2)0.000000-0.5183100
X( 3, 3)0.000000-0.3891900
X( 3, 4)0.000000-0.4540500
X( 4, 1)0.000000-0.4632000
X( 4, 2)1.000000-0.5864200
X( 4, 3)0.000000-0.4401500
X( 4, 4)0.000000-0.4384000
X( 5, 1)0.000000-0.5220400
X( 5, 2)0.000000-0.4986600
X( 5, 3)0.000000-0.4199100
X( 5, 4)0.000000-0.4446100
X( 6, 1)0.000000-0.4198000
X( 6, 2)0.000000-0.4665100
X( 6, 3)1.000000-0.5881200
X( 6, 4)0.000000-0.5001700
X( 7, 1)0.000000-0.4820700
X( 7, 2)1.000000-0.5852000
X( 7, 3)0.000000-0.4173200
X( 7, 4)0.000000-0.4420200
X( 8, 1)0.000000-0.4695800
X( 8, 2)0.000000-0.4820700
X( 8, 3)0.000000-0.4773200
X( 8, 4)0.000000-0.4445400
X( 9, 1)0.000000-0.4253300
X( 9, 2)0.000000-0.4662700
X( 9, 3)0.000000-0.5614200
X( 9, 4)0.000000-0.4807500
X( 10, 1)0.000000-0.4362200
X( 10, 2)0.000000-0.4447100
X( 10, 3)0.000000-0.5522300
X( 10, 4)0.000000-0.4723300
X( 11, 1)0.000000-0.5319900
X( 11, 2)0.000000-0.3885200
X( 11, 3)0.000000-0.5987400
X( 11, 4)1.000000-0.6148800
X( 12, 1)0.000000-0.5142700
X( 12, 2)0.000000-0.5168700
X( 12, 3)0.000000-0.4747300
X( 12, 4)0.000000-0.5168700
X( 13, 1)0.000000-0.5422200
X( 13, 2)0.000000-0.4579200
X( 13, 3)0.000000-0.5229100
X( 13, 4)1.000000-0.5792900
X( 14, 1)0.000000-0.4446000
X( 14, 2)0.000000-0.4280500
X( 14, 3)1.000000-0.5664500
X( 14, 4)0.000000-0.4982600
X( 15, 1)0.000000-0.4685700
X( 15, 2)1.000000-0.5945400
X( 15, 3)0.000000-0.3987000
X( 15, 4)0.000000-0.4186300
X( 16, 1)0.000000-0.5134200
X( 16, 2)0.000000-0.4900400
X( 16, 3)0.000000-0.4112900
X( 16, 4)0.000000-0.4359900
RowSlack or SurplusDual Price
14.6730001.000000
20.0000000.000000
32.0000000.000000
41.0000000.000000
51.0000000.000000
60.0000000.000000
70.0000000.000000
81.0000000.000000
91.0000000.000000
100.0000000.000000
111.0000000.000000
121.0000000.000000
130.0000000.000000
140.0000000.000000
150.0000000.000000
161.0000000.000000
170.0000000.000000
181.0000000.000000
191.0000000.000000
201.0000000.000000
210.0000000.000000
222.0000000.000000
230.0000000.000000
241.0000000.000000
251.0000000.000000
261.0000000.000000
271.0000000.000000
280.0000000.000000
290.0000000.000000
301.0000000.000000
310.0000000.000000
320.0000000.000000
331.0000000.000000
341.0000000.000000
351.0000000.000000
360.0000000.000000
371.0000000.000000
380.0000000.000000
390.0000000.000000
400.0000000.000000
411.0000000.000000
420.0000000.000000