top of page
Search
ndelesinom1976

[Extra Speed] Islik



For constraint streams and Drools score calculation,Planner needs to extract the problem fact instances from the solution instance.It gets those collection(s) by calling every method (or field) that is annotated with @ProblemFactCollectionProperty.All objects returned by those methods will be inserted into the ConstrainStreams or Drools session,so the constraint steams or score rules can access them.For example in NQueens all Column and Row instances are problem facts.


After solving a problem, the Solver will log the score calculation speed per second.This is a good measurement of Score calculation performance,despite that it is affected by non score calculation execution time.It depends on the problem scale of the problem dataset.Normally, even for high scale problems, it is higher than 1000, except if you are using an EasyScoreCalculator.




[Extra speed] Islik



When improving your score calculation, focus on maximizing the score calculation speed, instead of maximizing the best score.A big improvement in score calculation can sometimes yield little or no best score improvement, for example when the algorithm is stuck in a local or global optima.If you are watching the calculation speed instead, score calculation improvements are far more visible.


Not all score constraints have the same performance cost.Sometimes one score constraint can kill the score calculation performance outright.Use the Benchmarker to do a one minute run and check what happens to the score calculation speed if you comment out all but one of the score constraints.


For comparison: the minimal number of atoms in the known universe (10^80). As a planning problem gets bigger, the search space tends to blow up really fast.Adding only one extra planning entity or planning value can heavily multiply the running time of some algorithms.


A rule engine, such as Drools Expert, is great for calculating the score of a solution of a planning problem. It makes it easy and scalable to add additional soft or hard constraints such as, "a teacher should not teach more then seven hours a day". It does delta-based score calculation without any extra code. However it tends to be not suitable to actually find new solutions.


It is counter-effective to set a moveThreadCountthat is higher than the number of available CPU cores,as that will slow down the score calculation speed.One good reason to do it anyway, is to reproduce a bug of a high-end production machine.


To lower verbosity, the common parts of multiple elements are extracted to the element.Every property can still be overwritten per element.Note that inherited solver phases such as or are not overwrittenbut instead are added to the tail of the solver phases list.


Useful for comparing different score calculators and/or score rule implementations (presuming that the solver configurations do not differ otherwise). Also useful to measure the scalability cost of an extra constraint.


It often represents an extra field in a class, alongside the LocalDateTime field from which it was calculated. The LocalDateTime is used for user visualization, but the int is used in the score constraints.


For Constraint Streams and Drools score calculation (Deprecated),OptaPlanner needs to extract the problem fact instances from the solution instance.It gets those collection(s) by calling every method (or field) that is annotated with @ProblemFactCollectionProperty.All objects returned by those methods are available to use by Constraint Streams or Drools rules.For example in NQueens all Column and Row instances are problem facts.


A Solver should only be accessed from a single thread, except for the methods that are specifically documented in javadoc as being thread-safe.The solve() method hogs the current thread.This can cause HTTP timeouts for REST services and it requires extra code to solve multiple datasets in parallel.To avoid such issues, use a SolverManager instead.


A rule engine, such as Drools, is great for calculating the score of a solution of a planning problem.It makes it easy and scalable to add additional soft or hard constraints.It does incremental score calculation (deltas) without any extra code.However it tends to be not suitable to actually find new solutions. 2ff7e9595c


1 view0 comments

Recent Posts

See All

Kommentare


bottom of page