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

#include <constraint_solveri.h>

Inheritance diagram for operations_research::LocalSearchFilter:
operations_research::BaseObject operations_research::IntVarLocalSearchFilter operations_research::BasePathFilter

Public Member Functions

virtual void Relax (const Assignment *delta, const Assignment *deltadelta)
 
virtual void Commit (const Assignment *delta, const Assignment *deltadelta)
 Dual of Relax(), lets the filter know that the delta was accepted.
 
virtual bool Accept (const Assignment *delta, const Assignment *deltadelta, int64_t objective_min, int64_t objective_max)=0
 
virtual bool IsIncremental () const
 
virtual void Synchronize (const Assignment *assignment, const Assignment *delta)=0
 
virtual void Revert ()
 Cancels the changes made by the last Relax()/Accept() calls.
 
virtual void Reset ()
 Sets the filter to empty solution.
 
virtual int64_t GetSynchronizedObjectiveValue () const
 Objective value from last time Synchronize() was called.
 
virtual int64_t GetAcceptedObjectiveValue () 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 ()
 
virtual std::string DebugString () const
 

Detailed Description

Local Search Filters are used for fast neighbor pruning. Filtering a move is done in several phases:

  • in the Relax phase, filters determine which parts of their internals will be changed by the candidate, and modify intermediary State
  • in the Accept phase, filters check that the candidate is feasible,
  • if the Accept phase succeeds, the solver may decide to trigger a Synchronize phase that makes filters change their internal representation to the last candidate,
  • otherwise (Accept fails or the solver does not want to synchronize), a Revert phase makes filters erase any intermediary State generated by the Relax and Accept phases. A given filter has phases called with the following pattern: (Relax.Accept.Synchronize | Relax.Accept.Revert | Relax.Revert)*. Filters's Revert() is always called in the reverse order their Accept() was called, to allow late filters to use state done/undone by early filters' Accept()/Revert().

Definition at line 2071 of file constraint_solveri.h.

Member Function Documentation

◆ Accept()

virtual bool operations_research::LocalSearchFilter::Accept ( const Assignment * delta,
const Assignment * deltadelta,
int64_t objective_min,
int64_t objective_max )
pure virtual

Accepts a "delta" given the assignment with which the filter has been synchronized; the delta holds the variables which have been modified and their new value. If the filter represents a part of the global objective, its contribution must be between objective_min and objective_max. Sample: supposing one wants to maintain a[0,1] + b[0,1] <= 1, for the assignment (a,1), (b,0), the delta (b,1) will be rejected but the delta (a,0) will be accepted.

Todo
(user): Remove arguments when there are no more need for those.

Implemented in operations_research::BasePathFilter.

◆ Commit()

virtual void operations_research::LocalSearchFilter::Commit ( const Assignment * delta,
const Assignment * deltadelta )
inlinevirtual

Dual of Relax(), lets the filter know that the delta was accepted.

Definition at line 2077 of file constraint_solveri.h.

◆ GetAcceptedObjectiveValue()

virtual int64_t operations_research::LocalSearchFilter::GetAcceptedObjectiveValue ( ) const
inlinevirtual

Objective value from the last time Accept() was called and returned true. If the last Accept() call returned false, returns an undefined value.

Definition at line 2109 of file constraint_solveri.h.

◆ GetSynchronizedObjectiveValue()

virtual int64_t operations_research::LocalSearchFilter::GetSynchronizedObjectiveValue ( ) const
inlinevirtual

Objective value from last time Synchronize() was called.

Definition at line 2106 of file constraint_solveri.h.

◆ IsIncremental()

virtual bool operations_research::LocalSearchFilter::IsIncremental ( ) const
inlinevirtual

Definition at line 2090 of file constraint_solveri.h.

◆ Relax()

virtual void operations_research::LocalSearchFilter::Relax ( const Assignment * delta,
const Assignment * deltadelta )
inlinevirtual

Lets the filter know what delta and deltadelta will be passed in the next Accept().

Definition at line 2075 of file constraint_solveri.h.

◆ Reset()

virtual void operations_research::LocalSearchFilter::Reset ( )
inlinevirtual

Sets the filter to empty solution.

Definition at line 2103 of file constraint_solveri.h.

◆ Revert()

virtual void operations_research::LocalSearchFilter::Revert ( )
inlinevirtual

Cancels the changes made by the last Relax()/Accept() calls.

Definition at line 2100 of file constraint_solveri.h.

◆ Synchronize()

virtual void operations_research::LocalSearchFilter::Synchronize ( const Assignment * assignment,
const Assignment * delta )
pure virtual

Synchronizes the filter with the current solution, delta being the difference with the solution passed to the previous call to Synchronize() or IncrementalSynchronize(). 'delta' can be used to incrementally synchronizing the filter with the new solution by only considering the changes in delta.

Implemented in operations_research::IntVarLocalSearchFilter.


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