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

Public Member Functions

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)
 

Protected Member Functions

 RoutingIndexManager (long cPtr, boolean cMemoryOwn)
 
void finalize ()
 

Static Protected Member Functions

static long getCPtr (RoutingIndexManager obj)
 
static long swigRelease (RoutingIndexManager obj)
 

Protected Attributes

transient boolean swigCMemOwn
 

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 34 of file RoutingIndexManager.java.

Constructor & Destructor Documentation

◆ RoutingIndexManager() [1/3]

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

Definition at line 38 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.

Definition at line 80 of file RoutingIndexManager.java.

◆ RoutingIndexManager() [3/3]

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

Definition at line 84 of file RoutingIndexManager.java.

Member Function Documentation

◆ delete()

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

Definition at line 64 of file RoutingIndexManager.java.

◆ finalize()

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

Definition at line 60 of file RoutingIndexManager.java.

◆ getCPtr()

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

Definition at line 43 of file RoutingIndexManager.java.

◆ getEndIndex()

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

Definition at line 104 of file RoutingIndexManager.java.

◆ getNumberOfIndices()

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

Definition at line 96 of file RoutingIndexManager.java.

◆ getNumberOfNodes()

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

Definition at line 88 of file RoutingIndexManager.java.

◆ getNumberOfVehicles()

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

Definition at line 92 of file RoutingIndexManager.java.

◆ getStartIndex()

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

Definition at line 100 of file RoutingIndexManager.java.

◆ indexToNode()

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

Definition at line 116 of file RoutingIndexManager.java.

◆ nodesToIndices()

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

Definition at line 112 of file RoutingIndexManager.java.

◆ nodeToIndex()

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

Definition at line 108 of file RoutingIndexManager.java.

◆ swigRelease()

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

Definition at line 47 of file RoutingIndexManager.java.

Member Data Documentation

◆ swigCMemOwn

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

Definition at line 36 of file RoutingIndexManager.java.


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