Originally posted by: y82li
for (t = 0; t < nbPeriod; t++)
{
IloExpr totalhour (env);
for (i = 0; i < nbPart; i++)
{
totalhour += processingTime[i][t] * x[i][t] + setupTime[i][t] * y[i][t];
}
model.add(totalhour <= capacity[t]);
totalhour.end();
}
The above code is to build a capacity constraint in production planning problem. The constraint is that, for each period t, total setup time plus total processing time should be less than planned capacity for period t. Product i=1,2,...,m. t=1,2,...,n.
x[i][t] is production amount variable for product i in period t.
y[i][t] is setup variable, whtch is 1, if there is setup for product i in period t, 0 otherwise.
I got the following errors:
error C2109: subscript requires array or pointer type.
Question 1. How can fix this error?
Question 2. Can I use IloScalprod to build the expression of these constraints?
Thank you a lot!
#CPLEXOptimizers#DecisionOptimization