jmitchell / backtrex

Backtracking behaviour to solve discrete problems by brute force
Other
26 stars 2 forks source link

Optimization tips guide for Backtrex users #7

Open jmitchell opened 7 years ago

jmitchell commented 7 years ago

While working on #5, #6, and #3 we're likely to find bottlenecks in the examples. As they're discovered, make note of them in an ongoing experience report. Periodically distill these findings into a guide for Backtrex users wanting to optimize their callbacks.

jmitchell commented 7 years ago

A general optimization strategy is to prioritize the order in which unknowns and values are returned by the callbacks. For example, in Sudoku ordering the blank cells randomly would generally perform worse than prioritizing cells with the most constraints imposed by its row, column, and sector. Similarly, prioritizing the least common values in the current cell's row, column, and sector (or even the entire grid) is likely better than the current 1..9 approach.

jmitchell commented 7 years ago

Finish #12 (Generate profiling reports) first.