Hi all,
We developed a faster score calculation engine for OptaPlanner
called Bavet.
It is feature complete in OptaPlanner 8.27.0.Final, which is
available on Maven Central now.
According to our benchmarks, Bavet makes OptaPlanner 2.3x
faster on average,
but we'd love to know that turns out for you.
Let us know your score calculation speed before and after Bavet.
Specifically, here's how you can help us:
1. Upgrade to OptaPlanner 8.27.0.Final
2. Solve your use case for a minute.
Get the "score calculation speed" of Drools from the log:
INFO Solving ended: time spent (...),
best score (...), score calculation speed (10000/sec), ...
3. Switch the ConstraintStreamImplType to BAVET. This is a
one-line change. See below.
Solve it again for the same time.
Get the "score calculation speed" of Bavet from the log.
INFO Solving ended: time spent (...),
best score (...), score calculation speed (23000/sec), ...
Then let us know both score calculation speed numbers.
Hopefully you see the same speedup as us!
Switching to Bavet is a one-line change:
Plain java: Switch to Bavet in either your *.java
file:
SolverFactory<TimeTable> solverFactory = SolverFactory.create(new SolverConfig()
...
.withConstraintStreamImplType(ConstraintStreamImplType.BAVET)
...);
or in your solverConfig.xml
:
<scoreDirectorFactory>
...
<constraintStreamImplType>BAVET</constraintStreamImplType>
</scoreDirectorFactory>
Quarkus: Switch to Bavet in src/main/resources/application.properties
:
quarkus.optaplanner.solver.constraintStreamImplType=BAVET
Spring: Switch to Bavet in src/main/resources/application.properties
:
optaplanner.solver.constraintStreamImplType=BAVET
Note: A Red Hat support subscription will not offer support
for Bavet. Drools intends to catch up performance wise.
With kind regards,
Geoffrey De Smet
OptaPlanner lead
Mathe, this is good to know.
Thank you for reporting!
1) What's the size of your dataset?
2) Is this with 8.27.0.Final?
3) Do you have a constraint with 3+ joins?
We have 2 out of 20 use case benchmarks where we see Drools being
faster than Bavet.
We have a working theory why that is, which may or may not relate
to your usage.
I'd love to see your constraints.
For curriculumCourse in optaplanner-examples,
we're seeing pretty much the same speed numbers between Drools and
Bavet.
There will be a blog post tomorrow with more details on Bavet:
https://www.optaplanner.org/blog/
With kind regards,
Geoffrey De Smet
--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/optaplanner-dev/ed9a7bc5-5625-4ea6-a333-510c924984b0n%40googlegroups.com.
Thank you, Mathe.
Until proven otherwise, I believe this is the same performance
loss as
https://issues.redhat.com/browse/PLANNER-2787
Stay tuned for 8.28.0 in a few weeks.
With kind regards,
Geoffrey De Smet
To view this discussion on the web visit https://groups.google.com/d/msgid/optaplanner-dev/289ba319-aef5-4aa2-a26c-d8cc39e09885n%40googlegroups.com.
Here's the related blog post:
https://www.optaplanner.org/blog/2022/09/01/Bavet-a-faster-score-engine-for-OptaPlanner.html
With kind regards,
Geoffrey De Smet
We've merged a performance improvement for 8.29.0.Final (not
8.28).
It would be good to know if that helps.
With kind regards,
Geoffrey De Smet
I've identified a 2nd performance opportunity for Bavet:
https://issues.redhat.com/browse/PLANNER-2818
Your code matches the pattern for which this could make a big difference:
join(Lesson.class, Joiners.equal(Lesson::getDay),
Joiners.filtering((first, second) -> second.getHour() > first.getHourAfter()
&& !ScheduleEvaluator.getSingleton(schedule).surroundingMiddayBreak(first, second)
&& ScheduleEvaluator.getSingleton(schedule).haveSameGrade(first, second)))
So I suspect that PLANNER-2818 is the real fix.
With kind regards,
Geoffrey De Smet
Hi Marko,
Thank you for sharing :) Great numbers!
With kind regards,
Geoffrey De Smet
The information and attachments in this email are confidential and intended only for use by the individual indicated above or those authorized to receive or view them. If you received this communication in error please notify the sender immediately and permanently delete the original message and any attachments without making a copy. Unauthorized use or copying of information received in error is prohibited and unlawful. --
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/optaplanner-dev/5a526728-3fb6-4abd-994a-992addc76748n%40googlegroups.com.
1- Using 8.29.0.Final, on a problem similar to Cloud Balancing (bin packing), with Bavet I get score calculation speed = 134530/sec, while without it (with Drools via ConstraintStreams API), score calculation speed = 79616/sec.
2- However in above setup, a known earlier bug is seen in Multi-threaded mode (moveThreadCount enabled with AUTO) in that search terminates earlier than allocated time or reaching mentioned bestScoreLimit (0/0).The error received is: "No doable selected move at step index (xxx), time spent (xxxx). Terminating phase early"There is a stackoverflow page that mentions this bug (reported in a different context) will be fixed in 8.30.Final release.
3- Finally, on 8.11.1.Final, using Bavet in a real-time planning scenario (implemented using OptaPlanner GUI Framework), an IllegalStateException is thrown when the ProblemFactChange.doChange() method is triggered.
Lukáš Petrovický
OptaPlanner Project Lead