Replies: 1 comment 1 reply
-
Greetings @kentbill ! Without seeing your domain and constraints, I cannot give specific advice. But since only 10-60 moves are evaluated per step, I suspect you have a large cross product in the join of one of your constraints. Try using Joiners where possible, and do filtering before the join where possible. For example, constraintFactory.forEach(Visit.class)
.join(Visit.class)
.filter((a,b) -> b.getVisitType() == VisitType.PRIORITY)
.filter((a, b) -> a.getArrivalTime().isBefore(b.getArrivalTime())
.filter((a, b) -> a.getPriority() < b.getPriority())
.filter((a,b) -> Objects.equal(a.getVehicle(), b.getVehicle()) )
.penalize(HardSoftScore.ONE_HARD)
.asConstraint("...") can be rewritten as constraintFactory.forEach(Visit.class)
.join(constraintFactory.forEach(Visit.class).filter(b -> b.getVisitType() == VisitType.PRIORITY),
Joiners.lessThan(Visit::getArrivalTime),
Joiners.lessThan(Visit::getPriority),
Joiners.equal(Visit::getVehicle)
)
.penalize(HardSoftScore.ONE_HARD)
.asConstraint("...") For other performance tips, see https://docs.timefold.ai/timefold-solver/latest/constraints-and-score/performance |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a dataset to solver that uses PlanningListVariable. The number of planning entities is quite large, such as over 5000, and the CH phase getting slower and slower. The number of moves per step is about between 10 and 60. When more than 2000 steps are completed, it even takes a few seconds to complete one step. Is there any way to shorten it?
Beta Was this translation helpful? Give feedback.
All reactions