chore: add mixed model#823
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a mixed planning model by promoting Operator to a planning entity, updating Line to use an Operator variable, and wiring this through the constraints, data generator, tests, and UI.
- Add a new
Operatorplanning entity and include it in the scheduling domain. - Refactor
Lineto useOperatorinstead of a raw string and update the constraint provider accordingly. - Update tests and the web UI to display unassigned operators alongside jobs.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
FoodPackagingConstraintProviderTest.java |
Updated tests to construct Line with Operator. |
index.html |
Added “Unassigned Operators” section. |
app.js |
Populated unassigned operators display. |
FoodPackagingConstraintProvider.java |
Refactored operatorCleaningConflict to use jobs via Line. |
PackagingSchedule.java |
Added operators list as planning entities/value range. |
Operator.java |
Introduced new planning entity for operators. |
Line.java |
Changed operator field from String to Operator. |
Job.java |
Added getLineOperator() and overlap-duration helper. |
DemoDataGenerator.java |
Wired operators into demo data and switched to constructor injection/var. |
Comments suppressed due to low confidence (4)
java/food-packaging/src/main/java/org/acme/foodpackaging/bootstrap/DemoDataGenerator.java:19
- The code uses
TemporalAdjustersandLocalTimebut neitherjava.time.temporal.TemporalAdjustersnorjava.time.LocalTimeis imported, which will cause a compilation error. Add those imports.
import java.time.LocalDateTime;
java/food-packaging/src/main/java/org/acme/foodpackaging/domain/PackagingSchedule.java:24
- The
@ValueRangeProviderannotation should include an explicitid(e.g.@ValueRangeProvider(id = "operatorRange")) so that the@PlanningVariableonLine.operatorcan reference it unambiguously.
@ValueRangeProvider
java/food-packaging/src/main/resources/META-INF/resources/app.js:93
- The
unassignedJobsCountvariable is initialized but never incremented, causing the ‘no unassigned jobs’ message to always appear. Either increment this counter when rendering unassigned jobs or remove the variable and conditional.
var unassignedJobsCount = 0;
java/food-packaging/src/main/java/org/acme/foodpackaging/domain/Job.java:205
- [nitpick] Consider adding a unit test for
getCleanupProductionDurationDiff(...)to verify correct overlap duration calculations, especially edge cases where jobs do not overlap.
public Duration getCleanupProductionDurationDiff(Job otherJob) {
|
The failure is due to the use of the main branch, which has not been updated yet. |
triceo
left a comment
There was a problem hiding this comment.
LGTM when comments resolved.
|
There's a failing test now. |
Description of the change
This PR updates the food packaging model to utilize the mixed model. The proposed changes introduce a new planning entity,
operator, and update the entity,line, to use it. The current implementation already defines an operator field, which consists of static input data, and it has been converted into a basic variable.The constraints already utilize the
operatorfield to penalize overlapping cleaning/production actions between jobs. The related constraint was modified to use theLinemodel instead of theJobto prevent score corruption. It is important to note that changing the basic variableoperatorof alinedoes not trigger the recalculation ofoperatorCleaningConflictsince theJobwouldn't be updated.Checklist
Development
Code Review