Formatted Dictionaries

geoVeRoPy uses dictionaries to store different objects such as nodes, arcs, etc. One of the main reasons for doing so is that dictionaries do not require additional Python packages. Additionally, dictionaries can have flexible definitions of the keys, so that the data used in geoVeRoPy can be used in other Python packages that the user is using. In addition, two easy-to-use functions are provided (in common.py) for exporting and importing dictionaries. They are saveDictionary() and loadDictionary().

nodes

The nodes dictionary has to contain the location information of a node, additionally, the dictionary may include other information such as demands, time windows, etc.

  • ‘loc’: The location of the nodes in (x, y) or (lat, lon). In some functions, the key of ‘loc’ may be redirected using locFieldName argument.

  • ‘demand’: The demand of each node. The key of ‘demand’ may be redirected using demandFieldName argument.

  • ‘timeWindow’: The available time window of each node. The key of ‘timeWindow’ may be redirected using timeWindowFieldName argument.

  • ‘neighbor’: Polygons that are surrounding nodes. In the format of a list of points. This is particularly useful for the “close-enough” problems.

  • ‘timedSeq’: A list of 3-tuples, in the format of (x, y, time). This particularly useful for the “moving target” problems.

  • ‘color’: Used in plotNodes(), indicating the color of each node.

  • ‘marker’: Used in plotNodes(), indicating the marker of each node.

  • ‘markerSize’: Used in plotNodes(), indicating the size of the marker of each node.

  • ‘label’: Used in plotNodes(), if provided, a label will be placed at the node location.

  • ‘ha’: Used in plotNodes(), horizontal alignment of the label, options are ‘left’, ‘center’, and ‘right’.

  • ‘va’: Used in plotNodes(), vertical alignment of the label, options are ‘top’, ‘middle’, and ‘bottom’.

Who creates/modifies it?

Who uses it?

  • rndNodeNeighbors() must use an existing nodes dictionary as input.

  • matrixDist() takes nodes as input, calculates traveling matrix between nodes.

  • plotNodes() takes nodes as input, returns a matplotlib figure with nodes plotted.

  • plotNodeSeq() takes nodes as input, additionally, this function requires a list of node IDs to plot a sequence of nodes. The function returns a matplotlib figure.

  • solveTSP() takes nodes as input, finds the TSP route.

arcs

The arcs dictionary has to contain the location of both ends.

  • ‘arc’: The location of both ends of the arc. In some functions, the key of ‘arc’ may be redirected using arcFieldName argument.

  • ‘color’: Used in plotArcs(), indicating the color of each arc.

  • ‘label’: Used in plotArcs(), if provided, a label will be placed at middle of the arc.

  • ‘ha’: Used in plotArcs(), horizontal alignment of the label, options are ‘left’, ‘center’, and ‘right’.

  • ‘va’: Used in plotArcs(), vertical alignment of the label, options are ‘top’, ‘middle’, and ‘bottom’.

Who creates/modifies it?

Who uses it?

  • plotArcs() takes arcs as input, creates a matplotlib figure with arcs plotted.

polygons

The polygon dictionary defines the information of polygons. This dictionary is rarely used, in most scenarios, a polys is used instead. The polys data type is a list of poly s, which is a list of points (in (x, y) format, or [x, y] format) that defines a polygon.

  • ‘anchor’: A point within the polygon to “represent” the polygon. In some functions, the key of ‘anchor’ may be redirected using anchorFieldName argument.

  • ‘poly’: A polygon surrounding ‘anchor’.

Who creates/modifies it?

  • rndPolys() creates polygons if returnAsListFlag is set to be False, otherwise, this function creates polys.

Who uses it?

  • plotPolygons() takes polygons as input, creates a matplotlib figure with polygons plotted.