Sum of a decision variable within an equation

Problems with modeling
Post Reply
MES
User
User
Posts: 14
Joined: 4 years ago

Sum of a decision variable within an equation

Post by MES »

I need the number of z(s)>0 in "equation".
But z(s) is a variable and is also part in other equations of the same model.

My first idea was the following (shorter version):

Code: Select all

Equation     ..      sum( (s)$(z(s) > 0 ) ,1)
                         	=l= card(VN);                      
But it leads to an error:
57 VAR operands relational or boolean

Is it possible to solve this without introducing a binary variable?
snigdh
User
User
Posts: 2
Joined: 4 years ago

Re: Sum of a decision variable within an equation

Post by snigdh »

Hi MES,

Can you please share the solution to your question, in case you have found it.

Best regards,
Snigdh
MES
User
User
Posts: 14
Joined: 4 years ago

Re: Sum of a decision variable within an equation

Post by MES »

I decided to use a binary variable instead, because I couldn't find another solution.


z(s)=sum(zue, bV(s,zue) * zue(s))
with bV(s)=1 if zue has a value, bV(s)=0 else
and with zue > 0, which presents the value


therefore the sum in the equation is

Code: Select all

sum(s, bV(s));
Post Reply