Hi,
I have been working on a specific vehicle routing problem with chained domain model in Optaplanner. Previously I used easy score calculator to represent the constraints, before switching recently to Constriant Provider implementation.
However, I have come accross certain performance issues since then. I also have some comparisons for Spring based and standalone java implementations, which shows entity initialization is slower in Spring applications.
For info, constraints include minimizing total travel distance (soft) and minimizing arrival delay at a customer (medium).
- Initialization takes time with constraint provider:

- With constaint provider solution: For a dataset of size 300 entities
(customers) and 6 Vehicles, construction heuristics takes nearly 300
seconds in standalone java app,(whereas in Spring application,
initialization could happen only for 200 Entities till timeout of
300seconds). Please check profiler result in the attached picture.
- With easy score calculator: Same dataset takes 177 seconds in standalone app.
- Another issue observed while using constraint provider: Out of memory error: Java out of heap space
after running the application for 4-5 hours. This is a case of real time
planning with entities (customers here) that are added and removed in realtime when
they are served. At a particular time instant, there are around 50 customers
and 20 vehicles, which states that the problem size is not the reason
of running out of heap space.
The same application could run with easy score calculator flawlessly for 8 hours untill it was stopped.
When I let the application run, Heap histogram shows few drools classes as the top consumers of memory (as in picture). The first two pictures added here show memory consumption by objects over a difference of an hour, meaning the consumption doubled in an hour. This escalates the problem and jvm runs out of memory within few hours. After I refactored the constraint implementation (removing redundant filter statements and so on), I still get heap memory issue and in this case third picture provides more details on the retained size by ConcurrentHashMap in constraint streams.



Has anybody encountered such issues or know how to resolve them? Any help is greatly appreciated.
Thanks and with kind regards,
Mayur