Google OR-Tools v9.11
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 index) 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 --— | |
Public Member Functions inherited from operations_research::LocalSearchOperator | |
LocalSearchOperator () | |
~LocalSearchOperator () override | |
virtual void | Reset () |
virtual const LocalSearchOperator * | Self () const |
virtual bool | HasFragments () const |
Public Member Functions inherited from operations_research::BaseObject | |
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 1063 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 1068 of file constraint_solveri.h.
|
inlineoverride |
Definition at line 1079 of file constraint_solveri.h.
|
inline |
Definition at line 1126 of file constraint_solveri.h.
|
inline |
Definition at line 1123 of file constraint_solveri.h.
|
inlineprotected |
Definition at line 1203 of file constraint_solveri.h.
|
inline |
Definition at line 1164 of file constraint_solveri.h.
|
inline |
Definition at line 1129 of file constraint_solveri.h.
|
inline |
Definition at line 1127 of file constraint_solveri.h.
|
inlineoverridevirtual |
Reimplemented from operations_research::LocalSearchOperator.
Definition at line 1081 of file constraint_solveri.h.
|
inlineprotected |
Definition at line 1196 of file constraint_solveri.h.
|
inlinevirtual |
Reimplemented in operations_research::TwoOpt.
Definition at line 1104 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 >, and operations_research::SwapIndexPairOperator.
Definition at line 83 of file local_search.cc.
|
protectedvirtual |
Creates a new neighbor. It returns false when the neighborhood is completely explored.
Reimplemented in operations_research::BaseInactiveNodeToPathOperator, operations_research::BaseLns, operations_research::ChangeValue, operations_research::MakePairActiveOperator, operations_research::PathOperator, operations_research::RelocateExpensiveChain, and operations_research::TSPLns.
Definition at line 104 of file local_search.cc.
|
inlineprotected |
Definition at line 1199 of file constraint_solveri.h.
|
inline |
Definition at line 1116 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 1176 of file constraint_solveri.h.
|
inline |
Definition at line 1117 of file constraint_solveri.h.
|
inline |
Definition at line 1153 of file constraint_solveri.h.
|
inline |
Definition at line 1120 of file constraint_solveri.h.
|
inline |
Definition at line 1106 of file constraint_solveri.h.
|
inlinevirtual |
Reimplemented in operations_research::PathOperator.
Definition at line 1115 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 1084 of file constraint_solveri.h.
|
inline |
Returns the value in the current assignment of the variable of given index.
Definition at line 1109 of file constraint_solveri.h.
|
inline |
Returns the variable of given index.
Definition at line 1114 of file constraint_solveri.h.