Skip to content

chore: add mixed model#823

Merged
triceo merged 5 commits into
TimefoldAI:developmentfrom
zepfred:feat/mixed-model
Jun 16, 2025
Merged

chore: add mixed model#823
triceo merged 5 commits into
TimefoldAI:developmentfrom
zepfred:feat/mixed-model

Conversation

@zepfred

@zepfred zepfred commented Jun 11, 2025

Copy link
Copy Markdown
Contributor

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 operator field to penalize overlapping cleaning/production actions between jobs. The related constraint was modified to use the Line model instead of the Job to prevent score corruption. It is important to note that changing the basic variable operator of a line does not trigger the recalculation of operatorCleaningConflict since the Job wouldn't be updated.

Screenshot 2025-06-11 at 17 27 55

Checklist

Development

  • The changes have been covered with tests, if necessary.
  • You have a green build, with the exception of the flaky tests.
  • UI and JS files are fully tested, the user interface works for all modules affected by your changes (e.g., solve and analyze buttons).
  • The network calls work for all modules affected by your changes (e.g., solving a problem).
  • The console messages are validated for all modules affected by your changes.

Code Review

  • This pull request includes an explanatory title and description.
  • The GitHub issue is linked.
  • At least one other engineer has approved the changes.
  • After PR is merged, inform the reporter.

@zepfred zepfred changed the base branch from stable to development June 11, 2025 20:47
@triceo triceo requested a review from Copilot June 12, 2025 11:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Operator planning entity and include it in the scheduling domain.
  • Refactor Line to use Operator instead 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 TemporalAdjusters and LocalTime but neither java.time.temporal.TemporalAdjusters nor java.time.LocalTime is 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 @ValueRangeProvider annotation should include an explicit id (e.g. @ValueRangeProvider(id = "operatorRange")) so that the @PlanningVariable on Line.operator can reference it unambiguously.
@ValueRangeProvider

java/food-packaging/src/main/resources/META-INF/resources/app.js:93

  • The unassignedJobsCount variable 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) {

@zepfred zepfred marked this pull request as ready for review June 12, 2025 17:29
@zepfred

zepfred commented Jun 12, 2025

Copy link
Copy Markdown
Contributor Author

The failure is due to the use of the main branch, which has not been updated yet.

@triceo triceo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO needs simplifying.

@zepfred zepfred requested a review from triceo June 13, 2025 12:30
triceo
triceo previously approved these changes Jun 16, 2025

@triceo triceo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM when comments resolved.

@triceo

triceo commented Jun 16, 2025

Copy link
Copy Markdown
Collaborator

There's a failing test now.

@triceo triceo merged commit 2cb22ec into TimefoldAI:development Jun 16, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants