C++ Reference: class NeighborhoodGenerator

Note: This documentation is automatically generated.

Base class for a CpModelProto neighborhood generator.

Return type: void

Arguments: SolveData data


Return type: double

The current time limit that the sub-solve should use on this generator.


Return type: double

The sum of the deterministic time spent in this generator.


Return type: double

The current difficulty of this generator


Return type: virtual Neighborhood

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.


Return type: double

Arguments: int64_t total_num_calls

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.


Return type: virtual bool

Returns true if the neighborhood generator generates relaxation of the given problem.


Return type: std::string

Returns a short description of the generator.


Arguments: const std::string& name, NeighborhoodGeneratorHelper const* helper


Return type: virtual


Return type: int64_t

Number of times this generator was called.


Return type: int64_t

Number of time the neighborhood was fully solved (OPTIMAL/INFEASIBLE).


Return type: virtual bool

Returns true if the neighborhood generator can generate a neighborhood.


Return type: void

Process all the recently added solve data and update this generator score and difficulty.