Java Reference

Java Reference

RoutingIndexManager

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: .cpp} auto starts_ends = ...; /// These are NodeIndex. RoutingIndexManager manager(10, 4, starts_ends); // 10 nodes, 4 vehicles. RoutingModel model(manager);

Definition at line 14 of file RoutingIndexManager.java.

Public Member Functions

synchronized void delete ()
 
 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. More...
 
 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)
 

Constructor & Destructor Documentation

◆ RoutingIndexManager() [1/3]

RoutingIndexManager ( long  cPtr,
boolean  cMemoryOwn 
)
inlineprotected

Definition at line 18 of file RoutingIndexManager.java.

◆ RoutingIndexManager() [2/3]

RoutingIndexManager ( int  num_nodes,
int  num_vehicles,
int  depot 
)
inline

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

◆ RoutingIndexManager() [3/3]

RoutingIndexManager ( int  num_nodes,
int  num_vehicles,
int[]  starts,
int[]  ends 
)
inline

Definition at line 49 of file RoutingIndexManager.java.

Member Function Documentation

◆ delete()

synchronized void delete ( )
inline

Definition at line 32 of file RoutingIndexManager.java.

◆ getEndIndex()

long getEndIndex ( int  vehicle)
inline

Definition at line 69 of file RoutingIndexManager.java.

◆ getNumberOfIndices()

int getNumberOfIndices ( )
inline

Definition at line 61 of file RoutingIndexManager.java.

◆ getNumberOfNodes()

int getNumberOfNodes ( )
inline

Definition at line 53 of file RoutingIndexManager.java.

◆ getNumberOfVehicles()

int getNumberOfVehicles ( )
inline

Definition at line 57 of file RoutingIndexManager.java.

◆ getStartIndex()

long getStartIndex ( int  vehicle)
inline

Definition at line 65 of file RoutingIndexManager.java.

◆ indexToNode()

int indexToNode ( long  index)
inline

Definition at line 81 of file RoutingIndexManager.java.

◆ nodesToIndices()

long [] nodesToIndices ( int[]  nodes)
inline

Definition at line 77 of file RoutingIndexManager.java.

◆ nodeToIndex()

long nodeToIndex ( int  node)
inline

Definition at line 73 of file RoutingIndexManager.java.


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