Replies: 8 comments 6 replies
-
Here is an example output : 2025-05-05 18:00:25,151 - timefold.solver - INFO - Solving started: time spent (899), best score (0hard/-223soft), environment mode (PHASE_ASSERT), move thread count (NONE), random (JDK with seed 0). First fit produces a solution with 26 bins. |
Beta Was this translation helpful? Give feedback.
-
Hello @xavierXV3, and welcome to the fold! When you say "The algorithm struggles to decrease the number of bins." - what results would you prefer? I see in your log a decrease from 223 to 109, which is considerable. Although, not knowing your data set, you can probably see a better solution on your own, and are wondering how come the solver is not seeing it too. Unfortunately, this is where the real problem comes in. Your move evaluation speed is 82, where we typically see numbers three orders of magnitude better. This means the solver barely explored any of the search space, and that also explains why it's not finding better solutions - it simply hasn't seen many solutions at all. Why would it be so incredibly slow? Looking at your constraints, I don't think it's that. Which leaves me with another option - that you've run into some strange corner case where our Python wrapper around the Java solver just struggles. I don't have an answer for you why that would be at the moment, just that it is very likely on our side, not yours. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. I used VirtualBox and my company laptop which is not the fastest computer around. I will try tomorow on an EC2 instance.
Kind regards
|
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. We will try with Java. |
Beta Was this translation helpful? Give feedback.
-
Regarding the model, I added a soft constraint penalizing bins with low filling, and enabled pillar moves, and the quality of the solution is much much better. It comes closer to the one of simple state-of-the-art heuristics. I will make a benchmark next week. |
Beta Was this translation helpful? Give feedback.
-
Hi, It's possible that the use of NumPy in certain parts of the constraint logic may interfere with Timefold's internal optimizations. Specifically, relying on NumPy structures might prevent some performance enhancements, such as Java-level inlining or native constraint stream acceleration. I tried using more "native" Python structures (like plain lists), and it improved performance, allowing Timefold to better leverage its execution engine. |
Beta Was this translation helpful? Give feedback.
-
I filed a tracking issue: Thank you for bringing this to our attention! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Here is a naive implementation of a vector (2D) bin packing solver.
The initial solution has one bin for each item (just to test).
The algorithm struggles to decrease the number of bins. I realized that the soft score doesn't provide much information about the progress toward a solution with one less bin.
How to model it properly with Timefold?
Kind regards
Beta Was this translation helpful? Give feedback.
All reactions