Originally posted by: SystemAdmin
[Didier Vidal said:]
Yes, to see the examples of detailed scheduling, you should download the trial version of OPL 6.0 .
For your convenience, here is an example that we comments in our Web Seminars of ILOG CP Optimizer 2.0 to introduce the modeling framework for scheduling.
/* ------------------------------------------------------------
Problem Description
-------------------
This is a problem of building five houses in different locations. The
masonry, roofing, painting, etc. must be scheduled. Some tasks must
necessarily take place before others and these requirements are
expressed through precedence constraints.
There are three workers, and each task requires a worker. There is
also a cash budget which starts with a given balance. Each task costs
a given amount of cash per day which must be available at the start of
the task. A cash payment is received periodically. The objective is
to minimize the overall completion date.
------------------------------------------------------------ */
using CP;
int NbWorkers = ...;
int NbHouses = ...;
range Houses = 1..NbHouses;
{string} TaskNames = ...;
int Duration [t in TaskNames] = ...;
tuple Precedence {
string before;
string after;
};
{Precedence} Precedences = ...;
int ReleaseDate[Houses] = ...;
dvar interval itvs[h in Houses][t in TaskNames] in ReleaseDate[h]..maxint 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;
}
dexpr int totalDuration = max(h in Houses) endOf(itvs[h]["moving"]);
minimize totalDuration;
subject to {
forall(h in Houses)
forall(p in Precedences)
endBeforeStart(itvs[h][p.before], itvs[h][p.after]);
workersUsage <= NbWorkers;<br />
cash >= 0;
}
#CPOptimizer#DecisionOptimization