How to make a variable's supscripts equal to another variables subscripts?

Problems with modeling
Post Reply
noobie
User
User
Posts: 1
Joined: 6 years ago

How to make a variable's supscripts equal to another variables subscripts?

Post by noobie »

I have tried to add a soft constraint penalty to my objective function.

My soft constraint is this:

sum((i,j,p,t), x(i,j,p,t)-r(i,j,p,t)) =e= 6000

And then the penalty is added in my objective function like this at the end:

+ sum((i,j,p,t),penalty(p,j,i)*r(i,j,p,t))

The x variable is an amount of product that is being transported. The soft constraint is going to add a penalty cost (penalty(p,j,i) if the amount of x goes above 6000.

How do I make sure that the subscripts (i,j,p,t) are equal to the same subscripts in in the x variable which is already determined by other hard constraints?
Post Reply