大家帮忙看一下 我的lingo代码哪里错了 小弟是初学者

model:

SETS:

Q/p1,p2,p3,p4,p5,p6,p7/:u,pp,x,r,a,b;
ENDSETS
DATA:
a=10,4,3,4,2,2,0;
b=233,54,17,20,10,10,0;
ENDDATA

max=@sum(Q(I):pp(I)*u(I));
@FOR(Q(i)|i#LE#3:x(i)=(1-(pp(4)*x(4)+pp(5)*x(5)+pp(6)*x(6)+pp(7)*x(7)))*r(i)/pp(i));
@FOR(Q(i)|4#LE#7:r(i)=0);
@FOR(Q(i):u(i)=1-1/exp^(x(i)/(6*10^5)));
@SUM(Q(i)|i#LE#3:r)=1;
@BND(0.7,r(1),0.8);
@BND(600000,x(1),5000000);
@for(Q(i)|i#LE#6: @BND(a(i),x(i)/x(i+1),b(i)));
@for(Q(i)|i#LE#6: pp(i)<pp(i+1));
@BND(5,m,7);
@BND(29,n,60);
@gin(m);
@gin(n);
m>0;
n>0;
@for(Q(i):r>0);
@for(Q(i):x>0);
end

总是提示 conflicting bounds on variable

SETS:

Q/1..7/:u,pp,x,r,a,b;
ENDSETS
DATA:
a=10,4,3,4,2,2,0;
b=233,54,17,20,10,10,0;
ENDDATA

max=@sum(Q(I):pp(I)*u(I));
@FOR(Q(i)|i#LE#3:x(i)=(1-(pp(4)*x(4)+pp(5)*x(5)+pp(6)*x(6)+pp(7)*x(7)))*r(i)/pp(i));
!@FOR(Q(i)|i#LE#7:r(i)=0);r(7)=0;
@FOR(Q(i):u(i)=1-1/exp^(x(i)/(6*10^5)));
@SUM(Q(i)|i#LE#3:r)=1;
@BND(0.7,r(1),0.8);
@BND(600000,x(1),5000000);
!@for(Q(i)|i#LE#6:@BND(a(i),x(i)/x(i+1),b(i)));
a(6)<x(6)/x(7);
b(6)>x(6)/x(7);
@for(Q(i)|i#LE#6: pp(i)<pp(i+1));
@BND(5,m,7);
@BND(29,n,60);
@gin(m);
@gin(n);
m>0;
n>0;
@for(Q(i):r>0);
@for(Q(i):x>0);
end

运行结果
Local optimal solution found.
Objective value: 0.2231947E-05
Objective bound: 0.2231947E-05
Infeasibilities: 0.1488356E-01
Extended solver steps: 0
Total solver iterations: 101

Variable Value
EXP 3.815870
M 5.000000
N 29.00000
U( 1) 0.7379366
U( 2) 0.000000
U( 3) 0.000000
U( 4) 0.5465577E-06
U( 5) 0.5465580E-06
U( 6) 0.1276832E-05
U( 7) 0.6384160E-06
PP( 1) 0.000000
PP( 2) 0.4538774
PP( 3) 0.4538774
PP( 4) 0.7418578
PP( 5) 0.7419018
PP( 6) 0.7419336
PP( 7) 0.7419336
X( 1) 600000.0
X( 2) 0.000000
X( 3) 0.1652429E-08
X( 4) 0.2448793
X( 5) 0.2448794
X( 6) 0.5720709
X( 7) 0.2860354
R( 1) 0.8000000
R( 2) 0.000000
R( 3) 0.2000000
R( 4) 0.000000
R( 5) 0.000000
R( 6) 0.000000
R( 7) 0.000000
A( 1) 10.00000
A( 2) 4.000000
A( 3) 3.000000
A( 4) 4.000000
A( 5) 2.000000
A( 6) 2.000000
A( 7) 0.000000
B( 1) 233.0000
B( 2) 54.00000
B( 3) 17.00000
B( 4) 20.00000
B( 5) 10.00000
B( 6) 10.00000
B( 7) 0.000000

Row Slack or Surplus
1 0.2231947E-05
2 -0.1488356E-01
3 0.000000
4 0.000000
5 0.000000
6 0.000000
7 0.000000
8 0.000000
9 0.000000
10 0.000000
11 0.000000
12 0.000000
13 0.000000
14 0.000000
15 8.000000
16 0.4538774
17 0.000000
18 0.2879804
19 0.4404063E-04
20 0.3175978E-04
21 0.000000
22 5.000000
23 29.00000
24 0.8000000
25 0.000000
26 0.2000000
27 0.000000
28 0.000000
29 0.000000
30 0.000000
31 600000.0
32 0.000000
33 0.1652429E-08
34 0.2448793
35 0.2448794
36 0.5720709
37 0.2860354
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答
大家正在搜