Page 1 of 1

dollar condition problem

Posted: Mon Apr 29, 2019 9:09 pm
by irem
Hi,
I have to use the if statement for my model. But I get an error for this equation. Why didn't I get the error? I'd appreciate it if you could help.

Eq.. const26(m,t).. sum((i,k),A(i,m,k,t))($sum(i,d(m,t,i)) gt r(m,t)) =e= sum(i,db(m,t,i)) ;

Error:

**** const26(m,t).. sum((i,k),A(i,m,k,t))($sum(i,d(m,t,i)) gt r(m,t)) =e= sum(i,db(m,t,i)) ;
$37,409

37 '=l=' or '=e=' or '=g=' operator expected
409 Unrecognizable item - skip to find a new statement
looking for a ';' or a key word to get started again

Re: dollar condition problem

Posted: Tue Apr 30, 2019 8:19 am
by Fred
Hi,

Your parentheses do not match. You need

Code: Select all

...)$(...
instead of

Code: Select all

...)($...
.

I hope this helps!

Fred

Re: dollar condition problem

Posted: Tue Apr 30, 2019 2:45 pm
by irem
Thanks your answer. I've solved this problem, but I have another problem. I couldn't figure out how to write this equation because the variables for the following constraint cannot be written into the if statement (dollar condition). If the second index of Q is 4, I want that value to be 0 if this index is 10. How can I do it ? I'd appreciate it if you could.

const20(iprime(i),k,t).. Q(i,'4',k,t) =e= 0$(Q(i,'10',k,t) gt 0) ;