Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
com.google.ortools.constraintsolver.RoutingIndexManager Class Reference

Detailed Description

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 36 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

Constructor & Destructor Documentation

◆ RoutingIndexManager() [1/3]

com.google.ortools.constraintsolver.RoutingIndexManager.RoutingIndexManager ( long cPtr,
boolean cMemoryOwn )

Definition at line 40 of file RoutingIndexManager.java.

◆ RoutingIndexManager() [2/3]

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.

Parameters
num_nodesNumber of nodes in the problem.
num_vehiclesNumber of vehicles in the problem.
depotstart and end
NodeIndex for all vehicles.

Definition at line 86 of file RoutingIndexManager.java.

◆ RoutingIndexManager() [3/3]

com.google.ortools.constraintsolver.RoutingIndexManager.RoutingIndexManager ( int num_nodes,
int num_vehicles,
int[] starts,
int[] ends )

Creates a NodeIndex to variable index mapping.

Parameters
num_nodesNumber of nodes in the problem.
num_vehiclesNumber of vehicles in the problem.
startsArray containing the start NodeIndex for each vehicle.
endsArray containing the end NodeIndex for each vehicle.
Note: starts and ends arrays must have exactly num_vehicles
elements.

Definition at line 99 of file RoutingIndexManager.java.

Member Function Documentation

◆ delete()

synchronized void com.google.ortools.constraintsolver.RoutingIndexManager.delete ( )

Definition at line 66 of file RoutingIndexManager.java.

◆ finalize()

void com.google.ortools.constraintsolver.RoutingIndexManager.finalize ( )
protected

Definition at line 62 of file RoutingIndexManager.java.

◆ getCPtr()

long com.google.ortools.constraintsolver.RoutingIndexManager.getCPtr ( RoutingIndexManager obj)
static

Definition at line 45 of file RoutingIndexManager.java.

◆ getEndIndex()

long com.google.ortools.constraintsolver.RoutingIndexManager.getEndIndex ( int vehicle)

Definition at line 119 of file RoutingIndexManager.java.

◆ getNumberOfIndices()

int com.google.ortools.constraintsolver.RoutingIndexManager.getNumberOfIndices ( )

Definition at line 111 of file RoutingIndexManager.java.

◆ getNumberOfNodes()

int com.google.ortools.constraintsolver.RoutingIndexManager.getNumberOfNodes ( )

Definition at line 103 of file RoutingIndexManager.java.

◆ getNumberOfVehicles()

int com.google.ortools.constraintsolver.RoutingIndexManager.getNumberOfVehicles ( )

Definition at line 107 of file RoutingIndexManager.java.

◆ getStartIndex()

long com.google.ortools.constraintsolver.RoutingIndexManager.getStartIndex ( int vehicle)

Definition at line 115 of file RoutingIndexManager.java.

◆ indexToNode()

int com.google.ortools.constraintsolver.RoutingIndexManager.indexToNode ( long index)

Definition at line 131 of file RoutingIndexManager.java.

◆ nodesToIndices()

long[] com.google.ortools.constraintsolver.RoutingIndexManager.nodesToIndices ( int[] nodes)

Definition at line 127 of file RoutingIndexManager.java.

◆ nodeToIndex()

long com.google.ortools.constraintsolver.RoutingIndexManager.nodeToIndex ( int node)

Definition at line 123 of file RoutingIndexManager.java.

◆ swigRelease()

long com.google.ortools.constraintsolver.RoutingIndexManager.swigRelease ( RoutingIndexManager obj)
static

Definition at line 49 of file RoutingIndexManager.java.

Member Data Documentation

◆ swigCMemOwn

transient boolean com.google.ortools.constraintsolver.RoutingIndexManager.swigCMemOwn
protected

Definition at line 38 of file RoutingIndexManager.java.


The documentation for this class was generated from the following file: