Dear staff,

I would like to receive some help writing the following constraint for a mathematical model.

Within a graph, I define arcs (i-j) where “i” and “j” are nodes. For each arc and node, I also have the following variables and parameters:

p(i) binary variable

p(j) binary variable

a(i,j) continuous variable

C(i,j) parameter

H(i) parameter

H(j) parameter

I would like to write a constraint expressing the following conditions:

if p(i) = 1 and p(j) = 0, then a(i,j) <= C(i,j)*H(j)

if p(i) = 0 and p(j) = 1, then a(i,j) <= C(i,j)*H(i)

if p(i) = 0 and p(j) = 0, then a(i,j) <= C(i,j) * (H(i) + H(j))/2

if p(i) = 1 and p(j) = 1, then a(i,j) <= C(i,j)

If you have any suggestions on how to write the above conditions within a constraint, I will be glad.

Thank you,