lingo的@if函数用法请教
来源:学生作业帮 编辑:大师作文网作业帮 分类:数学作业 时间:2024/11/12 20:01:07
lingo的@if函数用法请教
我的LINGO程式码在@if的地方卡住了,之前@FOR函数承蒙不知明的大大指导,感激不尽,希望这次可以有大大可以帮我解答一下,万分感激,以下是程式码的部份
SETS:
SET/1..2/:PT_i,TiJ,LT_i,HC_i,X_i;
ENDSETS
DATA:
D=30; mean deman/day;
SD=3; Std.Dev./day;
PT_i=4,8; Nodei...J average production time/day;
TiJ=0,5; Nodei...J average transportation time/day;
HC_i=2,4; Nodei...J average holding cost/day;
Z=1.65; Safety Factor;
P=10; Nodei...J average penalty cost/day;
Due=12;
ENDDATA
The objective Guaranteed Serviced Tiem;
MIN=seq1+seq2+seq3;
seq1=Z*HC_i(1)*SD*(LT_i(1)-X_i(1))^.5;
seq2=Z*HC_i(2)*SD*(LT_i(2)-X_i(2))^.5;
seq3=P*@if((X_i(2)-Due>0),(X_i(2)-Due),0));
这部份我写不太出来,我希望当X_i(2)-Due>0时就以X_i(2)-Due的值运算
若X_i(2)-Due==(X_i(1)+TiJ(2))+PT_i(2);
@FOR(SET:LT_i(1)=PT_i(1));
@FOR(SET:LT_i(1)>=X_i(1));
@FOR(SET:LT_i(2)>=X_i(2));
@FOR(SET:@GIN(X_i));
END
感谢大大的快速回应,但是我执行程式后,lingo告诉我在最后END的地方有错,Missing right parenthesis,可以请大大再帮我看看吗?真的很感谢您
我的LINGO程式码在@if的地方卡住了,之前@FOR函数承蒙不知明的大大指导,感激不尽,希望这次可以有大大可以帮我解答一下,万分感激,以下是程式码的部份
SETS:
SET/1..2/:PT_i,TiJ,LT_i,HC_i,X_i;
ENDSETS
DATA:
D=30; mean deman/day;
SD=3; Std.Dev./day;
PT_i=4,8; Nodei...J average production time/day;
TiJ=0,5; Nodei...J average transportation time/day;
HC_i=2,4; Nodei...J average holding cost/day;
Z=1.65; Safety Factor;
P=10; Nodei...J average penalty cost/day;
Due=12;
ENDDATA
The objective Guaranteed Serviced Tiem;
MIN=seq1+seq2+seq3;
seq1=Z*HC_i(1)*SD*(LT_i(1)-X_i(1))^.5;
seq2=Z*HC_i(2)*SD*(LT_i(2)-X_i(2))^.5;
seq3=P*@if((X_i(2)-Due>0),(X_i(2)-Due),0));
这部份我写不太出来,我希望当X_i(2)-Due>0时就以X_i(2)-Due的值运算
若X_i(2)-Due==(X_i(1)+TiJ(2))+PT_i(2);
@FOR(SET:LT_i(1)=PT_i(1));
@FOR(SET:LT_i(1)>=X_i(1));
@FOR(SET:LT_i(2)>=X_i(2));
@FOR(SET:@GIN(X_i));
END
感谢大大的快速回应,但是我执行程式后,lingo告诉我在最后END的地方有错,Missing right parenthesis,可以请大大再帮我看看吗?真的很感谢您
seq3=P*@if((X_i(2)-Due#gt#0),(X_i(2)-Due),0);
改成这样就行了 逻辑判断不能用
改成这样就行了 逻辑判断不能用