You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without Panache/Hibernate, it managed to solve the problem (0 hard score) during the construction heuristic phase in 12 seconds:
Generated Timeslots: 248
Generated Exams: 218
2025-05-23 16:09:37,290 INFO [ai.tim.sol.cor.imp.sol.DefaultSolver] (pool-17-thread-1) Solving started: time spent (3), best score (0hard/0soft), environment mode (PHASE_ASSERT), move thread count (NONE), random (JDK with seed 0).
2025-05-23 16:09:37,291 INFO [ai.tim.sol.cor.imp.sol.DefaultSolver] (pool-17-thread-1) Problem scale: entity count (218), variable count (436), approximate value count (260), approximate problem scale (1.786865 × 10^757).
2025-05-23 16:09:50,163 INFO [ai.tim.sol.cor.imp.con.DefaultConstructionHeuristicPhase] (pool-17-thread-1) Construction Heuristic phase (0) ended: time spent (12876), best score (0hard/-7soft), move evaluation speed (50405/sec), step total (218).
2025-05-23 16:10:37,300 INFO [ai.tim.sol.cor.imp.loc.DefaultLocalSearchPhase] (pool-17-thread-1) Local Search phase (1) ended: time spent (60012), best score (0hard/-4soft), move evaluation speed (11107/sec), step total (86153).
2025-05-23 16:10:37,302 INFO [ai.tim.sol.cor.imp.sol.DefaultSolver] (pool-17-thread-1) Solving ended: time spent (60015), best score (0hard/-4soft), move evaluation speed (19533/sec), phase total (2), environment mode (PHASE_ASSERT), move thread count (NONE).
--
Tests paused
Press [e] to edit command line args (currently ''), [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>
When Hibernate is involved, it never managed to solve the problem after the deadline has reached:
Generated Timeslots: 248
Generated Exams: 218
2025-05-23 16:12:51,067 INFO [my.bay.res.exa.SolverConsumerFactory] (pool-29-thread-1) Exam timetable job a5a68fd2-86b9-4f63-bac9-e025e698ec84 started
2025-05-23 16:12:51,067 INFO [ai.tim.sol.cor.imp.sol.DefaultSolver] (pool-27-thread-1) Solving started: time spent (2), best score (0hard/0soft), environment mode (PHASE_ASSERT), move thread count (NONE), random (JDK with seed 0).
2025-05-23 16:12:51,068 INFO [ai.tim.sol.cor.imp.sol.DefaultSolver] (pool-27-thread-1) Problem scale: entity count (218), variable count (436), approximate value count (260), approximate problem scale (1.786865 × 10^757).
2025-05-23 16:13:03,811 INFO [ai.tim.sol.cor.imp.con.DefaultConstructionHeuristicPhase] (pool-27-thread-1) Construction Heuristic phase (0) ended: time spent (12746), best score (-47hard/-6soft), move evaluation speed (50911/sec), step total (218).
2025-05-23 16:13:51,069 INFO [ai.tim.sol.cor.imp.loc.DefaultLocalSearchPhase] (pool-27-thread-1) Local Search phase (1) ended: time spent (60004), best score (-22hard/-2soft), move evaluation speed (11750/sec), step total (102234).
2025-05-23 16:13:51,069 INFO [ai.tim.sol.cor.imp.sol.DefaultSolver] (pool-27-thread-1) Solving ended: time spent (60004), best score (-22hard/-2soft), move evaluation speed (20066/sec), phase total (2), environment mode (PHASE_ASSERT), move thread count (NONE).
2025-05-23 16:13:51,071 INFO [my.bay.res.exa.SolverConsumerFactory] (pool-29-thread-1) Exam timetable job a5a68fd2-86b9-4f63-bac9-e025e698ec84 final score: -22hard/-2soft
2025-05-23 16:13:51,075 INFO [my.bay.res.exa.SolverConsumerFactory] (pool-29-thread-1) Job a5a68fd2-86b9-4f63-bac9-e025e698ec84 finished with no errors
--
Tests paused
Press [e] to edit command line args (currently ''), [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>
I increased the deadline to 5 minutes but the hard score is still negative (although a bit better) after the solver terminates.
At first I thought it was repeatedly hitting the DB, but VisualVM and JFR showed otherwise:
I'm currently at a loss here. What am I missing?
What I've Tried
Running QuarkusTransaction.joiningExisting().run(() -> { ... }) in SmallRyeManagedExecutor - no effect
What I have not tried
Use native MariaDB installation instead of Docker (will update later)
Stop using XA/JTA (I'm not sure how to change this in Quarkus)
I found this StackOverflow post where this person is trying to achieve the same thing, but I wish to just store it directly in the DB (every time the score updates) to allow the user interface to poll and display the result - is this not possible?
More Info
Quarkus Version: 3.21.3
Timefold Version: 1.22.1
Docker Image: docker.io/mariadb:10.11
Docker: 27.5.1, build 9f9e405 (using OrbStack)
OrbStack: Version: 1.10.3 (1100300) Commit: 2b5dd5f580d80a3d2494b7b40dde2ef46813cfc5 (v1.10.3)
Uname: Darwin Skynet 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000 arm64
I can provide the flight recording if that helps
The text was updated successfully, but these errors were encountered:
Hello @xputerax! Although I am not quite sure what is happening here, it is probably some JPA stuff - if I had to guess, every time the solver modifies an entity, the update is being processed by JPA. Hard to say without attaching a profiler.
There should be a way to detach the timetable from the session. That's what I'd do, and only reattach it when I need to persist it.
What I'm trying to achieve
I'm moving away from in-memory storage (using a global Map) to MariaDB for persistence
What problems I'm facing
After implementing the DB storage, the solver never manages to get the correct solution (negative hard score)
Fast code:
For the sake of simplicity, I just commented the lines where I passed the callback/consumer to the solver to bypass Hibernate.
Slow code:
ConsumerFactory.java
:JobRepository.java
:Without Panache/Hibernate, it managed to solve the problem (0 hard score) during the construction heuristic phase in 12 seconds:
When Hibernate is involved, it never managed to solve the problem after the deadline has reached:
I increased the deadline to 5 minutes but the hard score is still negative (although a bit better) after the solver terminates.
At first I thought it was repeatedly hitting the DB, but VisualVM and JFR showed otherwise:
I'm currently at a loss here. What am I missing?
What I've Tried
QuarkusTransaction.joiningExisting().run(() -> { ... })
inSmallRyeManagedExecutor
- no effectWhat I have not tried
My app config is as follows but it still uses XA:
I found this StackOverflow post where this person is trying to achieve the same thing, but I wish to just store it directly in the DB (every time the score updates) to allow the user interface to poll and display the result - is this not possible?
More Info
Quarkus Version: 3.21.3
Timefold Version: 1.22.1
Docker Image: docker.io/mariadb:10.11
Docker: 27.5.1, build 9f9e405 (using OrbStack)
OrbStack: Version: 1.10.3 (1100300) Commit: 2b5dd5f580d80a3d2494b7b40dde2ef46813cfc5 (v1.10.3)
Uname: Darwin Skynet 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000 arm64
I can provide the flight recording if that helps
The text was updated successfully, but these errors were encountered: