Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution cloning breaks a native compilation when @DeepPlanningClone is on an interface #1208

Closed
rsynek opened this issue Nov 13, 2024 · 0 comments · Fixed by #1237
Closed
Assignees
Labels
bug Something isn't working component/cloning
Milestone

Comments

@rsynek
Copy link
Contributor

rsynek commented Nov 13, 2024

Describe the bug
Native compilation fails due to a complex solution cloning.

Error: Discovered unresolved method during parsing: ai.timefold.model.fieldservicerouting.solver.domain.SolverVehicleRoutePlan$Timefold$SolutionCloner.$cloneai_timefold_model_fieldservicerouting_solver_domain_SolverVisitable(ai.timefold.model.fieldservicerouting.solver.domain.SolverVisitable, java.util.Map). This error is reported at image build time because class ai.timefold.model.fieldservicerouting.solver.domain.SolverVehicleRoutePlan$Timefold$SolutionCloner is registered for linking at image build time by command line and command line.
Error encountered while parsing ai.timefold.model.fieldservicerouting.solver.domain.SolverVehicleRoutePlan$Timefold$SolutionCloner.$cloneai_timefold_model_fieldservicerouting_solver_domain_RouteGraph(Unknown Source) 
Parsing context:
   at ai.timefold.model.fieldservicerouting.solver.domain.SolverVehicleRoutePlan$Timefold$SolutionCloner.cloneSolutionRun(Unknown Source)
   at ai.timefold.model.fieldservicerouting.solver.domain.SolverVehicleRoutePlan$Timefold$SolutionCloner.cloneSolution(Unknown Source)
   at ai.timefold.solver.core.impl.domain.variable.listener.support.violation.SolutionTracker.cloneSolution(SolutionTracker.java:94)
   at ai.timefold.solver.core.impl.domain.variable.listener.support.violation.SolutionTracker.setAfterMoveSolution(SolutionTracker.java:66)
   at ai.timefold.solver.core.impl.score.director.AbstractScoreDirector.doAndProcessMove(AbstractScoreDirector.java:230)
   at ai.timefold.solver.core.impl.score.director.InnerScoreDirector.doAndProcessMove(InnerScoreDirector.java:143)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.VisitGroupPlacement.decideMove(VisitGroupPlacement.java:116)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.VisitGroupPlacement.findBestVisitAssignment(VisitGroupPlacement.java:88)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.VisitGroupPlacement.findBestVisitGroupAssignment(VisitGroupPlacement.java:63)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.VisitGroupPlacement.<init>(VisitGroupPlacement.java:47)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.VisitGroupRecommender.createPlacement(VisitGroupRecommender.java:23)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.VisitGroupRecommender.createPlacement(VisitGroupRecommender.java:13)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.AbstractRecommender.recommendAssignment(AbstractRecommender.java:68)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.AbstractRecommender.recommendAssignment(AbstractRecommender.java:55)
   at ai.timefold.model.fieldservicerouting.solver.recommendation.VisitRecommender.recommendAssignment(VisitRecommender.java:13)
   at ai.timefold.model.fieldservicerouting.solver.VehicleRouteRecommendationService.recommendVehicleShiftForTimeWindow(VehicleRouteRecommendationService.java:127)
   at ai.timefold.model.fieldservicerouting.solver.VehicleRouteRecommendationService.recommendTimeWindowsForVisit(VehicleRouteRecommendationService.java:103)
   at ai.timefold.model.fieldservicerouting.solver.VehicleRouteRecommendationService_ClientProxy.recommendTimeWindowsForVisit(Unknown Source)
   at ai.timefold.model.fieldservicerouting.rest.VehicleRoutePlanResource.recommendTimeWindowsForVisitWithSolvedModel(VehicleRoutePlanResource.java:52)
   at ai.timefold.orbit.generated.rest.RoutePlanInput_VehicleRoutePlanResource.recommendTimeWindowsForVisitWithSolvedModel(Unknown Source)
   at root method.(Unknown Source)

To Reproduce
https://github.com/TimefoldAI/timefold-field-service-routing/tree/fix/native-compilation

mvn clean install -Dnative -Dquickly

Environment

Timefold Solver Version or Git ref:
1.15.0

Output of java -version:
Java version: 21.0.5+11-LTS, vendor version: Mandrel-23.1.5.0-Final

Output of uname -a or ver:

Additional information

Provide any and all other information which might be relevant to the issue.

@rsynek rsynek added bug Something isn't working process/needs triage Requires initial assessment of validity, priority etc. labels Nov 13, 2024
@triceo triceo added component/cloning and removed process/needs triage Requires initial assessment of validity, priority etc. labels Nov 13, 2024
Christopher-Chianelli added a commit to Christopher-Chianelli/timefold-solver that referenced this issue Nov 29, 2024
…pPlanningCloned classes

The GizmoSolutionClonerImplementor requires a set of all
@DeepPlanningCloned classes so it can create cloners for all of them.
GizmoCloningUtils.getDeepClonedClasses incorrectly assume all
@DeepPlanningCloned classes are directly accessible from either
the @PlanningSolution class or an @PlanningEntity class. However,
a @DeepPlanningCloned class might be referenced from another
@DeepPlanningCloned class, which would not be detected.

In order to detect all @DeepPlanningCloned classes, when
a class that is @DeepPlanningCloned is found and was not
processed yet, it is added to the to process queue.

Fixes TimefoldAI#1208.
@triceo triceo added this to the 1.17.0 milestone Nov 29, 2024
triceo pushed a commit that referenced this issue Nov 29, 2024
…pPlanningCloned classes (#1237)

The `GizmoSolutionClonerImplementor` requires a set of all
`@DeepPlanningCloned` classes so it can create cloners for all of them.
`GizmoCloningUtils.getDeepClonedClasses` incorrectly assume all
`@DeepPlanningCloned classes` are directly accessible from either
the `@PlanningSolution` class or an `@PlanningEntity` class. However,
a `@DeepPlanningCloned` class might be referenced from another
`@DeepPlanningCloned` class, which would not be detected.

In order to detect all `@DeepPlanningCloned` classes, when
a class that is `@DeepPlanningCloned` is found and was not
processed yet, it is added to the to process queue.

Fixes #1208.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/cloning
Projects
None yet
3 participants