2016-06-16 3 views
1

私はif文が必要なGAMSコードを持っています。私はドルの状態について読んだことがあり、私はそれが私を助けることができると思った。 GAMS user guideを読むと、それは言う:GAMSドルで変数を使用する

The Dollar Condition

This section introduces the dollar operator , which is one of the most powerful features of GAMS. The dollar operator operates with a logical condition. The term $(condition) can be read as 'such that condition is valid' where condition is a logical condition.

Attention: The dollar logical conditions cannot contain variables. Variable attributes (like .l and .m) are permitted however.

The dollar operator is used to model conditional assignments, expressions, and equations. The following subsection provides an example that will clarify its use. The next section will deal individually with the topic of using dollar conditions to model conditional assignments, expressions, and equations respectively.

私は私のコードでそれをしようと試みてきたが、それでも私はいつも同じエラーが見つかりました:

*** Error 53 in C:\route\Filename.gms

Endogenous $ operation not allowed

これは私の実際のコードです:

ACUMULADO_FIN_GRUPOS(k,l,t).. 

GA(k,l,t)$(GA(k,l,t) GE GT(k,l)) =E= 0 ; 

(変数の値を別の変数より大きいか等しい場合は、変数の値を0に変更したい)。私はまた、.L属性にしようと試みています

ACUMULADO_FIN_GRUPOS(k,l,t).. 

GA(k,l,t)$(GA(k,l,t).l GE GT(k,l).l) =E= 0 ; 

が、その後、次のエラーが(ちょうど.L定義で)表示されます

*** Error 8 in C:\route\Filename.gms

')' expected

をしてください、誰でも助けることができますか?

ありがとうございます!

答えて

0

私は私の以前のコードが正しくなかったことを見てきた、正しい方法は次のとおりです。.l設定して、以前の定義と

ACUMULADO_FIN_GRUPOS(k,l,t).. 

GA(k,l,t)$(GA.l(k,l,t) GE GT.l(k,l)) =E= 0 ; 

関連する問題