![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
Manager for any NodeIndex <-> variable index conversion. The routing solver
uses variable indices internally and through its API. These variable indices
are tricky to manage directly because one Node can correspond to a multitude
of variables, depending on the number of times they appear in the model, and
if they're used as start and/or end points. This class aims to simplify
variable index usage, allowing users to use NodeIndex instead.
Usage:
.. code-block:: c++
auto starts_ends = ...; /// These are NodeIndex.
RoutingIndexManager manager(10, 4, starts_ends); // 10 nodes, 4 vehicles.
RoutingModel model(manager);
Then, use 'manager.NodeToIndex(node)' whenever model requires a variable
index.
Note: the mapping between node indices and variables indices is subject to
change so no assumption should be made on it. The only guarantee is that
indices range between 0 and n-1, where n = number of vehicles * 2 (for start
and end nodes) + number of non-start or end nodes.
Definition at line 4713 of file pywrapcp.py.
Public Member Functions | |
| __init__ (self, *args) | |
| GetNumberOfNodes (self) | |
| GetNumberOfVehicles (self) | |
| GetNumberOfIndices (self) | |
| GetStartIndex (self, vehicle) | |
| GetEndIndex (self, vehicle) | |
| NodeToIndex (self, node) | |
| IndexToNode (self, index) | |
Properties | |
| thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") | |
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.__init__ | ( | self, | |
| * | args ) |
Creates a NodeIndex to variable index mapping for a problem containing 'num_nodes', 'num_vehicles' and the given starts and ends for each vehicle. If used, any start/end arrays have to have exactly 'num_vehicles' elements.
Definition at line 4742 of file pywrapcp.py.
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetEndIndex | ( | self, | |
| vehicle ) |
Definition at line 4763 of file pywrapcp.py.
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetNumberOfIndices | ( | self | ) |
Definition at line 4757 of file pywrapcp.py.
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetNumberOfNodes | ( | self | ) |
Definition at line 4751 of file pywrapcp.py.
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetNumberOfVehicles | ( | self | ) |
Definition at line 4754 of file pywrapcp.py.
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetStartIndex | ( | self, | |
| vehicle ) |
Definition at line 4760 of file pywrapcp.py.
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.IndexToNode | ( | self, | |
| index ) |
Definition at line 4769 of file pywrapcp.py.
| ortools.constraint_solver.pywrapcp.RoutingIndexManager.NodeToIndex | ( | self, | |
| node ) |
Definition at line 4766 of file pywrapcp.py.
|
static |
Definition at line 4739 of file pywrapcp.py.