OR-Tools  9.6
BasePathFilterabstract

Detailed Description

Generic path-based filter class.

Definition at line 96 of file routing_filters.h.

Public Member Functions

 BasePathFilter (const std::vector< IntVar * > &nexts, int next_domain_size)
 
 ~BasePathFilter () override
 
bool Accept (const Assignment *delta, const Assignment *deltadelta, int64_t objective_min, int64_t objective_max) override
 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. More...
 
void OnSynchronize (const Assignment *delta) override
 
void Synchronize (const Assignment *assignment, const Assignment *delta) override
 This method should not be overridden. More...
 
bool FindIndex (IntVar *const var, int64_t *index) const
 
void AddVars (const std::vector< IntVar * > &vars)
 Add variables to "track" to the filter. More...
 
int Size () const
 
IntVarVar (int index) const
 
int64_t Value (int index) const
 
bool IsVarSynced (int index) const
 
virtual void Relax (const Assignment *delta, const Assignment *deltadelta)
 Lets the filter know what delta and deltadelta will be passed in the next Accept(). More...
 
virtual void Commit (const Assignment *delta, const Assignment *deltadelta)
 Dual of Relax(), lets the filter know that the delta was accepted. More...
 
virtual bool IsIncremental () const
 
virtual void Revert ()
 Cancels the changes made by the last Relax()/Accept() calls. More...
 
virtual void Reset ()
 Sets the filter to empty solution. More...
 
virtual int64_t GetSynchronizedObjectiveValue () const
 Objective value from last time Synchronize() was called. More...
 
virtual int64_t GetAcceptedObjectiveValue () const
 Objective value from the last time Accept() was called and returned true. More...
 
virtual std::string DebugString () const
 

Protected Member Functions

int64_t GetNext (int64_t node) const
 
int NumPaths () const
 
int64_t Start (int i) const
 
int GetPath (int64_t node) const
 
int Rank (int64_t node) const
 
bool IsDisabled () const
 
const std::vector< int64_t > & GetTouchedPathStarts () const
 
bool PathStartTouched (int64_t start) const
 
const std::vector< int64_t > & GetNewSynchronizedUnperformedNodes () const
 
bool lns_detected () const
 
void SynchronizeOnAssignment (const Assignment *assignment)
 

Static Protected Attributes

static const int64_t kUnassigned = -1
 

Constructor & Destructor Documentation

◆ BasePathFilter()

BasePathFilter ( const std::vector< IntVar * > &  nexts,
int  next_domain_size 
)

Definition at line 284 of file routing_filters.cc.

◆ ~BasePathFilter()

~BasePathFilter ( )
inlineoverride

Definition at line 99 of file routing_filters.h.

Member Function Documentation

◆ Accept()

bool Accept ( const Assignment delta,
const Assignment deltadelta,
int64_t  objective_min,
int64_t  objective_max 
)
overridevirtual

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.

Implements LocalSearchFilter.

Definition at line 297 of file routing_filters.cc.

◆ AddVars()

void AddVars ( const std::vector< IntVar * > &  vars)
inherited

Add variables to "track" to the filter.

Definition at line 3400 of file local_search.cc.

◆ Commit()

virtual void Commit ( const Assignment delta,
const Assignment deltadelta 
)
inlinevirtualinherited

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

Definition at line 1730 of file constraint_solveri.h.

◆ DebugString()

virtual std::string DebugString ( ) const
inlinevirtualinherited

Reimplemented in SymmetryManager, IntVarFilteredDecisionBuilder, ExchangeSubtrip, RelocateSubtrip, PairNodeSwapActiveOperator< swap_first >, RelocateExpensiveChain, FilteredHeuristicCloseNodesLNSOperator, FilteredHeuristicExpensiveChainLNSOperator, RelocatePathAndHeuristicInsertUnperformedOperator, FilteredHeuristicPathLNSOperator, IndexPairSwapActiveOperator, SwapIndexPairOperator, PairExchangeRelocateOperator, PairExchangeOperator, LightPairRelocateOperator, GroupPairAndRelocateOperator, PairRelocateOperator, MakePairInactiveOperator, MakePairActiveOperator, SwapActiveToShortestPathOperator, MakeRelocateNeighborsOperator, GlobalVehicleBreaksConstraint, Dimension, LocalSearchPhaseParameters, FindOneNeighbor, LocalSearchProfiler, NeighborhoodLimit, PathLns, LinKernighan, TSPLns, TSPOpt, ExtendedSwapActiveOperator, SwapActiveOperator, MakeChainInactiveOperator, RelocateAndMakeInactiveOperator, MakeInactiveOperator, MakeActiveAndRelocate, RelocateAndMakeActiveOperator, MakeActiveOperator, Cross, Exchange, Relocate, TwoOpt, PiecewiseLinearExpr, IfThenElseCt, DemonProfiler, ArrayWithOffset< T >, SearchLog, BooleanVar, LocalSearchMonitor, PropagationMonitor, LocalSearchFilterManager, LightIntIntFunctionElementCt< F >, LightIntFunctionElementCt< F >, DelayedCallMethod2< T, P, Q >, DelayedCallMethod1< T, P >, DelayedCallMethod0< T >, CallMethod3< T, P, Q, R >, CallMethod2< T, P, Q >, CallMethod1< T, P >, CallMethod0< T >, Pack, Assignment, SequenceVar, RegularLimit, SearchLimit, OptimizeVar, SolutionCollector, IntVarIterator, Constraint, Demon, ProfiledDecisionBuilder, DecisionBuilder, Decision, PropagationBaseObject, LocalSearchMonitorPrimary, and Trace.

Definition at line 3251 of file constraint_solver.h.

◆ FindIndex()

bool FindIndex ( IntVar *const  var,
int64_t *  index 
) const
inlineinherited

Definition at line 1828 of file constraint_solveri.h.

◆ GetAcceptedObjectiveValue()

virtual int64_t GetAcceptedObjectiveValue ( ) const
inlinevirtualinherited

Objective value from the last time Accept() was called and returned true.

Definition at line 1762 of file constraint_solveri.h.

◆ GetNewSynchronizedUnperformedNodes()

const std::vector<int64_t>& GetNewSynchronizedUnperformedNodes ( ) const
inlineprotected

Definition at line 121 of file routing_filters.h.

◆ GetNext()

int64_t GetNext ( int64_t  node) const
inlineprotected

Definition at line 107 of file routing_filters.h.

◆ GetPath()

int GetPath ( int64_t  node) const
inlineprotected

Definition at line 114 of file routing_filters.h.

◆ GetSynchronizedObjectiveValue()

virtual int64_t GetSynchronizedObjectiveValue ( ) const
inlinevirtualinherited

Objective value from last time Synchronize() was called.

Definition at line 1759 of file constraint_solveri.h.

◆ GetTouchedPathStarts()

const std::vector<int64_t>& GetTouchedPathStarts ( ) const
inlineprotected

Definition at line 117 of file routing_filters.h.

◆ IsDisabled()

bool IsDisabled ( ) const
inlineprotected

Definition at line 116 of file routing_filters.h.

◆ IsIncremental()

virtual bool IsIncremental ( ) const
inlinevirtualinherited

Definition at line 1743 of file constraint_solveri.h.

◆ IsVarSynced()

bool IsVarSynced ( int  index) const
inlineinherited

Definition at line 1845 of file constraint_solveri.h.

◆ lns_detected()

bool lns_detected ( ) const
inlineprotected

Definition at line 125 of file routing_filters.h.

◆ NumPaths()

int NumPaths ( ) const
inlineprotected

Definition at line 112 of file routing_filters.h.

◆ OnSynchronize()

void OnSynchronize ( const Assignment delta)
overridevirtual

Reimplemented from IntVarLocalSearchFilter.

Definition at line 444 of file routing_filters.cc.

◆ PathStartTouched()

bool PathStartTouched ( int64_t  start) const
inlineprotected

Definition at line 120 of file routing_filters.h.

◆ Rank()

int Rank ( int64_t  node) const
inlineprotected

Definition at line 115 of file routing_filters.h.

◆ Relax()

virtual void Relax ( const Assignment delta,
const Assignment deltadelta 
)
inlinevirtualinherited

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

Definition at line 1728 of file constraint_solveri.h.

◆ Reset()

virtual void Reset ( )
inlinevirtualinherited

Sets the filter to empty solution.

Definition at line 1756 of file constraint_solveri.h.

◆ Revert()

virtual void Revert ( )
inlinevirtualinherited

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

Definition at line 1753 of file constraint_solveri.h.

◆ Size()

int Size ( ) const
inlineinherited

Definition at line 1839 of file constraint_solveri.h.

◆ Start()

int64_t Start ( int  i) const
inlineprotected

Definition at line 113 of file routing_filters.h.

◆ Synchronize()

void Synchronize ( const Assignment assignment,
const Assignment delta 
)
overridevirtualinherited

This method should not be overridden.

Override OnSynchronize() instead which is called before exiting this method.

Implements LocalSearchFilter.

Definition at line 3417 of file local_search.cc.

◆ SynchronizeOnAssignment()

void SynchronizeOnAssignment ( const Assignment assignment)
protectedinherited

Definition at line 3428 of file local_search.cc.

◆ Value()

int64_t Value ( int  index) const
inlineinherited

Definition at line 1841 of file constraint_solveri.h.

◆ Var()

IntVar* Var ( int  index) const
inlineinherited

Definition at line 1840 of file constraint_solveri.h.

Member Data Documentation

◆ kUnassigned

const int64_t kUnassigned = -1
staticprotected

Definition at line 105 of file routing_filters.h.


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