2016-06-16 2 views
1

if 문이 필요한 GAMS 코드가 있습니다. 나는 달러 조건에 대해 읽었으며 그것이 나를 도울 수 있다고 생각했습니다. 내 코드에서 tryed 한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.

,하지만 여전히 나는 항상 같은 오류가 발견 : GAMS user guide 읽기, 그것은 말한다

ACUMULADO_FIN_GRUPOS(k,l,t).. 

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

: 내 실제 코드는

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

Endogenous $ operation not allowed

입니다

을 (변수의 값을 다른 변수보다 크거나 같으면 변수의 값을 0으로 변경하려고합니다.) 또한 .L 속성 tryed있다 :

ACUMULADO_FIN_GRUPOS(k,l,t).. 

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

하지만 다음 오류가, 누군가가 도움을 줄 수

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

')' expected

하십시오 (단지 .L 정의)이 나타납니다?

미리 감사드립니다.

답변

0

내 앞의 코드가 올바르지 않은 것을 보았다, 올바른 방법은 다음과 같습니다 .l 설정 이전 정의와

ACUMULADO_FIN_GRUPOS(k,l,t).. 

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

.