ArcGIS Desktop

  • ドキュメント
  • サポート

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS Desktop

完全なプロ仕様の GIS

ArcGIS Enterprise

エンタープライズ GIS

ArcGIS for Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

ArcMap

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • エクステンション

VehicleRoutingProblemSolverProperties

  • サマリー
  • 説明
  • プロパティ
  • メソッドの概要
  • メソッド
  • コードのサンプル

サマリー

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

説明

The VehicleRoutingProblemSolverProperties object provides read and write access to all the analysis properties of a vehicle routing problem 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.

プロパティ

プロパティ説明データ タイプ
attributeParameters
(読み書き)

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
(読み書き)

各車両の積載容量を示す場合に必要な積載容量の制約を示すディメンション数を取得または設定できます。

Integer
defaultDate
(読み書き)

日付が指定されない時間フィールド値で使用する日付を取得または設定できます。訪問先オブジェクトに対する時間フィールド(TimeWindowStart1 など)が時刻のみを示す値である場合、日付は defaultDate プロパティ値となります。たとえば、訪問先の TimeWindowStart1 値が 9:00 で defaultDate が datetime.date(2012, 3, 6) に設定されている場合、フィールドの時間全体の値は 2012/3/6 9:00 になります。デフォルトの日付はすでに日付を保持している時間フィールド値には無効です。

デフォルトの日付では、次の日付を使用して曜日を指定することもできます。

  • 今日 - 1899/12/30
  • 日 - 1899/12/31
  • 月 - 1900/1/1
  • 火 - 1900/1/2
  • 水 - 1900/1/3
  • 木 - 1900/1/4
  • 金 - 1900/1/5
  • 土 - 1900/1/6

たとえば、時間フィールド値に対する暗黙の日付を火曜日に指定するには、プロパティ値を「1900/1/2」に指定します。

DateTime
distanceAttribute
(読み書き)

ネットワークのエレメントに沿って長さを定義するのに使用する距離コスト属性を取得または設定できます。

String
distanceFieldUnits
(読み書き)

解析レイヤのサブレイヤおよびテーブル(ネットワーク解析のクラス)の距離的なフィールドで使用される距離の単位を取得または設定できます。この単位は、timeAttribute プロパティ値として指定されたネットワーク コスト属性の単位と同じである必要はありません。設定可能な値の一覧を次に示します。

  • センチメートル
  • デシメートル
  • フィート
  • インチ
  • キロメートル
  • メートル
  • マイル
  • ミリメートル
  • 海里マイル
  • ヤード

String
excessTransitTimeImportance
(読み書き)

超過移動時間の短縮の重要度を取得または設定できます。超過移動時間とは、訪問先ペア間を直接移動するのに必要な時間に対する超過時間です。この超過時間は、訪問先ペアへの立ち寄りの途中で、休憩を取ったり他の訪問先や拠点に移動することで発生します。設定可能な値の一覧を次に示します。

  • High —全体の移動コストの増大を無視して、訪問先ペア間で超過移動時間が短いソリューションを検索します。訪問先ペア間で人を輸送し、乗車時間を短くしたい場合、この設定を使用すると便利です。これはタクシー サービスの特徴です。
  • Medium —超過移動時間を短縮することと、全体のソリューション コストを削減することのバランスを取ります。
  • Low —超過移動時間を無視して、全体のソリューション コストを最小にするソリューションを検索します。この設定は一般に宅配サービスで使用されます。宅配業者は人ではなく荷物を輸送するので、乗車時間について心配する必要はありません。宅配業者は [低] を使用することで、訪問先ペアに適切な順序でサービスを提供し、全体のソリューション コストを最小にすることができます。
String
outputPathShape
(読み書き)

解析で出力されるルート フィーチャの形状タイプを取得または設定できます。設定可能な値の一覧を次に示します。

  • TRUE_LINES_WITH_MEASURES(計測値を含む正確なライン) —出力ルートはネットワーク ソースの正確な形状を保持します。リニア リファレンスのためのルートのメジャー値が出力に含まれます。メジャー値は、最初のストップから増加し、指定された位置に到着するまでの累積インピーダンスを記録します。
  • TRUE_LINES_WITHOUT_MEASURES(計測値を含まない正確なライン) —出力ルートはネットワーク ソースの正確な形状を保持します。
  • STRAIGHT_LINES(直線) —出力ルート形状はルート順序ごとに訪問先と拠点への立ち寄りを結ぶ直線になります。
  • NO_LINES(ラインなし) —出力ルートに形状は生成されません。ルート案内を生成することもできません。
String
restrictions
(読み書き)

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
(読み取り専用)

解析プロパティ オブジェクトを取得するために使用されている Network Analyst レイヤが参照している解析の名前を返します。このプロパティは、VehicleRoutingProblemSolverProperties オブジェクトからアクセスされたときに必ず文字列「Vehicle Routing Problem Solver」を返します。

String
timeAttribute
(読み書き)

ネットワークのエレメントに沿って通過時間を定義するのに使用する時間を基準としたネットワーク コスト属性を取得または設定できます。このコスト属性は、解析によってソリューションが検出されると同時に最小化されます。

String
timeFieldUnits
(読み書き)

解析レイヤのサブレイヤおよびテーブル(ネットワーク解析のクラス)の一時的なフィールドで使用される時間の単位を取得または設定できます。この単位は、timeAttribute プロパティ値として指定されたネットワーク コスト属性の単位と同じである必要はありません。設定可能な値の一覧を次に示します。

  • 日
  • 時間
  • 分
  • 秒

String
timeWindowViolationImportance
(読み書き)

違反を招くことなく、タイム ウィンドウの条件を満たす重要度を取得または設定できます。タイム ウィンドウ違反は、タイム ウィンドウが閉じてから訪問先、拠点、または休憩にルートが到着した場合に発生します。この超過時間は、タイム ウィンドウの終了からルートの到着時間までの時間です。設定可能な値の一覧を次に示します。

  • High —全体の移動時間の増大を無視して、タイム ウィンドウ違反を最小にするソリューションを検索します。全体のソリューション コストを最小にするよりも訪問先に時間どおりに到着することが重要である場合はこのオプションを選択します。訪問先で顧客と打ち合わせをする予定があり、遅刻して先方に迷惑をかけたくないという場合に使用します(別のオプションとして、超過がまったく許されないハード タイム ウィンドウを使用することもできます)。配車ルートの他の制約が指定されている場合、タイム ウィンドウの期間内に立ち寄ることができない訪問先が出てくると考えられます。この場合は、このオプションを使用しても違反が発生することがあります。
  • Medium —タイム ウィンドウの条件を満たすと同時に全体のソリューション コストがより小さくなるルートを求めます。
  • Low —タイム ウィンドウを無視して、全体の移動時間を最小にするソリューションを検索します。タイム ウィンドウの条件を満たすことが全体のソリューション コストを削減することより重要でない場合はこのオプションを選択します。未処理のサービス依頼が増えている場合は、この設定を使用すると便利です。保有車両の到着が遅れて顧客に迷惑をかけることになっても、1 日にサービスを提供する訪問先の数を増やして手持ちの注文をさばくために、このオプションを選択することができます。
String
useHierarchy
(読み書き)

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_HIERARCHY —Do 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
(読み書き)

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_UTURNS —U-turns are permitted at junctions with any number of connected edges.
  • NO_UTURNS —U-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_ONLY —U-turns are prohibited at all junctions, except those that have only one adjacent edge (a dead end).
  • ALLOW_DEAD_ENDS_AND_INTERSECTIONS_ONLY —U-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). Often, networks have extraneous junctions in the middle of road segments. This option prevents vehicles from making U-turns at these locations.
String

メソッドの概要

メソッド説明
applyTravelMode (travel_mode)

Updates the analysis properties of a network analyst layer based on a travel mode object. The updated network analyst layer can then be solved to complete the analysis.

メソッド

applyTravelMode (travel_mode)
パラメーター説明データ タイプ
travel_mode

A variable that references a travel mode object derived from a network dataset. A list of travel mode objects can be obtained by calling the arcpy.na.GetTravelModes function.

Object

When a network analyst layer is created, it is assigned default values for all of its analysis properties. The individual analysis properties can be updated using a solver properties object obtained from the network analyst layer. A travel mode stores a predefined set of analysis settings that help to perform a particular analysis, such as a walking time travel mode that stores the analysis settings required to perform a time-based walking analysis.

Using the applyTravelMode method, all the analysis settings that are defined in a travel mode can be applied at once. After the analysis properties are updated, the network analyst layer can be solved to complete the analysis.

If there is an error when updating the solver properties, such as when the provided travel mode references properties that don't exist on the current network dataset or references properties that are no longer applicable to the network dataset that was used to create the network analyst layer corresponding to the solver properties object, no exceptions are raised. The method will execute successfully, but you will get errors when you try to solve such a network analyst layer.

If the travel_mode parameter does not reference a travel mode object or a string, a TypeError exception is raised. If the travel_mode parameter references a string and the string cannot be internally converted to a valid string representation of a travel mode object, a ValueError exception is raised.

コードのサンプル

VehicleRoutingProblemSolverProperties example 1

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"
ApplyTravelMode example 2 (workflow)

This script shows how to find routes for a fleet of trucks using the Trucking Time travel mode.

#Import modules
import os
import arcpy

#Define variables
workspace = "C:/data/SanDiego.gdb"
output_folder = "C:/data/output"
nds = os.path.join(workspace, "Transportation", "Streets_ND")
orders = os.path.join(workspace, "Orders")
depots = os.path.join(workspace, "TruckDepots")
routes = os.path.join(workspace, "Drivers")
analysis_layer_name = "TruckRoutes"

#Set environment variables
arcpy.env.overwriteOutput = True

#Check out the network analyst extension
arcpy.CheckOutExtension("network")

#Create a new closest facility analysis layer
make_layer_result = arcpy.na.MakeVehicleRoutingProblemLayer(nds, analysis_layer_name,
                                                            "TravelTime")
analysis_layer = make_layer_result.getOutput(0)

#Add orders, depots and routes to the analysis layer using default field mappings         
sub_layer_names = arcpy.na.GetNAClassNames(analysis_layer)
order_layer_name = sub_layer_names["Orders"]
depot_layer_name = sub_layer_names["Depots"]
route_layer_name = sub_layer_names["Routes"]
arcpy.na.AddLocations(analysis_layer, order_layer_name, orders, "#", "#")
arcpy.na.AddLocations(analysis_layer, depot_layer_name, depots, "#", "#")
arcpy.na.AddLocations(analysis_layer, route_layer_name, routes, "#", "#")

#Get the Trucking Time travel mode from the network dataset
travel_modes = arcpy.na.GetTravelModes(nds)
trucking_mode = travel_modes["Trucking Time"]

#Apply the travel mode to the analysis layer
solver_properties = arcpy.na.GetSolverProperties(analysis_layer)
solver_properties.applyTravelMode(trucking_mode)

#Solve the analysis layer skipping any invalid orders and save the result as a layer file          
arcpy.na.Solve(analysis_layer, "SKIP")

output_layer = os.path.join(output_folder, analysis_layer_name + ".lyr")
arcpy.management.SaveToLayerFile(analysis_layer, output_layer, "RELATIVE")

arcpy.AddMessage("Completed")

関連トピック

  • 配車ルート解析

ArcGIS Desktop

  • ホーム
  • ドキュメント
  • サポート

ArcGIS プラットフォーム

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • スタッフ ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
ご意見・ご感想をお寄せください。
© Copyright 2016 Environmental Systems Research Institute, Inc. | プライバシー | リーガル