There are three process units that can transfer mass among each other. I am using two indices i
in I and j
in J to denote the flow between the three units and the values for flow from unit i
to unit j
is given by the decision variable supply[I][J]
. So, the supply from unit 1 to unit 2 is given by supply[1][2]
. Conversely, the mass obtained by unit 2 from 1 is given by supply[1][2]
. So, to estimate the total mass leaving unit i
, I need to sum supply[I][J]
over j
whereas to estimate the total mass entering a unit i
, I need to sum supply[I][J]
over i
.
Also each unit can take supply from an external source, defined by the decision variable inlet[I]
, and can send out an exit stream given by outlet[I]
. I am defining the following constraint to enforce that the net mass inlet is equal to the net mass outlet for any unit:
// constraint for mass balance for each unit
forall (i in I)
{
ct1: inlet[i]+sum (j in J)supply[i][j] == outlet[i]+sum(j in J)supply[j][i];
}
end
When the number of units is just three, the model works and provides results in 5 seconds, but once the number of units is increased to 30, the cplex is not able to find even a solution even after 48 hours. I'm not sure whether the constraint definition is correct or not. And also, if this is creaitng any issues in solving the cplex. Is the constraint defined above correct?