modernize hyperparameter search example#960
Conversation
|
I guess a third, and more important point is: should the whole example not be updated to use the |
IgnaceBleukx
left a comment
There was a problem hiding this comment.
I would increase the number of queens a little more to 75.
Best to exclude this example from the test_examples (there is an exclude list in that file somewhere).
We should also point to our actual hyperparameter tuning tool in the docstring of this file.
E.g.,
CPMpy also includes a fully-fledged hyperparameter tuner, located in `cpmpy.tools.tune_solver`.
Or actually, shouldn't we just rework this example to use the built-in tuner? I feel that makes more sense as an example on how to use the library.
| model = nqueens(n=25) | ||
| model = nqueens(n=50) | ||
| # flatten once upfront, reduces overhead of multiple solves | ||
| model = flatten_model(model) |
There was a problem hiding this comment.
This is from when flatten was the only transformation for ortools...
I would actually just remove this. The overhead should be negligable, and we don't count it in the runtime anyway (only solve time there)
| from cpmpy.solvers import param_combinations | ||
| from cpmpy.transformations.flatten_model import flatten_model | ||
|
|
||
| def main(): |
There was a problem hiding this comment.
give model as arg?
Also function name could be more informative. Like "tune_parameters" or something.
|
Indeed I agree it makes more sense to update the whole example to reflect how the |
Two points:
CPM_<solver>(model)pattern should indeed be updated tocp.SolverLookup.get(<solver>, model), but it made sense to me to update it