Hi,
let me give you a small example out of sched_cumul example:
In the original example, you get workerUsage
Now suppose some workers are not available for some time:
You would write
tuple extraWorker
{
int s;
int e;
int quantity;
}
{extraWorker} extraWorkers={<0,100,1>,<200,300,2>};
and later change
workersUsage <= NbWorkers;
into
workersUsage +sum(ew in extraWorkers) pulse(ew.s,ew.e,ew.quantity)<= NbWorkers;
and then the display for workerUsage would be
regards
NB:
The new .mod is
using CP;
int NbWorkers = ...;
tuple extraWorker
{
int s;
int e;
int quantity;
}
{extraWorker} extraWorkers={<0,100,1>,<200,300,2>};
int NbHouses = ...;
range Houses = 1..NbHouses;
{string} TaskNames = ...;
int Duration [t in TaskNames] = ...;
tuple Precedence {
string pre;
string post;
};
{Precedence} Precedences = ...;
int ReleaseDate[Houses] = ...;
dvar interval itvs[h in Houses][t in TaskNames] in ReleaseDate[h]..(maxint div 2)-1 size Duration[t];
cumulFunction workersUsage =
sum(h in Houses, t in TaskNames) pulse(itvs[h][t],1);
cumulFunction cash =
sum (p in 0..5) step(60*p, 30000)
- sum(h in Houses, t in TaskNames) stepAtStart(itvs[h][t], 200*Duration[t]);
execute {
cp.param.FailLimit = 10000;
}
minimize max(h in Houses) endOf(itvs[h]["moving"]);
subject to {
forall(h in Houses)
forall(p in Precedences)
endBeforeStart(itvs[h][p.pre], itvs[h][p.post]);
workersUsage +sum(ew in extraWorkers) pulse(ew.s,ew.e,ew.quantity)<= NbWorkers;
cash >= 0;
}
#DecisionOptimization