帮忙看看这段lingo代码有什么错误,该怎么改
网上的代码运行不起来model:sets:cheng/1..26/:l,w,x,y,a,b,x1,y1,a1,b1;endsetsmax=obj;obj=x1(i)*y1...
网上的代码 运行不起来
model:
sets:
cheng/1..26/:l,w,x,y,a,b,x1,y1,a1,b1;
endsets
max=obj;
obj=x1(i)*y1(i)+a1(i)*b1(i);
@for(cheng(i):x1(i)<=x(i));
@for(cheng(i):y1(i)<=y(i));
@for(cheng(i):a1(i)<=a(i));
@for(cheng(i):b1(i)<=b(i));
@for(cheng(i):w(i)*y1(i)+l(i)*a1(i)<=1650);
!@for(cheng(i):l(i)*x1(i)+w(i)*b1(i)<=2100);
@gin(cheng(i):x1(i));
@gin(cheng(i):y1(i));
@gin(cheng(i):a1(i));
@gin(cheng(i):b1(i));
data:
l=865 857 804 857 857 804 804 804 804 804 804 804 804 865 762 715 680 675 667 655
647 667 580 552 551 527;
w=857 715 746 675 667 663 661 639 631 563 536 535 551 446 446 446 446 446 446 446
446 426 446 446 446 426;
x=2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3
3 3 3 3;
y=1 2 2 2 2 2 2 2 2 2 3 3 2 3 3 3 3 3 3 3 3 3
3 3 3 3;
a=1 1 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2
2 2 2 3;
b=2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4
4 4 4 4;
enddata
end 展开
model:
sets:
cheng/1..26/:l,w,x,y,a,b,x1,y1,a1,b1;
endsets
max=obj;
obj=x1(i)*y1(i)+a1(i)*b1(i);
@for(cheng(i):x1(i)<=x(i));
@for(cheng(i):y1(i)<=y(i));
@for(cheng(i):a1(i)<=a(i));
@for(cheng(i):b1(i)<=b(i));
@for(cheng(i):w(i)*y1(i)+l(i)*a1(i)<=1650);
!@for(cheng(i):l(i)*x1(i)+w(i)*b1(i)<=2100);
@gin(cheng(i):x1(i));
@gin(cheng(i):y1(i));
@gin(cheng(i):a1(i));
@gin(cheng(i):b1(i));
data:
l=865 857 804 857 857 804 804 804 804 804 804 804 804 865 762 715 680 675 667 655
647 667 580 552 551 527;
w=857 715 746 675 667 663 661 639 631 563 536 535 551 446 446 446 446 446 446 446
446 426 446 446 446 426;
x=2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3
3 3 3 3;
y=1 2 2 2 2 2 2 2 2 2 3 3 2 3 3 3 3 3 3 3 3 3
3 3 3 3;
a=1 1 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2
2 2 2 3;
b=2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4
4 4 4 4;
enddata
end 展开
1个回答
展开全部
你好,答案如下所示。
sets:
cheng/1..26/:l,w,x,y,a,b,x1,y1,a1,b1;
endsets
max=obj;
obj=@sum(cheng(i):x1(i)*y1(i)+a1(i)*b1(i));
@for(cheng(i):x1(i)<=x(i));
@for(cheng(i):y1(i)<=y(i));
@for(cheng(i):a1(i)<=a(i));
@for(cheng(i):b1(i)<=b(i));
@for(cheng(i):w(i)*y1(i)+l(i)*a1(i)<=1650);
@for(cheng(i):l(i)*x1(i)+w(i)*b1(i)<=2100);
@for(cheng(i):@gin(x1(i)));
@for(cheng(i):@gin(y1(i)));
@for(cheng(i):@gin(a1(i)));
@for(cheng(i):@gin(b1(i)));
data:
l=865 857 804 857 857 804 804 804 804 804 804 804 804 865 762 715 680 675 667 655 647 667 580 552 551 527;
w=857 715 746 675 667 663 661 639 631 563 536 535 551 446 446 446 446 446 446 446 446 426 446 446 446 426;
x=2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3;
y=1 2 2 2 2 2 2 2 2 2 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3;
a=1 1 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 3;
b=2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4;
enddata
希望你能够详细查看。
如果你有不会的,你可以提问
我有时间就会帮你解答。
希望你好好学习。
每一天都过得充实。
sets:
cheng/1..26/:l,w,x,y,a,b,x1,y1,a1,b1;
endsets
max=obj;
obj=@sum(cheng(i):x1(i)*y1(i)+a1(i)*b1(i));
@for(cheng(i):x1(i)<=x(i));
@for(cheng(i):y1(i)<=y(i));
@for(cheng(i):a1(i)<=a(i));
@for(cheng(i):b1(i)<=b(i));
@for(cheng(i):w(i)*y1(i)+l(i)*a1(i)<=1650);
@for(cheng(i):l(i)*x1(i)+w(i)*b1(i)<=2100);
@for(cheng(i):@gin(x1(i)));
@for(cheng(i):@gin(y1(i)));
@for(cheng(i):@gin(a1(i)));
@for(cheng(i):@gin(b1(i)));
data:
l=865 857 804 857 857 804 804 804 804 804 804 804 804 865 762 715 680 675 667 655 647 667 580 552 551 527;
w=857 715 746 675 667 663 661 639 631 563 536 535 551 446 446 446 446 446 446 446 446 426 446 446 446 426;
x=2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3;
y=1 2 2 2 2 2 2 2 2 2 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3;
a=1 1 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 3;
b=2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4;
enddata
希望你能够详细查看。
如果你有不会的,你可以提问
我有时间就会帮你解答。
希望你好好学习。
每一天都过得充实。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询