![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
#include <constraint_solveri.h>
Public Member Functions | |
IntVarLocalSearchOperator (const std::vector< IntVar * > &vars, bool keep_inverse_values=false) | |
~IntVarLocalSearchOperator () override | |
bool | HoldsDelta () const override |
void | Start (const Assignment *assignment) override |
virtual bool | IsIncremental () const |
int | Size () const |
int64_t | Value (int64_t index) const |
IntVar * | Var (int64_t index) const |
Returns the variable of given index. | |
virtual bool | SkipUnchanged (int) const |
int64_t | OldValue (int64_t index) const |
int64_t | PrevValue (int64_t index) const |
void | SetValue (int64_t index, int64_t value) |
bool | Activated (int64_t index) const |
void | Activate (int64_t index) |
void | Deactivate (int64_t index) |
bool | ApplyChanges (Assignment *delta, Assignment *deltadelta) const |
void | RevertChanges (bool change_was_incremental) |
void | AddVars (const std::vector< IntVar * > &vars) |
virtual void | OnStart () |
bool | MakeNextNeighbor (Assignment *delta, Assignment *deltadelta) override |
--— Base operator class for operators manipulating IntVars --— | |
![]() | |
LocalSearchOperator () | |
~LocalSearchOperator () override | |
virtual void | EnterSearch () |
virtual void | Reset () |
virtual const LocalSearchOperator * | Self () const |
virtual bool | HasFragments () const |
![]() | |
BaseObject () | |
BaseObject (const BaseObject &)=delete | |
This type is neither copyable nor movable. | |
BaseObject & | operator= (const BaseObject &)=delete |
virtual | ~BaseObject () |
virtual std::string | DebugString () const |
Protected Member Functions | |
virtual bool | MakeOneNeighbor () |
int64_t | InverseValue (int64_t index) const |
int64_t | OldInverseValue (int64_t index) const |
void | AddToAssignment (IntVar *var, int64_t value, bool active, std::vector< int > *assignment_indices, int64_t index, Assignment *assignment) const |
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 1123 of file constraint_solveri.h.
|
inlineexplicit |
If keep_inverse_values is true, assumes that vars models an injective function f with domain [0, vars.size()) in which case the operator will maintain the inverse function.
Definition at line 1128 of file constraint_solveri.h.
|
inlineoverride |
Definition at line 1139 of file constraint_solveri.h.
|
inline |
Definition at line 1186 of file constraint_solveri.h.
|
inline |
Definition at line 1183 of file constraint_solveri.h.
|
inlineprotected |
Definition at line 1263 of file constraint_solveri.h.
|
inline |
Definition at line 1224 of file constraint_solveri.h.
|
inline |
Definition at line 1189 of file constraint_solveri.h.
|
inline |
Definition at line 1187 of file constraint_solveri.h.
|
inlineoverridevirtual |
Reimplemented from operations_research::LocalSearchOperator.
Definition at line 1141 of file constraint_solveri.h.
|
inlineprotected |
Definition at line 1256 of file constraint_solveri.h.
|
inlinevirtual |
Reimplemented in operations_research::SwapActiveChainOperator< ignore_path_vars >, and operations_research::TwoOpt< ignore_path_vars >.
Definition at line 1164 of file constraint_solveri.h.
|
overridevirtual |
--— Base operator class for operators manipulating IntVars --—
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). 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 operations_research::LocalSearchOperator.
Reimplemented in operations_research::PairNodeSwapActiveOperator< swap_first, ignore_path_vars >, and operations_research::SwapIndexPairOperator.
Definition at line 79 of file local_search.cc.
|
protectedvirtual |
Creates a new neighbor. It returns false when the neighborhood is completely explored.
Reimplemented in operations_research::BaseInactiveNodeToPathOperator< ignore_path_vars >, operations_research::BaseLns, operations_research::ChangeValue, operations_research::MakePairActiveOperator< ignore_path_vars >, operations_research::PathOperator< ignore_path_vars >, operations_research::RelocateExpensiveChain< ignore_path_vars >, and operations_research::TSPLns< ignore_path_vars >.
Definition at line 101 of file local_search.cc.
|
inlineprotected |
Definition at line 1259 of file constraint_solveri.h.
|
inline |
Definition at line 1176 of file constraint_solveri.h.
|
inlinevirtual |
Called by Start() after synchronizing the operator with the current assignment. Should be overridden instead of Start() to avoid calling IntVarLocalSearchOperator::Start explicitly.
Reimplemented in operations_research::SwapIndexPairOperator.
Definition at line 1236 of file constraint_solveri.h.
|
inline |
Definition at line 1177 of file constraint_solveri.h.
|
inline |
Definition at line 1213 of file constraint_solveri.h.
|
inline |
Definition at line 1180 of file constraint_solveri.h.
|
inline |
Definition at line 1166 of file constraint_solveri.h.
|
inlinevirtual |
Reimplemented in operations_research::PathOperator< ignore_path_vars >.
Definition at line 1175 of file constraint_solveri.h.
|
inlineoverridevirtual |
This method should not be overridden. Override OnStart() instead which is called before exiting this method.
Implements operations_research::LocalSearchOperator.
Definition at line 1144 of file constraint_solveri.h.
|
inline |
Returns the value in the current assignment of the variable of given index.
Definition at line 1169 of file constraint_solveri.h.
|
inline |
Returns the variable of given index.
Definition at line 1174 of file constraint_solveri.h.