C++ Reference: class NeighborhoodGeneratorHelper

This documentation is automatically generated.

Contains pre-computed information about a given CpModelProto that is meant to be used to generate LNS neighborhood. This class can be shared between more than one generator in order to reduce memory usage.

Note that its implement the SubSolver interface to be able to Synchronize() the bounds of the base problem with the external world.
Method
ActiveVariables

Return type: const std::vector<int>&

Returns the list of "active" variables.

FixAllVariables

Return type: Neighborhood

Arguments: const CpSolverResponse& initial_solution

Returns a trivial model by fixing all active variables to the initial solution values.

FixGivenVariables

Return type: Neighborhood

Arguments: const CpSolverResponse& initial_solution, const std::vector<int>& variables_to_fix

Returns the LNS fragment where the given variables are fixed to the value they take in the given solution.

FullNeighborhood

Return type: Neighborhood

Return a neighborhood that correspond to the full problem.

GenerateTask

Return type: std::function<void()>

Arguments: int64 task_id

IsActive

Return type: bool

Arguments: int var

Indicates if the variable can be frozen. It happens if the variable is non constant, and if it is a decision variable, or if focus_on_decision_variables is false.

ModelProto

Return type: const CpModelProto&

The initial problem. Note that the domain of the variables are not updated here.

MutableMutex

Return type: absl::Mutex*

This mutex must be aquired before calling any of the function that access data that can be updated by Synchronize(). TODO(user): Refactor the class to be thread-safe instead, it should be safer and more easily maintenable. Some complication with accessing the variable<->constraint graph efficiently though.

NeighborhoodGeneratorHelper

Arguments: int id, CpModelProto const* model_proto, SatParameters const* parameters, SharedResponseManager* shared_response, SharedTimeLimit* shared_time_limit = nullptr, SharedBoundsManager* shared_bounds = nullptr

Parameters

Return type: const SatParameters&

RelaxGivenVariables

Return type: Neighborhood

Arguments: const CpSolverResponse& initial_solution, const std::vector<int>& relaxed_variables

Returns the LNS fragment which will relax all inactive variables and all variables in relaxed_variables.

shared_response

Return type: const SharedResponseManager&

Synchronize

Return type: void

TaskIsAvailable

Return type: bool

SubSolver interface.

TypeToConstraints

Return type: const absl::Span<const int>

Arguments: ConstraintProto::ConstraintCase type

Returns all the constraints indices of a given type.