Part IV. OptaPlanner score calculation


Every @PlanningSolution class has a score. The score is an objective way to compare two solutions. The solution with the higher score is better. The solver aims to find the solution with the highest score out of all possible solutions. The best solution is the solution with the highest score the solver has encountered during solving, which might be the optimal solution.

OptaPlanner cannot automatically know which solution is best for your business, so you must tell it how to calculate the score of a specified @PlanningSolution instance according to your business requirements. If you forget or are unable to implement an important business constraint, the solution is probably useless, as illustrated in the following image:

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat