Compilation validation
ModelBuilder.compile() returns a validation field alongside the solver request:
canSolve flag is false when there are structural errors, for example coverage requirements that reference roles no employee has.
Post-solve validation
After solving,parseSolverResponse checks the actual assignments against the original rules and coverage:
Validation structure
TheScheduleValidation object contains three categories:
Coverage validation
Checks whether coverage requirements were met:- Passed: the required number of employees was assigned
- Violation: fewer employees than required (but not zero)
- Error: no employees assigned at all
Rule validation
Checks whether scheduling rules were satisfied:- Passed: rule was fully satisfied
- Violation: soft rule was violated (the solver traded it off against other constraints)
- Error: mandatory rule was violated (should not happen with a valid solution)
Solver errors
Issues from the solver itself: timeouts, infeasibility, etc.Summarizing validation
UsesummarizeValidation to get a human-readable summary:
ValidationReporter
For programmatic access during compilation, theValidationReporter interface lets rules report issues as they compile:
ValidationReporterImpl class collects these reports and produces the final ScheduleValidation object.