![]() |
OR-Tools
8.2
|
Specialization of LocalSearchOperator built from an array of IntVars which specifies the scope of the operator.
This class also takes care of storing current variable values in Start(), keeps track of changes done by the operator and builds the delta. The Deactivate() method can be used to perform Large Neighborhood Search.
Definition at line 1027 of file constraint_solveri.h.
Public Member Functions | |
IntVarLocalSearchOperator () | |
IntVarLocalSearchOperator (const std::vector< IntVar * > &vars, bool keep_inverse_values=false) | |
~IntVarLocalSearchOperator () override | |
bool | MakeNextNeighbor (Assignment *delta, Assignment *deltadelta) override |
Redefines MakeNextNeighbor to export a simpler interface. More... | |
bool | HoldsDelta () const override |
void | Start (const Assignment *assignment) override |
This method should not be overridden. More... | |
virtual bool | IsIncremental () const |
int | Size () const |
const int64 & | Value (int64 index) const |
Returns the value in the current assignment of the variable of given index. More... | |
IntVar * | Var (int64 index) const |
Returns the variable of given index. More... | |
virtual bool | SkipUnchanged (int index) const |
const int64 & | OldValue (int64 index) const |
void | SetValue (int64 index, const int64 &value) |
bool | Activated (int64 index) const |
void | Activate (int64 index) |
void | Deactivate (int64 index) |
bool | ApplyChanges (Assignment *delta, Assignment *deltadelta) const |
void | RevertChanges (bool incremental) |
void | AddVars (const std::vector< IntVar * > &vars) |
virtual void | OnStart () |
Called by Start() after synchronizing the operator with the current assignment. More... | |
virtual void | Reset () |
virtual const LocalSearchOperator * | Self () const |
virtual bool | HasFragments () const |
virtual std::string | DebugString () const |
Protected Member Functions | |
virtual bool | MakeOneNeighbor () |
Creates a new neighbor. More... | |
bool | IsInverseValue (int64 index) const |
int64 | InverseValue (int64 index) const |
int64 | OldInverseValue (int64 index) const |
void | SetInverseValue (int64 index, int64 value) |
void | SetOldInverseValue (int64 index, int64 value) |
void | MarkChange (int64 index) |
OnStart() should really be protected, but then SWIG doesn't see it. More... | |
Protected Attributes | |
std::vector< IntVar * > | vars_ |
std::vector< int64 > | values_ |
std::vector< int64 > | old_values_ |
std::vector< int64 > | prev_values_ |
std::vector< int > | assignment_indices_ |
Bitset64 | activated_ |
Bitset64 | was_activated_ |
SparseBitset | changes_ |
SparseBitset | delta_changes_ |
bool | cleared_ |
IntVarLocalSearchHandler | var_handler_ |
|
inline |
Definition at line 1030 of file constraint_solveri.h.
|
inlineexplicit |
Definition at line 1034 of file constraint_solveri.h.
|
inlineoverride |
Definition at line 1049 of file constraint_solveri.h.
|
inlineinherited |
Definition at line 856 of file constraint_solveri.h.
|
inlineinherited |
Definition at line 855 of file constraint_solveri.h.
|
inlineinherited |
Definition at line 901 of file constraint_solveri.h.
|
inlineinherited |
Definition at line 864 of file constraint_solveri.h.
|
inlineinherited |
Definition at line 860 of file constraint_solveri.h.
|
inlinevirtualinherited |
Reimplemented in SymmetryManager, ExchangeSubtrip, RelocateSubtrip, PairNodeSwapActiveOperator< swap_first >, RelocateExpensiveChain, FilteredHeuristicCloseNodesLNSOperator, FilteredHeuristicExpensiveChainLNSOperator, RelocatePathAndHeuristicInsertUnperformedOperator, FilteredHeuristicPathLNSOperator, IndexPairSwapActiveOperator, SwapIndexPairOperator, PairExchangeRelocateOperator, PairExchangeOperator, LightPairRelocateOperator, PairRelocateOperator, MakePairInactiveOperator, MakePairActiveOperator, MakeRelocateNeighborsOperator, CPFeasibilityFilter, IntVarFilteredDecisionBuilder, 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, 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, DecisionBuilder, Decision, PropagationBaseObject, LocalSearchMonitorMaster, and Trace.
Definition at line 3156 of file constraint_solver.h.
|
inlinevirtualinherited |
Reimplemented in PathLns, and BaseLns.
Definition at line 808 of file constraint_solveri.h.
|
inlineoverridevirtualinherited |
Reimplemented from LocalSearchOperator.
Definition at line 823 of file constraint_solveri.h.
Definition at line 1072 of file constraint_solveri.h.
|
inlinevirtualinherited |
Reimplemented in TwoOpt.
Definition at line 839 of file constraint_solveri.h.
|
inlineprotected |
Definition at line 1067 of file constraint_solveri.h.
|
overridevirtual |
Redefines MakeNextNeighbor to export a simpler interface.
The calls to ApplyChanges() and RevertChanges() are factored in this method, hiding both delta and deltadelta from subclasses which only need to override MakeOneNeighbor(). Therefore this method should not be overridden. Override MakeOneNeighbor() instead.
Implements LocalSearchOperator.
Reimplemented in PairNodeSwapActiveOperator< swap_first >, IndexPairSwapActiveOperator, and SwapIndexPairOperator.
Definition at line 74 of file local_search.cc.
|
protectedvirtual |
Creates a new neighbor.
It returns false when the neighborhood is completely explored. MakeNextNeighbor() in a subclass of IntVarLocalSearchOperator.
Reimplemented in RelocateExpensiveChain, MakePairActiveOperator, TSPLns, BaseInactiveNodeToPathOperator, PathOperator, ChangeValue, and BaseLns.
Definition at line 95 of file local_search.cc.
|
inlineprotectedinherited |
OnStart() should really be protected, but then SWIG doesn't see it.
So we make it public, but only subclasses should access to it (to override it).
Definition at line 925 of file constraint_solveri.h.
Definition at line 1074 of file constraint_solveri.h.
Definition at line 850 of file constraint_solveri.h.
|
inlinevirtualinherited |
Called by Start() after synchronizing the operator with the current assignment.
Should be overridden instead of Start() to avoid calling VarLocalSearchOperator::Start explicitly.
Reimplemented in SwapIndexPairOperator.
Definition at line 920 of file constraint_solveri.h.
|
inlinevirtualinherited |
Reimplemented in PathOperator.
Definition at line 804 of file constraint_solveri.h.
|
inlineinherited |
Definition at line 888 of file constraint_solveri.h.
|
inlinevirtualinherited |
Definition at line 806 of file constraint_solveri.h.
Definition at line 1078 of file constraint_solveri.h.
Definition at line 1082 of file constraint_solveri.h.
Definition at line 851 of file constraint_solveri.h.
|
inlineinherited |
Definition at line 840 of file constraint_solveri.h.
|
inlinevirtualinherited |
Reimplemented in PathOperator.
Definition at line 849 of file constraint_solveri.h.
|
inlineoverridevirtualinherited |
This method should not be overridden.
Override OnStart() instead which is called before exiting this method.
Implements LocalSearchOperator.
Definition at line 826 of file constraint_solveri.h.
Returns the value in the current assignment of the variable of given index.
Definition at line 843 of file constraint_solveri.h.
Returns the variable of given index.
Definition at line 848 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 935 of file constraint_solveri.h.
|
mutableprotectedinherited |
Definition at line 934 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 937 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 939 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 938 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 932 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 933 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 931 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 940 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 930 of file constraint_solveri.h.
|
protectedinherited |
Definition at line 936 of file constraint_solveri.h.