Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
ortools.constraint_solver.pywrapcp.RoutingIndexManager Class Reference
Inheritance diagram for ortools.constraint_solver.pywrapcp.RoutingIndexManager:

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")
 

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:

  .. 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 4515 of file pywrapcp.py.

Constructor & Destructor Documentation

◆ __init__()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.__init__ ( self,
* args )

Definition at line 4544 of file pywrapcp.py.

Member Function Documentation

◆ GetEndIndex()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetEndIndex ( self,
vehicle )

Definition at line 4559 of file pywrapcp.py.

◆ GetNumberOfIndices()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetNumberOfIndices ( self)

Definition at line 4553 of file pywrapcp.py.

◆ GetNumberOfNodes()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetNumberOfNodes ( self)

Definition at line 4547 of file pywrapcp.py.

◆ GetNumberOfVehicles()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetNumberOfVehicles ( self)

Definition at line 4550 of file pywrapcp.py.

◆ GetStartIndex()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.GetStartIndex ( self,
vehicle )

Definition at line 4556 of file pywrapcp.py.

◆ IndexToNode()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.IndexToNode ( self,
index )

Definition at line 4565 of file pywrapcp.py.

◆ NodeToIndex()

ortools.constraint_solver.pywrapcp.RoutingIndexManager.NodeToIndex ( self,
node )

Definition at line 4562 of file pywrapcp.py.

Property Documentation

◆ thisown

ortools.constraint_solver.pywrapcp.RoutingIndexManager.thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
static

Definition at line 4541 of file pywrapcp.py.


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