Hinting vs search strategy

49 views
Skip to first unread message

Kyle Booth

unread,
Apr 20, 2026, 7:13:59 PM (4 days ago) Apr 20
to or-tools-discuss
Let's say I have a very hard to satisfy CSP, but I know for a fact that the majority of solutions have some var x = 1, but it is not necessarily guaranteed to be the case.

What is the most effective way to express this "assignment preference" in the solver? Using Hints or as a search strategy? Curious to hear anyone's experiences with this sort of thing - thanks!

Kyle

Kyle Booth

unread,
Apr 20, 2026, 8:30:18 PM (4 days ago) Apr 20
to or-tools-discuss
I have tried various experiments using each, but the stochastic nature of the solver makes it difficult to determine if something "works" (put another way, nothing I have tried has had a big enough impact to be noticeable). Some more specific questions:
  • If I provide Hints for a small subset of my formulation (~5-10% of the variables) does the solver use this information?
  • Will the solver violate some hints while preserving others? Any insight into how Hints are utilized would be helpful.
  • If I use a decision strategy, but do not use cp_model.FIXED_SEARCH, does the solver follow my decision strategy at all? 

grego...@gmail.com

unread,
Apr 21, 2026, 4:41:55 PM (3 days ago) Apr 21
to or-tools-discuss

Hints are primarily used to help the solver find an initial feasible solution. In the search log, it is possible to see whether the first solution was obtained using hints or found independently. Hints are typically applied only for a limited time; if they do not provide benefit, the solver will eventually ignore them.

To properly evaluate their effect, it is important to test on multiple instances and/or multiple random seeds. For reliable comparison, it is generally preferable to use controlled and consistent environments, such as server-grade systems or Apple Silicon machines, where variability between runs is lower and results are more reproducible.

Jan

Erik Cervin Edin

unread,
Apr 23, 2026, 12:36:28 PM (yesterday) Apr 23
to or-tools...@googlegroups.com
On 26/04/20 05:30PM, Kyle Booth wrote:
> - If I use a decision strategy, but do not use cp_model.FIXED_SEARCH,
> does the solver follow my decision strategy at all?

Yes, but by design, not all workers will use it (I think only one?)
Reply all
Reply to author
Forward
0 new messages