Originally posted by: Philippe_Refalo
You need to sum up the variables in an expression using a for loop:
for(IloInt r = 0; r < fij.getSize(); r++){
IloExpr sr = IloSum(fij[r]); // sr the sum expression of variables in array fij[r]
}
If you want to create the sum of a column, you need to loop on all the elements:
IloInt c = // column to sum
IloExpr sc(env)
for(IloInt r = 0; r < fij.getSize(); r++){
sc += fij[r][c];
}
// Here sc is the sum of variables in column c
Cheers,
Philippe
#ConstraintProgramming-General#DecisionOptimization