d-krupke / cpsat-primer

Using and Understanding OR-Tools' CP-SAT: A Primer and Cheat Sheet
https://d-krupke.github.io/cpsat-primer/
Creative Commons Attribution 4.0 International
280 stars 25 forks source link

Obsolote parameter `min_num_lns_workers` #30

Closed leonlan closed 1 month ago

leonlan commented 1 month ago

Hi @d-krupke, great work on the CP-SAT primer! It's easy to read, and the interleaved code examples make it very practical. I'm definitely going to recommend your book to others who are interested in CP-SAT.

I was reading chapter 5 and this part stood out to me:

If you want to use more workers heuristically searching for good solutions, you can specify solver.parameters.min_num_lns_workers.

In the proto specification for parameters, there's a comment about min_num_lns_workers being a no-op:

https://github.com/google/or-tools/blob/d4f9b80c95816dd2c817bf65a2996d7dd6d83d11/ortools/sat/sat_parameters.proto#L572-L573

This changed about eight months ago: https://github.com/google/or-tools/blame/v9.8/ortools/sat/sat_parameters.proto#L571

My suggestion would be to remove the line about this parameter in chapter 5 or to replace it with another parameter, but I'm not familiar enough yet with CP-SAT know which one.

d-krupke commented 1 month ago

Hi Leon,

Thanks for the kind words: that really motivates me keep doing it!

Good catch! I will check it out and update it accordingly as soon as I have a few minutes to spare. This has been one of the more popular parameters in the past (AFAIK), so I should document that properly.

If you notice anything further, please let me know. CP-SAT is currently developing so fast that it is hard to keep everything up to date.

Bets, Dominik

leonlan commented 1 month ago

Sounds good! I'm diving into CP-SAT myself right now for some scheduling problems, so I will do my best to help update.

d-krupke commented 1 month ago

Finally found some time: Simply deleting the line is indeed the best solution. While there are options to reproduce the parameter's behavior, they are not pretty and use_lns_only should actually suffice for most use cases, as usually you either want a systematic search of the solution space, or you just want to optimize until you run out of time (though, use_only_lns will not always give a benefit in this case).

If one has the time/need to do elaborate tuning, specifying the concrete strategies manually would be the best option.

d-krupke commented 1 month ago

Thanks again! Closing this issue.