C++ Reference: class PathOperator

This documentation is automatically generated.

Base class of the local search operators dedicated to path modifications (a path is a set of nodes linked together by arcs). This family of neighborhoods supposes they are handling next variables representing the arcs (var[i] represents the node immediately after i on a path). Several services are provided:
   - arc manipulators (SetNext(), ReverseChain(), MoveChain())
   - path inspectors (Next(), IsPathEnd())
   - path iterators: operators need a given number of nodes to define a neighbor; this class provides the iteration on a given number of (base) nodes which can be used to define a neighbor (through the BaseNode method)
Subclasses only need to override MakeNeighbor to create neighbors using the services above (no direct manipulation of assignments).

Return type: virtual bool


Return type: int64

Arguments: int64 node_index

Returns the index of the node after the node of index node_index in the current assignment.


Return type: int

Number of next variables.


Return type: int64

Arguments: int64 node_index

Returns the index of the path to which the node of index node_index belongs in the current assignment.


Arguments: const std::vector<IntVar*>& next_vars, const std::vector<IntVar*>& path_vars, int number_of_base_nodes, bool skip_locally_optimal_paths, std::function<int(int64)> start_empty_path_class

Builds an instance of PathOperator from next and path variables. 'number_of_base_nodes' is the number of nodes needed to define a neighbor. 'start_empty_path_class' is a callback returning an index such that if c1 = start_empty_path_class(StartNode(p1)), c2 = start_empty_path_class(StartNode(p2)), p1 and p2 are path indices, then if c1 == c2, p1 and p2 are equivalent if they are empty. This is used to remove neighborhood symmetries on equivalent empty paths; for instance if a node cannot be moved to an empty path, then all moves moving the same node to equivalent empty paths will be skipped. 'start_empty_path_class' can be nullptr in which case no symmetries will be removed.



Return type: void


Return type: bool

Arguments: int index

TODO(user): Make the following methods protected.