RCPSP - project schedule
Problem: schedule dependent project activities as early as possible without exceeding the shared crew capacity.
Show code
import {
initRcpsp,
RcpspModelBuilder,
setWorkerBridgeEnabled,
} from 'or-tools-wasm/rcpsp';
setWorkerBridgeEnabled(true);
await initRcpsp();
const project = new RcpspModelBuilder('house_project')
.add_resource({ name: 'crew', capacity: 3 })
.add_activity({ name: 'site', duration: 3, demands: { crew: 2 }, successors: ['frame'] })
.add_activity({ name: 'permit', duration: 2, demands: { crew: 1 }, successors: ['wire'] })
.add_activity({ name: 'frame', duration: 4, demands: { crew: 2 }, successors: ['inspect'] })
.add_activity({ name: 'wire', duration: 2, demands: { crew: 1 }, successors: ['inspect'] })
.add_activity({ name: 'inspect', duration: 1, demands: { crew: 1 } })
.build();
const result = await project.solve({ numWorkers: 4, maxTimeInSeconds: 5 });
console.log(result.statusName, result.makespan, result.tasks);
- Activities have durations and crew demands.
- Dependencies force some activities to finish before others can start.
- The crew resource has capacity 3 at every time step.
- The solver chooses start times that respect dependencies and crew capacity.
- The makespan is the project finish time; lower is better.
- Hover an activity card or Gantt bar to highlight the same activity and its direct dependencies.
Activities
Gantt schedule
Run the solver to view the schedule.
Solution
Run the solver to view the solution.
Status: