![]() |
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:
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 34 of file RoutingIndexManager.java.
Public Member Functions | |
| RoutingIndexManager (long cPtr, boolean cMemoryOwn) | |
| synchronized void | delete () |
| RoutingIndexManager (int num_nodes, int num_vehicles, int depot) | |
| RoutingIndexManager (int num_nodes, int num_vehicles, int[] starts, int[] ends) | |
| int | getNumberOfNodes () |
| int | getNumberOfVehicles () |
| int | getNumberOfIndices () |
| long | getStartIndex (int vehicle) |
| long | getEndIndex (int vehicle) |
| long | nodeToIndex (int node) |
| long[] | nodesToIndices (int[] nodes) |
| int | indexToNode (long index) |
Static Public Member Functions | |
| static long | getCPtr (RoutingIndexManager obj) |
| static long | swigRelease (RoutingIndexManager obj) |
Protected Member Functions | |
| void | finalize () |
Protected Attributes | |
| transient boolean | swigCMemOwn |
| com.google.ortools.constraintsolver.RoutingIndexManager.RoutingIndexManager | ( | long | cPtr, |
| boolean | cMemoryOwn ) |
Definition at line 38 of file RoutingIndexManager.java.
| com.google.ortools.constraintsolver.RoutingIndexManager.RoutingIndexManager | ( | int | num_nodes, |
| int | num_vehicles, | ||
| int | depot ) |
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 80 of file RoutingIndexManager.java.
| com.google.ortools.constraintsolver.RoutingIndexManager.RoutingIndexManager | ( | int | num_nodes, |
| int | num_vehicles, | ||
| int[] | starts, | ||
| int[] | ends ) |
Definition at line 84 of file RoutingIndexManager.java.
| synchronized void com.google.ortools.constraintsolver.RoutingIndexManager.delete | ( | ) |
Definition at line 64 of file RoutingIndexManager.java.
|
protected |
Definition at line 60 of file RoutingIndexManager.java.
|
static |
Definition at line 43 of file RoutingIndexManager.java.
| long com.google.ortools.constraintsolver.RoutingIndexManager.getEndIndex | ( | int | vehicle | ) |
Definition at line 104 of file RoutingIndexManager.java.
| int com.google.ortools.constraintsolver.RoutingIndexManager.getNumberOfIndices | ( | ) |
Definition at line 96 of file RoutingIndexManager.java.
| int com.google.ortools.constraintsolver.RoutingIndexManager.getNumberOfNodes | ( | ) |
Definition at line 88 of file RoutingIndexManager.java.
| int com.google.ortools.constraintsolver.RoutingIndexManager.getNumberOfVehicles | ( | ) |
Definition at line 92 of file RoutingIndexManager.java.
| long com.google.ortools.constraintsolver.RoutingIndexManager.getStartIndex | ( | int | vehicle | ) |
Definition at line 100 of file RoutingIndexManager.java.
| int com.google.ortools.constraintsolver.RoutingIndexManager.indexToNode | ( | long | index | ) |
Definition at line 116 of file RoutingIndexManager.java.
| long[] com.google.ortools.constraintsolver.RoutingIndexManager.nodesToIndices | ( | int[] | nodes | ) |
Definition at line 112 of file RoutingIndexManager.java.
| long com.google.ortools.constraintsolver.RoutingIndexManager.nodeToIndex | ( | int | node | ) |
Definition at line 108 of file RoutingIndexManager.java.
|
static |
Definition at line 47 of file RoutingIndexManager.java.
|
protected |
Definition at line 36 of file RoutingIndexManager.java.