0

We are currently trying to improve the performance of a planning problem we've implemented in OptaPlanner. Our model has ~45,000 chained variables and after profiling the application it seems like the main bottleneck is around the cloning. Approximately 90% of the CPU run-time is consumed by the FieldAccessingSolutionCloner method calls.

We've already tried to make our object model more lightweight by reducing the number of Maps and Sets within the PlanningEntities, changing fields to primitives where possible, but from your own OptaPlanner experience have you any advice about how speed up cloning performance?

Alastair
  • 1,669
  • 3
  • 14
  • 27
  • Partially duplicated by [this mailing list question](https://groups.google.com/forum/#!topic/optaplanner-dev/zBAc2Bz1eAQ) – Geoffrey De Smet Nov 13 '15 at 14:49
  • Yes, my colleague was looking for potential solutions too. We ended up doing the custom cloner which has made a massive difference. – Alastair Nov 18 '15 at 14:37
  • 1
    Incremental solution cloning idea https://issues.jboss.org/browse/PLANNER-818 https://stackoverflow.com/questions/44170732/solution-cloning-happening-at-steps-that-produce-a-new-best-score-in-a-row – Jordan Jordanovski Jun 12 '17 at 21:12

1 Answers1

2

Have you tried writing a custom cloner? See docs. The default one needs to rely on reflection, so it's slower.

Also, the structure of your domain model influences how much you need to clone (regardless if you go custom or not): If you delete your Solution and Planning Entities classes, do your other domain classes still compile? If yes, then the clone is minimal. If no, it's not.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120