Loading solver…
Problem: schedule dependent project activities as early as possible without exceeding the shared crew capacity.
Investment buys the least costly crew capacity for two tasks due at time 2. Consumer/producer tracks stock from a production event and a consumption event at least two time units later.
Uses the executor and worker count selected above.
Run the solver to view the solution.
import { RcpspModelBuilder } from 'or-tools-wasm/rcpsp';
const project = new RcpspModelBuilder('house_project')
.addResource({ name: 'crew', capacity: 3 })
.addActivity({ name: 'site', duration: 3, demands: { crew: 2 }, successors: ['frame'] })
.addActivity({ name: 'permit', duration: 2, demands: { crew: 1 }, successors: ['wire'] })
.addActivity({ name: 'frame', duration: 4, demands: { crew: 2 }, successors: ['inspect'] })
.addActivity({ name: 'wire', duration: 2, demands: { crew: 1 }, successors: ['inspect'] })
.addActivity({ name: 'inspect', duration: 1, demands: { crew: 1 } })
.build();
const result = await project.solve({
numWorkers: 4,
maxTimeInSeconds: 5,
executor: 'worker',
});
console.log(result.statusName, result.makespan, result.tasks);