lingo利用for循环,有错误
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/08 02:38:30
lingo利用for循环,有错误
1 lingo有没有真为1这么一说
2 @for(lianxi(i,j)| i #NE# j:(T(i)#EQ#1)*@floor((i+4)/5) #NE# (T(j)#EQ#1)*@floor((j+4)/5)); (j+4)/5))); 这句话哪有错误.整个程序是
model:
sets:
jiaoshi/1..45/:dianliang,zuowei,K,T;
sushe/1..10/:A;
zixiqu/1..9/:B;
dist(sushe,zixiqu):D;
tongxue(sushe,jiaoshi):X;
lianxi(jiaoshi,jiaoshi);
endsets
data:
D=
355 305 658 380 419 565 414 488 326
695 533 469 506 434 473 390 532 604
512 556 384 452 613 572 484 527 618
324 541 320 466 422 650 306 607 688
696 616 475 499 386 557 428 684 591
465 598 407 476 673 573 385 636 552
354 383 543 552 448 530 481 318 311
425 305 454 573 337 314 545 543 306
307 376 535 323 447 553 587 577 334
482 477 441 361 570 580 591 491 522;
zuowei =
64
88
193
193
128
120
120
120
110
120
64
247
190
210
70
85
192
195
128
120
120
120
110
160
70
256
190
210
190
205
110
160
70
256
190
210
190
190
210
200
150
150
180
70
120;
dianliang =
1680
1680
2400
2400
1620
1620
1728
1620
1440
1620
1080
3375
2304
2500
1680
1680
2400
2400
1620
1620
1728
1620
1440
1620
1080
3375
2304
2500
2304
2500
1440
1620
108
3375
2304
2500
2304
2304
2500
2304
2500
2304
2304
1250
2160;
enddata
min=@sum(jiaoshi:dianliang*K/1680)+@for(sushe(i):@sum(jiaoshi(j):D(i,@GIN(j/5)))/355);
min=@for(sushe(i):@sum(jiaoshi(j):D(i,@GIN(j/5)))/355);
min=@sum(tongxue(i,j):X(i,j)*D(i,@GIN(j/5)));
min=@sum(jiaoshi:dianliang*K/1680);
其实很简单,直接以tt(i,j):|t(i)-t(j)|>=tt(i,j);
#AND# ((T(i)#EQ#1)*@floor((i+4)/5))#NE#((T(j)#EQ#1)*@floor((j+4)/5)));
min=@sum(jiaoshi:dianliang*K/1680);
min=@sum(tongxue(i,j):X(i,j)*D(i,@floor((j+4)/5)))/355+@sum(jiaoshi:dianliang*K/1680);
MIN=@sum(tongxue(i,j):X(i,j)*D(i,@floor((j+4)/5)))/355/8000/0.7*45+@sum(jiaoshi:dianliang*K/1680);
min=@sum(jiaoshi:T);
@for(jiaoshi(j):@sum(sushe(i):0.99*X(i,j))>=zuowei(j)*0.8*(K(j)+T(j)));
@for(jiaoshi(j):@sum(sushe(i):0.99*X(i,j))
1 lingo有没有真为1这么一说
2 @for(lianxi(i,j)| i #NE# j:(T(i)#EQ#1)*@floor((i+4)/5) #NE# (T(j)#EQ#1)*@floor((j+4)/5)); (j+4)/5))); 这句话哪有错误.整个程序是
model:
sets:
jiaoshi/1..45/:dianliang,zuowei,K,T;
sushe/1..10/:A;
zixiqu/1..9/:B;
dist(sushe,zixiqu):D;
tongxue(sushe,jiaoshi):X;
lianxi(jiaoshi,jiaoshi);
endsets
data:
D=
355 305 658 380 419 565 414 488 326
695 533 469 506 434 473 390 532 604
512 556 384 452 613 572 484 527 618
324 541 320 466 422 650 306 607 688
696 616 475 499 386 557 428 684 591
465 598 407 476 673 573 385 636 552
354 383 543 552 448 530 481 318 311
425 305 454 573 337 314 545 543 306
307 376 535 323 447 553 587 577 334
482 477 441 361 570 580 591 491 522;
zuowei =
64
88
193
193
128
120
120
120
110
120
64
247
190
210
70
85
192
195
128
120
120
120
110
160
70
256
190
210
190
205
110
160
70
256
190
210
190
190
210
200
150
150
180
70
120;
dianliang =
1680
1680
2400
2400
1620
1620
1728
1620
1440
1620
1080
3375
2304
2500
1680
1680
2400
2400
1620
1620
1728
1620
1440
1620
1080
3375
2304
2500
2304
2500
1440
1620
108
3375
2304
2500
2304
2304
2500
2304
2500
2304
2304
1250
2160;
enddata
min=@sum(jiaoshi:dianliang*K/1680)+@for(sushe(i):@sum(jiaoshi(j):D(i,@GIN(j/5)))/355);
min=@for(sushe(i):@sum(jiaoshi(j):D(i,@GIN(j/5)))/355);
min=@sum(tongxue(i,j):X(i,j)*D(i,@GIN(j/5)));
min=@sum(jiaoshi:dianliang*K/1680);
其实很简单,直接以tt(i,j):|t(i)-t(j)|>=tt(i,j);
#AND# ((T(i)#EQ#1)*@floor((i+4)/5))#NE#((T(j)#EQ#1)*@floor((j+4)/5)));
min=@sum(jiaoshi:dianliang*K/1680);
min=@sum(tongxue(i,j):X(i,j)*D(i,@floor((j+4)/5)))/355+@sum(jiaoshi:dianliang*K/1680);
MIN=@sum(tongxue(i,j):X(i,j)*D(i,@floor((j+4)/5)))/355/8000/0.7*45+@sum(jiaoshi:dianliang*K/1680);
min=@sum(jiaoshi:T);
@for(jiaoshi(j):@sum(sushe(i):0.99*X(i,j))>=zuowei(j)*0.8*(K(j)+T(j)));
@for(jiaoshi(j):@sum(sushe(i):0.99*X(i,j))
不能直接用逻辑表达式的值 必须把它赋给一个变量用变量表达 至于赋值可以用@if来做 具体的我没看懂你要表达的意思 所以不知道怎么改