Originally posted by: SaumyaB
Hi Alex,
While trying out the suggested approach and going through the example SchedTime.java, I notice that in the function TardinessCost, two scenarios are possible, depending upon whether or not the useFunction = 0. I am not sure in which scenarios the else condition of the function is executed (line no 52) since useFunction is set to 1 in the line 89.
Any help on this is greatly appreciated. Thanks.
Code Snippet (from the example):
public static IloNumExpr TardinessCost(IloCP cp, IloIntervalVar task, int dd, double weight, int useFunction) throws IloException {
if (useFunction != 0) {
double[] arrX = {(double)dd};
double[] arrV = {0.0, weight};
IloNumToNumSegmentFunction f = cp.piecewiseLinearFunction(arrX, arrV, dd, 0.0);
return cp.endEval(task,f);
} else {
return cp.prod(weight, cp.max(0, cp.diff(cp.endOf(task), dd)));
}
}
#ConstraintProgramming-General#DecisionOptimization