如何在lingo中让程序从某一初值开始运算

来源:百度知道 编辑:UC知道 时间:2024/05/07 18:36:18
sets:
destination/1..15/:NEED,L,R;
ENDSETS
MIN=@sum(destination(I):R(I)*(R(I)+1)+L(I)*(L(I)+1));
!(NEED(1)+NEED(2)+NEED(3)+NEED(4)+NEED(5)+NEED(6)+NEED(7)+NEED(8)+NEED(9)+NEED(10)+NEED(11)+NEED(12)+NEED(13)+NEED(14)+NEED(15))=5171;

@SUM(destination(I):NEED(I))=5171;
!@GIN(destination:NEED(I));
!L(1)+R(1)=NEED(1);
L(2)+R(2)=NEED(2);
L(3)+R(3)=NEED(3);
!L(4)+R(4)=NEED(4);
L(5)+R(5)=NEED(5);
L(6)+R(6)=NEED(6);
L(7)+R(7)=NEED(7);
L(8)+R(8)=NEED(8);
L(9)+R(9)=NEED(9);
L(10)+R(10)=NEED(10);
L(11)+R(11)=NEED(11);
L(12)+R(12)=NEED(12);
L(13)+R(13)=NEED(13);
L(14)+R(14)=NEED(14);
L(15)+R(15)=NEED(15);

NEED(1)=0;
NEED(4)=0;
NEED(2)<=405;
NEED(3)<=1056;
NEED(5)<=800;
NEED(6)<=399;
NEED(7)<=405;
NEED(8)<=881;
NEED(9)<=1160;
NEED(10)<=780;
NEED(11)<=550;
NEED(12)<=430;
NEED(13)<=630;

可以的,lingo中init可以设置迭代计算的起点,如果找到一个好的初始起点,,可以大幅度提高计算效率。定义方法:
init:
a=;
b=;
...
endinit

是要给定初始值来减少运算时间吗
这样写就行了
init:
!初始值;
endinit