Originally posted by: gorlami
I am trying to code the expression a = b = c as a constraint in C# Cplex.
Currently, I have tried splitting the expression into two, and using the AddEq function for both.
My code thus far is as follows:
INumExpr constraint21 = model.NumExpr();
INumExpr constraint22 = model.NumExpr();
for (int k = 0; k < numberOfTrucks; k++)
{
for (int j = 0; j < numberOfNodes; j++)
{
constraint21 = model.Sum(constraint21, route[0, j, k]);
constraint22 = model.Sum(constraint22, route[j, 0, k]);
}
}
model.AddEq(numberOfTrucks, constraint21);
model.AddEq(numberOfTrucks, constraint22);
I need constraint21 = constraint22 = numberOfTrucks to be fulfilled.
This way of expressing the constraint seems problematic. Is there maybe another function that can handle the equation a=b=c directly without splitting?
Thank you
#CPLEXOptimizers#DecisionOptimization