How can we define a constraint saying:(adsbygoogle = window.adsbygoogle || []).push({});

if b is larger than zero then y has to equal 1

if b is equal to zero then y has to equal 0

?

It concerns the following problem:

b[k] = amount of vegetable i growing on patch k

y[k] = 1 if vegetable i is grown on patch k

= 0 otherwise

So we want to say that if the amount of vegetable i on patch k is larger than zero (i.e. b[k] > 0), vegetable i must be assigned to patch k (i.e. y[k] = 1)

I was thinking that it could be something like that:

for all i

sum(k) b[k]*y[k] = b[k]

But I don't know if this is correct or not, since you could cancel out both terms b[k]

What do you guys think?

Kind regards,

Alex

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# If-then-else construction

**Physics Forums | Science Articles, Homework Help, Discussion**