LINGO分段函数怎么求!sets:position/1..7/:x,f;society/1..15/:r,Y;endsetsdata:r=2 14 3 6 9 4 8 12 10 11 6 14 9 3 6;f=9 6.5 20 14.5 19 13 10.5;enddatamax=@sum(society(i):y(i));Y(1)=@if(x(1)#eq#1,0.7*r(1),0);Y(2)=@if((x(1)+x(2))#le#0,0,@if((x(1)+x(
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 05:03:33
LINGO分段函数怎么求!sets:position/1..7/:x,f;society/1..15/:r,Y;endsetsdata:r=2 14 3 6 9 4 8 12 10 11 6 14 9 3 6;f=9 6.5 20 14.5 19 13 10.5;enddatamax=@sum(society(i):y(i));Y(1)=@if(x(1)#eq#1,0.7*r(1),0);Y(2)=@if((x(1)+x(2))#le#0,0,@if((x(1)+x(
LINGO分段函数怎么求!
sets:
position/1..7/:x,f;
society/1..15/:r,Y;
endsets
data:
r=2 14 3 6 9 4 8 12 10 11 6 14 9 3 6;
f=9 6.5 20 14.5 19 13 10.5;
enddata
max=@sum(society(i):y(i));
Y(1)=@if(x(1)#eq#1,0.7*r(1),0);
Y(2)=@if((x(1)+x(2))#le#0,0,@if((x(1)+x(2))#gt#1),r(2),0.7*r(2));
!这里设置成的分段函数哪里错了,求大神指点,下面的程序都是一样的,这边改了,后面也就一样了;
Y(3)=@if(x(2)#eq#1,0.7*r(3),@if(x(2)#eq#0),0);
Y(4)=@if(x(1)+x(3)#eq#1,0.7*r(4),@if(x(1)+x(3)#eq#0),0,@if(x(1)+x(3)#eq#2,r(4)));
Y(5)=@if(x(2)+x(4)#eq#1,0.7*r(5),@if(x(2)+x(4)#eq#0),0,@if(x(2)+x(4)#eq#2,r(5)));
Y(6)=@if(x(4)#eq#1,0.7*r(6),@if(x(4)#eq#0),0);
Y(7)=@if(x(3)+x(6)#eq#1,0.7*r(7),@if(x(3)+x(6)#eq#0),0,@if(x(3)+x(6)#eq#2,r(7)));
Y(8)=@if(x(3)+x(4)+x(5)#eq#1,0.7*r(8),@if(x(3)+x(5)+x(4)#eq#0),0,@if(x(3)+x(5)+x(4)#ge#2,r(8)));
Y(9)=@if(x(4)+x(5)#eq#1,0.7*r(9),@if(x(4)+x(5)#eq#0),0,@if(x(4)+x(5)#eq#2,r(9)));
Y(10)=@if(x(3)+x(5)#eq#1,0.7*r(10),@if(x(3)+x(5)#eq#0),0,@if(x(3)+x(5)#eq#2,r(10)));
Y(11)=@if(x(6)#eq#1,0.7*r(11),@if(x(6)#eq#0),0);
Y(12)=@if(x(6)+x(7)#eq#1,0.7*r(12),@if(x(6)+x(7)#eq#0),0,@if(x(6)+x(7)#eq#2,r(12)));
Y(13)=@if(x(7)#eq#1,0.7*r(13),@if(x(7)#eq#0),0);
Y(14)=@if(x(7)#eq#1,0.7*r(14),@if(x(7)#eq#0),0);
Y(15)=@if(x(6)+x(7)#eq#1,0.7*r(15),@if(x(6)+x(7)#eq#0),0,@if(x(6)+x(7)#eq#2,r(15)));
@for(position(i):@bin(x));
@sum(position(i):x(i)*f(i))<=50;
输入结果如下
LINGO分段函数怎么求!sets:position/1..7/:x,f;society/1..15/:r,Y;endsetsdata:r=2 14 3 6 9 4 8 12 10 11 6 14 9 3 6;f=9 6.5 20 14.5 19 13 10.5;enddatamax=@sum(society(i):y(i));Y(1)=@if(x(1)#eq#1,0.7*r(1),0);Y(2)=@if((x(1)+x(2))#le#0,0,@if((x(1)+x(
去掉指的那个右括号就行了