Arguments: const CpSolverResponse& initial_solution,
double difficulty, absl::BitGenRef random
Generates a "local" subproblem for the given seed.
The difficulty will be in [0, 1] and is related to the asked neighborhood
size (and thus local problem difficulty). A difficulty of 0.0 means empty
neighborhood and a difficulty of 1.0 means the full problem. The algorithm
should try to generate a neighborhood according to this difficulty which
will be dynamically adjusted depending on whether or not we can solve the
subproblem in a given time limit.
The given initial_solution should contain a feasible solution to the
initial CpModelProto given to this class. Any solution to the returned
CPModelProto should also be valid solution to the same initial model.
This function should be thread-safe.
Uses UCB1 algorithm to compute the score (Multi armed bandit problem).
Details are at
https://lilianweng.github.io/lil-log/2018/01/23/the-multi-armed-bandit-problem-and-its-solutions.html.
'total_num_calls' should be the sum of calls across all generators part of
the multi armed bandit problem.
If the generator is called less than 10 times then the method returns
infinity as score in order to get more data about the generator
performance.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["`NeighborhoodGenerator` is a base class in C++ for creating custom neighborhood generators within the CP-SAT solver."],["It provides methods to generate subproblems, adjust difficulty, and track performance metrics like UCB score and solve time."],["The `Generate` method is crucial, allowing the creation of \"local\" subproblems based on an initial solution and desired difficulty."],["Developers can extend this class to implement their own neighborhood search strategies for solving constraint programming problems."]]],["The `NeighborhoodGenerator` class serves as a base for creating neighborhood generators within the `CpModelProto` framework. Key actions include `Generate`, which produces a subproblem based on difficulty and an initial solution, and `GetUCBScore`, which computes a score using the UCB1 algorithm to determine generator performance. Other methods manage the generator's state, including `AddSolveData`, `Synchronize` for updates, `deterministic_limit`, `deterministic_time`, `difficulty` for time and complexity management, `num_calls`, `num_fully_solved_calls` for performance measures, `IsRelaxationGenerator` to identify relaxation, `ReadyToGenerate` to know if the generator can be used and `name` for identification.\n"]]