VehicleRoutingProblemSolverProperties (arcpy.na)

Resumen

Provides access to analysis properties from a vehicle routing problem ArcGIS 10.1 Network Analyst layer. The GetSolverProperties function is used to obtain a VehicleRoutingProblemSolverProperties object from a vehicle routing problem ArcGIS 10.1 Network Analyst layer.

Debate

The VehicleRoutingProblemSolverProperties object provides read and write access to all the analysis properties of a vehicle routing problem ArcGIS 10.1 Network Analyst layer. The object can be used to modify the desired analysis properties of the vehicle routing problem layer, and the corresponding layer can be re-solved to determine the appropriate results. A new vehicle routing problem layer can be created using the Make Vehicle Routing Problem Layer geoprocessing tool. Obtaining the VehicleRoutingProblemSolverProperties object from a new vehicle routing problem layer allows you to reuse the existing layer for subsequent analyses rather than create a new layer for each analysis, which can be slow.

After modifying the properties of the VehicleRoutingProblemSolverProperties object, the corresponding layer can be immediately used with other functions and geoprocessing tools. There is no refresh or update of the layer required to honor the changes modified through the object.

Propiedades

PropiedadExplicaciónTipo de datos
attributeParameters
(Lectura y escritura)

Provides the ability to get or set the parameterized attributes to be used in the analysis. The property returns a Python dictionary. The dictionary key is a two-value tuple consisting of the attribute name and the parameter name. The value for each item in the dictionary is the parameter value.

Parameterized network attributes are used to model some dynamic aspect of an attribute's value. For example, a tunnel with a height restriction of 12 feet can be modeled using a parameter. In this case, the vehicle's height in feet should be specified as the parameter value. If the vehicle is taller than 12 feet, this restriction will then evaluate to true, thereby restricting travel through the tunnel. Similarly, a bridge could have a parameter to specify a weight restriction.

Attempting to modify the attributeParameters property in place won't result in updated values. Instead, you should always use a new dictionary object to set values for the property. The following two code blocks demonstrate the difference between these two approaches.

#Don't attempt to modify the attributeParameters property in place.
#This coding method won't work.

solverProps.attributeParameters[('HeightRestriction', 'RestrictionUsage')] = "PROHIBITED"
#Modify the attributeParameters property using a new dictionary object.
#This coding method works. 

params = solverProps.attributeParameters
params[('HeightRestriction', 'RestrictionUsage')] = "PROHIBITED"
solverProps.attributeParameters = params
If the network analysis layer does not have parameterized attributes, this property returns None.

Dictionary
capacityCount
(Lectura y escritura)

Provides the ability to get or set the number of capacity constraint dimensions required to describe the relevant limits of the vehicles.

Integer
defaultDate
(Lectura y escritura)

Provides the ability to get or set the implied date for time field values that don't have a date specified with the time. If a time field for an order object, such as TimeWindowStart1, has a time-only value, the date is assumed to be the defaultDate property value. For example, if an order has a TimeWindowStart1 value of 9:00 AM and the defaultDate is set to datetime.date(2012, 3, 6), then the entire time value for the field is 9:00 A.M., March 6, 2012. The default date has no effect on time field values that already have a date.

The day of the week can also be specified as the default date using the following dates:

  • Hoy, 30/12/1899
  • Domingo, 31/12/1899
  • Lunes, 1/1/1900
  • Martes, 2/1/1900
  • Miércoles, 3/1/1900
  • Jueves, 4/1/1900
  • Viernes, 5/1/1900
  • Sábado, 6/1/1900

For example, to specify that the implied date for time field values should be Tuesday, specify the property value as 1/2/1900.

DateTime
distanceAttribute
(Lectura y escritura)

Provides the ability to get or set the distance cost attribute used to define the length along the elements of the network.

String
distanceFieldUnits
(Lectura y escritura)

Provides the ability to get or set the distance units used by distance fields of the analysis layer's sublayers and tables (network analysis classes). The unit does not have to be the same as the unit of the network cost attribute specified as the timeAttribute property value. The following is a list of possible values:

  • Centimeters
  • Decimeters
  • Feet
  • Inches
  • Kilometers
  • Meters
  • Miles
  • Millimeters
  • NauticalMiles
  • Yards

String
excessTransitTimeImportance
(Lectura y escritura)

Provides the ability to get or set the importance of reducing excess transit time. Excess transit time is the amount of time exceeding the time required to travel directly between the paired orders. The excess time results from breaks or travel to other orders or depots between visits to the paired orders. The following is a list of possible values:

  • HighThe solver tries to find a solution with less excess transit time between paired orders at the expense of increasing the overall travel costs. It makes sense to use this setting if you are transporting people between paired orders and you want to shorten their ride time. This is characteristic of taxi services.
  • MediumThe solver looks for a balance between reducing excess transit time and reducing the overall solution cost.
  • LowThe solver tries to find a solution that minimizes overall solution cost, regardless of excess transit time. This setting is commonly used with courier services. Since couriers transport packages as opposed to people, they don't need to worry about ride time. Using Low allows the couriers to service paired orders in the proper sequence and minimize the overall solution cost.
String
outputPathShape
(Lectura y escritura)

Provides the ability to get or set the shape type for the route features that are output by the solver. The following is a list of possible values:

  • TRUE_LINES_WITH_MEASURESThe output routes will have the exact shape of the underlying network sources. Furthermore, the output includes route measurements for linear referencing. The measurements increase from the first stop and record the cumulative impedance to reach a given position.
  • TRUE_LINES_WITHOUT_MEASURESThe output routes will have the exact shape of the underlying network sources.
  • STRAIGHT_LINESThe output route shape will be straight lines connecting orders and depot visits as per the route sequence.
  • NO_LINESNo shape will be generated for the output routes. You will also not be able to generate driving directions.
String
restrictions
(Lectura y escritura)

Provides the ability to get or set a list of restriction attributes that are applied for the analysis. An empty list, [], indicates that no restriction attributes are used for the analysis.

String
solverName
(Sólo lectura)

Returns the name of the solver being referenced by the Network Analyst layer used to obtain the solver properties object. The property always returns the string value Vehicle Routing Problem Solver when accessed from a VehicleRoutingProblemSolverProperties object.

String
timeAttribute
(Lectura y escritura)

Provides the ability to get or set the time-based network cost attribute used to define the traversal time along the elements of the network. This cost attribute is minimized by the solver while finding the solution.

String
timeFieldUnits
(Lectura y escritura)

Provides the ability to get or set the time unit used by the temporal fields of the analysis layer's sublayers and tables (network analysis classes). The unit does not have to be the same as the unit of the network cost attribute specified as the timeAttribute property value. The following is a list of possible values:

  • Days
  • Hours
  • Minutes
  • Seconds

String
timeWindowViolationImportance
(Lectura y escritura)

Provides the ability to get or set the importance of honoring time windows without causing violations. A time window violation occurs when a route arrives at an order, depot, or break after a time window has closed. The violation is the interval between the end of the time window and the arrival time of a route. The following is a list of possible values:

  • HighThe solver tries to find a solution that minimizes time window violations at the expense of increasing the overall travel time. Choose this option if arriving on time at orders is more important to you than minimizing your overall solution cost. This may be the case if you are meeting customers at your orders and you don't want to inconvenience them with tardy arrivals (another option is to use hard time windows that can't be violated at all).Given other constraints of a vehicle routing problem, it may be impossible to visit all the orders within their time windows. In this case, even using this option might produce violations.
  • MediumThe solver looks for a balance between meeting time windows and reducing the overall solution cost.
  • LowThe solver tries to find a solution that minimizes overall travel time, regardless of time windows. Choose this option if respecting time windows is less important than reducing your overall solution cost. You may want to use this setting if you have a growing backlog of service requests. For the purpose of servicing more orders in a day and reducing the backlog, you can choose this option even though customers will be inconvenienced with your fleet's late arrivals.
String
useHierarchy
(Lectura y escritura)

Controls the use of the hierarchy attribute while performing the analysis. The following is a list of possible values:

  • USE_HIERARCHY Use the hierarchy attribute for the analysis. Using a hierarchy results in the solver preferring higher-order edges to lower-order edges. Hierarchical solves are faster, and they can be used to simulate the preference of a driver who chooses to travel on freeways over local roads when possible—even if that means a longer trip. This option is applicable only if the network dataset referenced by the Network Analyst layer has a hierarchy attribute. A value of True can also be used to specify this option.
  • NO_HIERARCHYDo not use the hierarchy attribute for the analysis. Not using a hierarchy yields an exact route for the network dataset. A value of False can also be used to specify this option.
String
uTurns
(Lectura y escritura)

Provides the ability to get or set the policy that indicates how the U-turns at junctions that could occur during network traversal between stops are being handled by the solver. The following is a list of possible values:

  • ALLOW_UTURNSU-turns are permitted at junctions with any number of connected edges.
  • NO_UTURNSU-turns are prohibited at all junctions, regardless of junction valency. Note, however, that U-turns are still permitted at network locations even when this setting is chosen; however, you can set the individual network locations' CurbApproach property to prohibit U-turns there as well.
  • ALLOW_DEAD_ENDS_ONLYU-turns are prohibited at all junctions, except those that have only one adjacent edge (a dead end).
  • ALLOW_DEAD_ENDS_AND_INTERSECTIONS_ONLYU-turns are prohibited at junctions where exactly two adjacent edges meet but are permitted at intersections (junctions with three or more adjacent edges) and dead ends (junctions with exactly one adjacent edge). Oftentimes, networks have extraneous junctions in the middle of road segments. This option prevents vehicles from making U-turns at these locations.
String

Ejemplo de código

VehicleRoutingProblemSolverProperties example

The script shows how to update the Distance Attribute, Default Date, U-Turns at Junctions, and Output Shape Type properties for an existing vehicle routing problem layer in the ArcMap table of contents. It assumes that a vehicle routing problem layer called Store Delivery Routes has been created in a new map document based on the tutorial network dataset of the San Francisco region.

#Get the vehicle routing problem layer object from a layer named
#"Store Delivery Routes" in the table of contents
vrpLayer = arcpy.mapping.Layer("Store Delivery Routes")

#Get the solver properties object from the vehicle routing problem layer
solverProps = arcpy.na.GetSolverProperties(vrpLayer)

#Update the properties for the vehicle routing problem layer using the 
#solver properties object
solverProps.distanceAttribute = "Meters"
#Set the default date to be Monday
solverProps.defaultDate = datetime.date(1900,1,1)
solverProps.uTurns = "NO_UTURNS"
solverProps.outputPathShape = "STRAIGHT_LINES"

Temas relacionados

4/26/2014