LocalSolver vs Google OR-Tools on the Resource-Constrained Project Scheduling Problem (RCPSP)
In the Resource-Constrained Project Scheduling Problem (RCPSP), a project consists of a set of tasks that have to be scheduled. Each task has a given duration and cannot be interrupted. There are precedence constraints between the tasks: each task must end before any of its successors can start. There are a set of renewable resources. Each task has a given resource requirement or weight (possibly zero) on each resource, representing the amount of resource it consumes while it is being processed. Each resource has a given maximum capacity: it can process several tasks at once, but the sum of the processed tasks’ weights can never exceed this maximum capacity. The goal is to find a schedule that minimizes the makespan: the time when all tasks have been processed.
This page illustrates how LocalSolver outperforms traditional general-purpose optimization solvers on this challenging problem. Since MIP solvers like Gurobi struggle to reach feasibility on this problem, we compare LocalSolver’s performance with the CP-SAT solver of Google OR-Tools 9.5, known as a state-of-the-art Constraint Programming (CP) solver.
Input data
This benchmark focuses on large-scale instances of the Resource-Constrained Project Scheduling Problem (RCPSP). We use the RG300 instances introduced by Debels and Vanhoucke in [1]. There are 480 instances comprising 300 tasks each, representing different situations and configurations.
Mathematical models of the Resource-Constrained Project Scheduling Problem (RCPSP)
Constraint Programming (CP) model
The results reported for OR-Tools are obtained using the RCPSP example provided with the OR-Tools library. The model uses interval decision variables to represent the tasks and cumulative constraints to represent the resources.
LocalSolver model
The LocalSolver model relies on integer decisions to model the start times of the tasks. The cumulative resource constraints can be formulated as follows: for each resource, the amount consumed by the tasks being processed must never exceed the resource’s capacity. To model these constraints, we sum up, for each resource and each instant d, the weights of the tasks that start before d and end after d. To ensure that the constraint is respected at each instant, we use a variadic and
operator over the whole time horizon.
function model() {
// Integer decisions: start time of each task
start[t in 0..nbTasks-1] <- int(0, horizon);
end[t in 0..nbTasks-1] <- start[t] + duration[t];
// Precedence constraints between the tasks
for[t in 0..nbTasks-1][s in 0..nbSuccessors[t]-1] {
constraint start[successors[t][s]] >= end[t];
}
// Makespan: end of the last task
makespan <- max[t in 0..nbTasks-1] (end[t]);
// Cumulative resource constraints
for [r in 0..nbResources-1] {
constraint and(0..horizon, d =>
sum[t in 0..nbTasks-1](weight[t][r] * (start[t] <= d && end[t] > d))
<= capacity[r]);
}
// Minimize the makespan
minimize makespan;
}
Google OR-Tools and LocalSolver results on the Resource-Constrained Project Scheduling Problem (RCPSP)
We compare both solvers’ performance in 1 minute of running time, after which we measure the gap to the best known solution in %. We use LocalSolver 11.5 and the CP-SAT solver of Google OR-Tools 9.5. Both are used with default parameters. We ran them on a server equipped with an Intel i7-7700K (4 cores, 4.2 GHz, 8MB cache) and 64GB RAM.
On average, LocalSolver achieves a 2.8% gap to the best known solution, while OR-Tools only reaches an 8.1% gap.
LocalSolver | OR-Tools | |
---|---|---|
Average gap | 2.8% | 8.1% |
The table below shows the number of instances where each solver reaches a solution below a particular gap. For example, LocalSolver always finds a solution with a gap to the best known solution below 10%, but OR-Tools only does so for 59% of the instances.
LocalSolver | OR-Tools | |
---|---|---|
Gap < 20% | 100% | 97% |
Gap < 15% | 100% | 81% |
Gap < 10% | 100% | 59% |
Gap < 5% | 79% | 43% |
Gap < 2.5% | 51% | 28% |
Gap < 1% | 33% | 18% |
Conclusion
LocalSolver offers a concise and straightforward approach to the Resource-Constrained Project Scheduling Problem (RCPSP) based on integer decision variables. The resulting model provides much better solutions than OR-Tools 9.5 on large-scale instances of the RCPSP.
You can find the complete model of the Resource-Constrained Project Scheduling Problem (RCPSP) and many other scheduling problems in Python, Java, C#, and C++ in our Example Tour.
Are you interested in trying it out? Get free trial licenses here. In the meantime, feel free to contact us; we will be glad to exchange about your optimization problems.
[1] D. Debels & M. Vanhoucke (2007). A Decomposition-Based Genetic Algorithm for the Resource-Constrained Project-Scheduling Problem. Operations Research 55(3):457-469.