Skip to content

Instantly share code, notes, and snippets.

View mcimbora's full-sized avatar

Matej Čimbora mcimbora

  • Timefold
  • Prague, Czech Republic
View GitHub Profile
List<SolverInstance> getSolvers(String containerId);
SolverInstance createSolver(String containerId,
String solverId,
String configFile);
SolverInstance getSolverState(String containerId,
String solverId);
Constraint consecutiveWorkingDays(ConstraintFactory constraintFactory) {
return constraintFactory.from(Employee.class)
.joinSequence(Shift.class,
Joiners.sequenceItemIndex(Shift::getDayIndex),
Joiners.equal((employee, shift) -> Objects.equals(employee, shift.employee))
).filter((employee, sequence<shift>) -> sequence.getLength() > employee.contract.maxConsecutiveDays)
.penalizeConfigurable(MAX_CONSECUTIVE_DAYS, (employee, sequence<shift>) -> sequence.length, employee.contract.maxConsecutiveDays);
}