This release improves the implementations of the common search algorithms and fixes some errors found in the underlying solvers such as Constrainer.
Optimization Strategies. Now the default optimization strategy for all solvers is the common search strategy defined as “OptimizationStrategy.BASIC” which was improved and now shows better performance to compare with some native search methods.
Previously the default JSR331 used the optimization strategy “OptimizationStrategy.NATIVE” which invokes an implementation of the Solver’s method “findOptimalSolution” defined in the underlying solver. Another available optimization strategy is “OptimizationStrategy.DICHOTOMIZE“, but it is available only for solvers inherited from the base class SolverWithGoals. Currently, this strategy can be used only with Constrainer. An optimization strategy can be set by calling the Solver’s method setOptimizationStrategy(OptimizationStrategy strategy).
Setting Search Limits. JSR331 provides interfaces to limits optimal search when it runs for a long time. These limits can be set up using the following Solver’s methods:
| setMaxNumberOfSolutions(int maxNumber) | Solver’s method “findOptimalSolution” and “findAllSolutions” will be interrupted after they find “maxNumber” of solutions |
| setTimeLimit(int timeLimitPerSolution) | Solver’s method “findOptimalSolution” and “findAllSolutions” will be interrupted after they search of the next solution reaches “timeLimitPerSolution” seconds. The latest found solution will be used as an optimal |
| setTimeLimitGlobal(int timeLimitGlobal) | Solver’s method “findOptimalSolution” and “findAllSolutions” will be interrupted after they search of the all solutions reaches “timeLimitPerSolution” seconds. The latest found solution will be used as an optimal. |
These limits were defined in the JSR331 interface from the very beginning. However, previously, not all solvers supported these limits or did it incorrectly in some cases. Now, the default optimization strategy “OptimizationStrategy.BASIC” works fine with these limits. It allows a higher level tools that use JSR331 (such as http://RuleSolver.com) to use these limits to set up a practical compromise between available time and the quality of the found solutions.
The updated version 2.3.0 is now available from the Maven Repository and GitHub.

