Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::LocalSearch Class Reference

--— Local search decision builder --— More...

Inheritance diagram for operations_research::LocalSearch:
operations_research::DecisionBuilder operations_research::BaseObject

Public Member Functions

 LocalSearch (Assignment *assignment, IntVar *objective, SolutionPool *pool, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit, LocalSearchFilterManager *filter_manager)
 
 LocalSearch (const std::vector< IntVar * > &vars, IntVar *objective, SolutionPool *pool, DecisionBuilder *first_solution, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit, LocalSearchFilterManager *filter_manager)
 
 LocalSearch (const std::vector< IntVar * > &vars, IntVar *objective, SolutionPool *pool, DecisionBuilder *first_solution, DecisionBuilder *first_solution_sub_decision_builder, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit, LocalSearchFilterManager *filter_manager)
 
 LocalSearch (const std::vector< SequenceVar * > &vars, IntVar *objective, SolutionPool *pool, DecisionBuilder *first_solution, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit, LocalSearchFilterManager *filter_manager)
 
 ~LocalSearch () override
 
DecisionNext (Solver *solver) override
 
std::string DebugString () const override
 -------— Decision Builder -------—
 
void Accept (ModelVisitor *visitor) const override
 Model Visitor support.
 
- Public Member Functions inherited from operations_research::DecisionBuilder
 DecisionBuilder ()
 
 DecisionBuilder (const DecisionBuilder &)=delete
 This type is neither copyable nor movable.
 
DecisionBuilderoperator= (const DecisionBuilder &)=delete
 
 ~DecisionBuilder () override
 
virtual void AppendMonitors (Solver *solver, std::vector< SearchMonitor * > *extras)
 
void set_name (absl::string_view name)
 
std::string GetName () const
 
- Public Member Functions inherited from operations_research::BaseObject
 BaseObject ()
 
 BaseObject (const BaseObject &)=delete
 This type is neither copyable nor movable.
 
BaseObjectoperator= (const BaseObject &)=delete
 
virtual ~BaseObject ()
 

Protected Member Functions

void PushFirstSolutionDecision (DecisionBuilder *first_solution)
 
void PushLocalSearchDecision ()
 

Detailed Description

--— Local search decision builder --—

Given a first solution (resulting from either an initial assignment or the result of a decision builder), it searches for neighbors using a local search operator. The first solution corresponds to the first leaf of the search. The local search applies to the variables contained either in the assignment or the vector of variables passed.

Definition at line 5270 of file local_search.cc.

Constructor & Destructor Documentation

◆ LocalSearch() [1/4]

operations_research::LocalSearch::LocalSearch ( Assignment * assignment,
IntVar * objective,
SolutionPool * pool,
LocalSearchOperator * ls_operator,
DecisionBuilder * sub_decision_builder,
RegularLimit * limit,
LocalSearchFilterManager * filter_manager )

Definition at line 5317 of file local_search.cc.

◆ LocalSearch() [2/4]

operations_research::LocalSearch::LocalSearch ( const std::vector< IntVar * > & vars,
IntVar * objective,
SolutionPool * pool,
DecisionBuilder * first_solution,
LocalSearchOperator * ls_operator,
DecisionBuilder * sub_decision_builder,
RegularLimit * limit,
LocalSearchFilterManager * filter_manager )
Todo
(user): find a way to not have to pass vars here: redundant with variables in operators

Definition at line 5343 of file local_search.cc.

◆ LocalSearch() [3/4]

operations_research::LocalSearch::LocalSearch ( const std::vector< IntVar * > & vars,
IntVar * objective,
SolutionPool * pool,
DecisionBuilder * first_solution,
DecisionBuilder * first_solution_sub_decision_builder,
LocalSearchOperator * ls_operator,
DecisionBuilder * sub_decision_builder,
RegularLimit * limit,
LocalSearchFilterManager * filter_manager )

Definition at line 5370 of file local_search.cc.

◆ LocalSearch() [4/4]

operations_research::LocalSearch::LocalSearch ( const std::vector< SequenceVar * > & vars,
IntVar * objective,
SolutionPool * pool,
DecisionBuilder * first_solution,
LocalSearchOperator * ls_operator,
DecisionBuilder * sub_decision_builder,
RegularLimit * limit,
LocalSearchFilterManager * filter_manager )

Definition at line 5397 of file local_search.cc.

◆ ~LocalSearch()

operations_research::LocalSearch::~LocalSearch ( )
override

Definition at line 5424 of file local_search.cc.

Member Function Documentation

◆ Accept()

void operations_research::LocalSearch::Accept ( ModelVisitor * visitor) const
overridevirtual

Model Visitor support.

We collect decision variables from the assignment.

Reimplemented from operations_research::DecisionBuilder.

Definition at line 5427 of file local_search.cc.

◆ DebugString()

std::string operations_research::LocalSearch::DebugString ( ) const
inlineoverridevirtual

-------— Decision Builder -------—

Reimplemented from operations_research::DecisionBuilder.

Definition at line 5296 of file local_search.cc.

◆ Next()

Decision * operations_research::LocalSearch::Next ( Solver * solver)
overridevirtual

This is equivalent to a multi-restart decision builder

Todo

(user): abstract this from the local search part

(user): handle the case where the tree depth is not enough to hold all solutions.

A local optimum has been reached. The search will continue only if we accept up-hill moves (due to metaheuristics). In this case we need to reset neighborhood optimal routes.

Todo
(user): Find a way to make this balancing invisible to the user (no increase in branch or fail counts for instance).

Next time go to next decision

Implements operations_research::DecisionBuilder.

Definition at line 5459 of file local_search.cc.

◆ PushFirstSolutionDecision()

void operations_research::LocalSearch::PushFirstSolutionDecision ( DecisionBuilder * first_solution)
protected

Definition at line 5514 of file local_search.cc.

◆ PushLocalSearchDecision()

void operations_research::LocalSearch::PushLocalSearchDecision ( )
protected

Definition at line 5527 of file local_search.cc.


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