OR-Tools  9.6
NeighborhoodGeneratorHelper

Detailed Description

Definition at line 100 of file cp_model_lns.h.

Public Types

enum  SubsolverType { FULL_PROBLEM , FIRST_SOLUTION , INCOMPLETE , HELPER }
 

Public Member Functions

 NeighborhoodGeneratorHelper (CpModelProto const *model_proto, SatParameters const *parameters, SharedResponseManager *shared_response, SharedBoundsManager *shared_bounds=nullptr)
 
bool TaskIsAvailable () override
 
std::function< void()> GenerateTask (int64_t) override
 
void Synchronize () override
 
Neighborhood FixGivenVariables (const CpSolverResponse &base_solution, const absl::flat_hash_set< int > &variables_to_fix) const
 
Neighborhood RemoveMarkedConstraints (const std::vector< int > &constraints_to_remove) const
 
Neighborhood RelaxGivenVariables (const CpSolverResponse &initial_solution, const std::vector< int > &relaxed_variables) const
 
Neighborhood FixAllVariables (const CpSolverResponse &initial_solution) const
 
Neighborhood FullNeighborhood () const
 
Neighborhood NoNeighborhood () const
 
void AddSolutionHinting (const CpSolverResponse &initial_solution, CpModelProto *model_proto) const
 
bool IsActive (int var) const ABSL_SHARED_LOCKS_REQUIRED(graph_mutex_)
 
std::vector< int > ActiveVariables () const
 
int NumActiveVariables () const
 
std::vector< int > ActiveObjectiveVariables () const
 
bool DifficultyMeansFullNeighborhood (double difficulty) const
 
const std::vector< int > & ActiveVariablesWhileHoldingLock () const ABSL_SHARED_LOCKS_REQUIRED(graph_mutex_)
 
const std::vector< std::vector< int > > & ConstraintToVar () const ABSL_SHARED_LOCKS_REQUIRED(graph_mutex_)
 
const std::vector< std::vector< int > > & VarToConstraint () const ABSL_SHARED_LOCKS_REQUIRED(graph_mutex_)
 
const absl::Span< const int > TypeToConstraints (ConstraintProto::ConstraintCase type) const
 
std::vector< int > GetActiveIntervals (const CpSolverResponse &initial_solution) const
 
std::vector< std::vector< int > > GetUniqueIntervalSets () const
 
std::vector< std::vector< int > > GetRoutingPaths (const CpSolverResponse &initial_solution) const
 
std::vector< std::pair< int, int > > GetSchedulingPrecedences (const absl::flat_hash_set< int > &ignored_intervals, const CpSolverResponse &initial_solution, absl::BitGenRef random) const
 
const CpModelProto & ModelProto () const
 
const SatParameters & Parameters () const
 
const SharedResponseManagershared_response () const
 
double score () const
 
double deterministic_time () const
 
std::string name () const
 
SubsolverType type () const
 
virtual std::string StatisticsString () const
 

Public Attributes

absl::Mutex graph_mutex_
 

Protected Attributes

const std::string name_
 
const SubsolverType type_
 
double score_ = 0.0
 
double deterministic_time_ = 0.0
 

Member Enumeration Documentation

◆ SubsolverType

enum SubsolverType
inherited
Enumerator
FULL_PROBLEM 
FIRST_SOLUTION 
INCOMPLETE 
HELPER 

Definition at line 45 of file subsolver.h.

Constructor & Destructor Documentation

◆ NeighborhoodGeneratorHelper()

NeighborhoodGeneratorHelper ( CpModelProto const *  model_proto,
SatParameters const *  parameters,
SharedResponseManager shared_response,
SharedBoundsManager shared_bounds = nullptr 
)

Definition at line 62 of file cp_model_lns.cc.

Member Function Documentation

◆ ActiveObjectiveVariables()

std::vector<int> ActiveObjectiveVariables ( ) const
inline

Definition at line 164 of file cp_model_lns.h.

◆ ActiveVariables()

std::vector<int> ActiveVariables ( ) const
inline

Definition at line 152 of file cp_model_lns.h.

◆ ActiveVariablesWhileHoldingLock()

const std::vector<int>& ActiveVariablesWhileHoldingLock ( ) const
inline

Definition at line 179 of file cp_model_lns.h.

◆ AddSolutionHinting()

void AddSolutionHinting ( const CpSolverResponse &  initial_solution,
CpModelProto *  model_proto 
) const

Definition at line 1066 of file cp_model_lns.cc.

◆ ConstraintToVar()

const std::vector<std::vector<int> >& ConstraintToVar ( ) const
inline

Definition at line 186 of file cp_model_lns.h.

◆ deterministic_time()

double deterministic_time ( ) const
inlineinherited

Definition at line 86 of file subsolver.h.

◆ DifficultyMeansFullNeighborhood()

bool DifficultyMeansFullNeighborhood ( double  difficulty) const
inline

Definition at line 171 of file cp_model_lns.h.

◆ FixAllVariables()

Neighborhood FixAllVariables ( const CpSolverResponse &  initial_solution) const

Definition at line 1111 of file cp_model_lns.cc.

◆ FixGivenVariables()

Neighborhood FixGivenVariables ( const CpSolverResponse &  base_solution,
const absl::flat_hash_set< int > &  variables_to_fix 
) const

Definition at line 963 of file cp_model_lns.cc.

◆ FullNeighborhood()

Neighborhood FullNeighborhood ( ) const

Definition at line 372 of file cp_model_lns.cc.

◆ GenerateTask()

std::function<void()> GenerateTask ( int64_t  )
inlineoverridevirtual

Implements SubSolver.

Definition at line 109 of file cp_model_lns.h.

◆ GetActiveIntervals()

std::vector< int > GetActiveIntervals ( const CpSolverResponse &  initial_solution) const

Definition at line 390 of file cp_model_lns.cc.

◆ GetRoutingPaths()

std::vector< std::vector< int > > GetRoutingPaths ( const CpSolverResponse &  initial_solution) const

Definition at line 878 of file cp_model_lns.cc.

◆ GetSchedulingPrecedences()

std::vector< std::pair< int, int > > GetSchedulingPrecedences ( const absl::flat_hash_set< int > &  ignored_intervals,
const CpSolverResponse &  initial_solution,
absl::BitGenRef  random 
) const

Definition at line 854 of file cp_model_lns.cc.

◆ GetUniqueIntervalSets()

std::vector< std::vector< int > > GetUniqueIntervalSets ( ) const

Definition at line 439 of file cp_model_lns.cc.

◆ IsActive()

bool IsActive ( int  var) const

Definition at line 362 of file cp_model_lns.cc.

◆ ModelProto()

const CpModelProto& ModelProto ( ) const
inline

Definition at line 230 of file cp_model_lns.h.

◆ name()

std::string name ( ) const
inlineinherited

Definition at line 89 of file subsolver.h.

◆ NoNeighborhood()

Neighborhood NoNeighborhood ( ) const

Definition at line 384 of file cp_model_lns.cc.

◆ NumActiveVariables()

int NumActiveVariables ( ) const
inline

Definition at line 159 of file cp_model_lns.h.

◆ Parameters()

const SatParameters& Parameters ( ) const
inline

Definition at line 231 of file cp_model_lns.h.

◆ RelaxGivenVariables()

Neighborhood RelaxGivenVariables ( const CpSolverResponse &  initial_solution,
const std::vector< int > &  relaxed_variables 
) const

Definition at line 1094 of file cp_model_lns.cc.

◆ RemoveMarkedConstraints()

Neighborhood RemoveMarkedConstraints ( const std::vector< int > &  constraints_to_remove) const

Definition at line 1084 of file cp_model_lns.cc.

◆ score()

double score ( ) const
inlineinherited

Definition at line 82 of file subsolver.h.

◆ shared_response()

const SharedResponseManager& shared_response ( ) const
inline

Definition at line 233 of file cp_model_lns.h.

◆ StatisticsString()

virtual std::string StatisticsString ( ) const
inlinevirtualinherited

Definition at line 95 of file subsolver.h.

◆ Synchronize()

void Synchronize ( )
overridevirtual

Implements SubSolver.

Definition at line 82 of file cp_model_lns.cc.

◆ TaskIsAvailable()

bool TaskIsAvailable ( )
inlineoverridevirtual

Implements SubSolver.

Definition at line 108 of file cp_model_lns.h.

◆ type()

SubsolverType type ( ) const
inlineinherited

Definition at line 92 of file subsolver.h.

◆ TypeToConstraints()

const absl::Span<const int> TypeToConstraints ( ConstraintProto::ConstraintCase  type) const
inline

Definition at line 196 of file cp_model_lns.h.

◆ VarToConstraint()

const std::vector<std::vector<int> >& VarToConstraint ( ) const
inline

Definition at line 190 of file cp_model_lns.h.

Member Data Documentation

◆ deterministic_time_

double deterministic_time_ = 0.0
protectedinherited

Definition at line 101 of file subsolver.h.

◆ graph_mutex_

absl::Mutex graph_mutex_
mutable

Definition at line 242 of file cp_model_lns.h.

◆ name_

const std::string name_
protectedinherited

Definition at line 98 of file subsolver.h.

◆ score_

double score_ = 0.0
protectedinherited

Definition at line 100 of file subsolver.h.

◆ type_

const SubsolverType type_
protectedinherited

Definition at line 99 of file subsolver.h.


The documentation for this class was generated from the following files: