ガイドAPIリファレンス
ガイド

テリトリー別に旅程を最適化する

多くの配送会社は、ビジネス上の制約により、強力な顧客関係を維持するため、およびその他の理由から、ドライバーと車両の組み合わせで特定の地理的エリアにサービスを提供するモードで運営されています。

テリトリーの最適化機能を使用すると、ルートを最適化する際に、特定のテリトリー間で車両をプログラムで割り当てることができます。リクエストを作成しながらテリトリーの最適化を行う際、実行するジョブの場所によって、作業量と運行管理の処理能力のバランスを制御できます。車両または車両グループを特定のテリトリーに割り当てて、希望するテリトリーで車両を運行できるようにするか、他のテリトリーでの運行を制限します。

Tour Planningでは、車両が許可されている、または希望するジョブの空間的制約を定義するために、テリトリーが使用されます。問題を作成する場合、各テリトリーはidによって参照されます。このidはユーザーの完全な管理下にあり、地理的な場所や行政上の命名規則には拘束されません。idのテリトリーは、車両とジョブの両方の定義で一貫して使用される一意の識別子です。ユーザーは、ジョブの場所を正しく表すように、ジョブにテリトリーを割り当てる責任があります。

次のセクションでは、限定、優先、優先順位付けされたテリトリータイプについて説明します。

限定テリトリー

限定テリトリー機能は、車両または車両グループが特定のテリトリーでのみジョブを実行するよう制限する必要がある場合に適用できます。各車両が特定のテリトリー (都市内の1エリアなど) を訪問することのみを許可されている運行管理が該当します。

特定の車両typeに対し、そのterritoriesフィールドには、たとえば、車両が制限されているテリトリーNorthidが含まれます。

"fleet": {
   "types": [
       {
           ...
           "territories": {
               "strict": true,
               "items": [{"id": "North"}]
           }
       }
   ]
}

jobにはterritoryIdsフィールドで指定されたテリトリーのid (この例ではNorth) があります。

"plan": {
    "jobs": [
        {
            ...
            "tasks": {
                "deliveries": [
                    {
                        "places": [{
                            ...
                            "territoryIds": ["North"]
                        }]
                    }
                ]
            }
        }
    ]
}

以下の例では、2台の車両と、異なるエリアで実行される3つのジョブがあります。ジョブAは北で、ジョブBは南、ジョブCはテリトリーが指定されていません。この問題では、各車両がこれらのテリトリーのいずれか1つのみを訪問できます。

集配センター (@)、3つのジョブ (A、B、C)、および限定テリトリー (北:紫、南:赤) を含むジョブプラン
{
    "fleet": {
        "types": [
            {
                "id": "car_1",
                "profile": "car_profile",
                "costs": {
                    "distance": 0.0001,
                    "time": 0
                },
                "territories": {
                    "strict": true,
                    "items": [
                        {
                            "id": "North"
                        }
                    ]
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2021-07-04T06:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        },
                        "end": {
                            "time": "2021-07-04T13:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        }
                    }
                ],
                "capacity": [
                    0
                ],
                "amount": 1
            },
            {
                "id": "car_2",
                "profile": "car_profile",
                "costs": {
                    "distance": 0.0001,
                    "time": 0
                },
                "territories": {
                    "strict": true,
                    "items": [
                        {
                            "id": "South"
                        }
                    ]
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2021-07-04T06:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        },
                        "end": {
                            "time": "2021-07-04T13:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        }
                    }
                ],
                "capacity": [
                    0
                ],
                "amount": 1
            }
        ],
        "profiles": [
            {
                "type": "car",
                "name": "car_profile"
            }
        ]
    },
    "plan": {
        "jobs": [
            {
                "id": "A",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.628661,
                                        "lng": -122.342312
                                    },
                                    "territoryIds": [
                                        "North"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "B",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.623887,
                                        "lng": -122.341163
                                    },
                                    "territoryIds": [
                                        "South"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "C",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.622523,
                                        "lng": -122.337323
                                    },
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

この問題のソリューションでは、車両car_1territoryIds属性にNorthが含まれるジョブ (この場合はジョブAのみ) にのみ割り当てられます。したがって、車両car_2はテリトリーSouthにあるジョブBに割り当てられます。ジョブC (NorthでもSouthでもない) は、ルートに含まれていません。

car_1 (イエロールート) およびcar_2 (グリーンルート) を利用した限定テリトリーのソリューション
{
    "statistic": {
        "cost": 0.2675,
        "distance": 2675,
        "duration": 447,
        "times": {
            "driving": 447,
            "serving": 0,
            "waiting": 0,
            "break": 0
        }
    },
    "tours": [
        {
            "vehicleId": "car_2_1",
            "typeId": "car_2",
            "stops": [
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:03:00Z",
                        "departure": "2021-07-04T06:03:00Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure"
                        }
                    ],
                    "distance": 0
                },
                {
                    "location": {
                        "lat": 47.623887,
                        "lng": -122.341163
                    },
                    "time": {
                        "arrival": "2021-07-04T06:04:54Z",
                        "departure": "2021-07-04T06:04:54Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "B",
                            "type": "delivery"
                        }
                    ],
                    "distance": 630
                },
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:06:33Z",
                        "departure": "2021-07-04T06:06:33Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival"
                        }
                    ],
                    "distance": 1155
                }
            ],
            "statistic": {
                "cost": 0.1155,
                "distance": 1155,
                "duration": 213,
                "times": {
                    "driving": 213,
                    "serving": 0,
                    "waiting": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "car_1_1",
            "typeId": "car_1",
            "stops": [
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:03:00Z",
                        "departure": "2021-07-04T06:03:00Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure"
                        }
                    ],
                    "distance": 0
                },
                {
                    "location": {
                        "lat": 47.628661,
                        "lng": -122.342312
                    },
                    "time": {
                        "arrival": "2021-07-04T06:04:48Z",
                        "departure": "2021-07-04T06:04:48Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "A",
                            "type": "delivery"
                        }
                    ],
                    "distance": 760
                },
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:06:54Z",
                        "departure": "2021-07-04T06:06:54Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival"
                        }
                    ],
                    "distance": 1520
                }
            ],
            "statistic": {
                "cost": 0.152,
                "distance": 1520,
                "duration": 234,
                "times": {
                    "driving": 234,
                    "serving": 0,
                    "waiting": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        }
    ],
    "unassigned": [
        {
            "jobId": "C",
            "reasons": [
                {
                    "code": "TERRITORY_CONSTRAINT",
                    "description": "cannot be assigned due to territory constraint"
                }
            ]
        }
    ]
}

優先テリトリー

運行管理には、優先テリトリー (何らかの理由で車両がより効率的に運行されるテリトリー) を持つ車両が存在する可能性があります。ディスパッチャは、車両をそのテリトリーで優先的に運行することを希望しています。ただし、予備の作業量と時間がある場合は、これらの優先テリトリー以外のジョブも集荷する必要があります。そのため、特定の地域に割り当てるだけでは制限がかかりすぎます。優先テリトリーオプションを使用すると、優先するテリトリーでジョブをスケジュールできます。可能であれば、他のテリトリーのジョブをスケジュールすることもできます。

Tour Planningでは、このような地域の優先は"strict": trueで示される領域への厳密な制限とは対照的に、"strict": falseでマークされます。

"fleet": {
    "types": [
        {
            ...
            "territories": {
                "strict": false,
                "items": [{"id": "North"}]
            }
        }
    ]
}

なお、placeにテリトリーが指定されていないジョブは、優先テリトリーの車両およびテリトリーが割り当てられていない車両のみが集荷できます。厳しいテリトリーにある車両は、このようなジョブには対応できません。

以下の例では2台の車両を使用しています。これらのうち1台をテリトリーNorth内で厳密に運用するように設定しました。また、もう1台をテリトリーSouth内で制限なく運用するように設定しました。5つのジョブを実行する必要があります。そのうちの2つはNorthテリトリー内、1つはSouth内、もう1つはSouth-East内 (どの車両にも割り当てられていません)、残りの1つは優先テリトリー外で作業する必要があります。

集配センター (@)、5つのジョブ (A~E)、および優先テリトリー (Northはバイオレット、Southは赤、South-Eastはオレンジ) のジョブプラン
{
    "fleet": {
        "types": [
            {
                "id": "car_1",
                "profile": "car_profile",
                "costs": {
                    "distance": 0.0001,
                    "time": 0
                },
                "territories": {
                    "strict": true,
                    "items": [
                        {
                            "id": "North"
                        }
                    ]
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2021-07-04T06:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        },
                        "end": {
                            "time": "2021-07-04T06:08:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        }
                    }
                ],
                "capacity": [
                    0
                ],
                "amount": 1
            },
            {
                "id": "car_2",
                "profile": "car_profile",
                "costs": {
                    "distance": 0.0001,
                    "time": 0
                },
                "territories": {
                    "strict": false,
                    "items": [
                        {
                            "id": "South"
                        }
                    ]
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2021-07-04T06:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        },
                        "end": {
                            "time": "2021-07-04T13:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        }
                    }
                ],
                "capacity": [
                    0
                ],
                "amount": 1
            }
        ],
        "profiles": [
            {
                "type": "car",
                "name": "car_profile"
            }
        ]
    },
    "plan": {
        "jobs": [
            {
                "id": "A",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.628661,
                                        "lng": -122.342312
                                    },
                                    "territoryIds": [
                                        "North"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "B",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.623887,
                                        "lng": -122.341163
                                    },
                                    "territoryIds": [
                                        "South"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "C",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.622523,
                                        "lng": -122.337323
                                    },
                                    "territoryIds": [
                                        "South-East"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "D",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.624891,
                                        "lng": -122.347445
                                    },
                                    "territoryIds": [
                                        "North"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "E",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.623208,
                                        "lng": -122.330536
                                    },
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

このソリューションから、テリトリーの割り当てが厳密であるため、車両タイプcar_1territoryIds属性Northを持つジョブにのみ割り当てられていることがわかります。シフトの時間的制約により、シフトに割り当てることができるのはジョブAのみです。

車両タイプcar_2がジョブBに割り当てられます。このジョブは、優先テリトリーSouthにあります。さらに、シフト時間が長いために予備の作業量があるため、車両によって明示的に提供されていないテリトリー (South-East) からジョブCが割り当てられます。また、テリトリーのないジョブE、および時間の制約によりcar_1ではサービスを提供できないNorthでのジョブDからジョブが割り当てられます。

car_1 (イエロールート) およびcar_2 (グリーンルート) を利用した、優先テリトリーのソリューション
{
    "statistic": {
        "cost": 0.5169,
        "distance": 5169,
        "duration": 849,
        "times": {
            "driving": 849,
            "serving": 0,
            "waiting": 0,
            "break": 0
        }
    },
    "tours": [
        {
            "vehicleId": "car_1_1",
            "typeId": "car_1",
            "stops": [
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:03:00Z",
                        "departure": "2021-07-04T06:03:00Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure"
                        }
                    ],
                    "distance": 0
                },
                {
                    "location": {
                        "lat": 47.628661,
                        "lng": -122.342312
                    },
                    "time": {
                        "arrival": "2021-07-04T06:04:48Z",
                        "departure": "2021-07-04T06:04:48Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "A",
                            "type": "delivery"
                        }
                    ],
                    "distance": 760
                },
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:06:54Z",
                        "departure": "2021-07-04T06:06:54Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival"
                        }
                    ],
                    "distance": 1520
                }
            ],
            "statistic": {
                "cost": 0.152,
                "distance": 1520,
                "duration": 234,
                "times": {
                    "driving": 234,
                    "serving": 0,
                    "waiting": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "car_2_1",
            "typeId": "car_2",
            "stops": [
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:03:00Z",
                        "departure": "2021-07-04T06:03:00Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure"
                        }
                    ],
                    "distance": 0
                },
                {
                    "location": {
                        "lat": 47.624891,
                        "lng": -122.347445
                    },
                    "time": {
                        "arrival": "2021-07-04T06:05:18Z",
                        "departure": "2021-07-04T06:05:18Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "D",
                            "type": "delivery"
                        }
                    ],
                    "distance": 923
                },
                {
                    "location": {
                        "lat": 47.623887,
                        "lng": -122.341163
                    },
                    "time": {
                        "arrival": "2021-07-04T06:06:50Z",
                        "departure": "2021-07-04T06:06:50Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "B",
                            "type": "delivery"
                        }
                    ],
                    "distance": 1532
                },
                {
                    "location": {
                        "lat": 47.622523,
                        "lng": -122.337323
                    },
                    "time": {
                        "arrival": "2021-07-04T06:09:10Z",
                        "departure": "2021-07-04T06:09:10Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "C",
                            "type": "delivery"
                        }
                    ],
                    "distance": 2547
                },
                {
                    "location": {
                        "lat": 47.623208,
                        "lng": -122.330536
                    },
                    "time": {
                        "arrival": "2021-07-04T06:11:02Z",
                        "departure": "2021-07-04T06:11:02Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "E",
                            "type": "delivery"
                        }
                    ],
                    "distance": 3248
                },
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:13:15Z",
                        "departure": "2021-07-04T06:13:15Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival"
                        }
                    ],
                    "distance": 3609
                }
            ],
            "statistic": {
                "cost": 0.3649,
                "distance": 3649,
                "duration": 615,
                "times": {
                    "driving": 615,
                    "serving": 0,
                    "waiting": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        }
    ]
}

優先順位付けされたテリトリー

車両に設定されているテリトリーの制限が厳密ではなく、優先テリトリーよりも詳細な制御が必要な場合は、テリトリーを優先順位付けできます。つまり、車両を異なる優先順位の複数のエリアまたは地区に割り当てることができます。たとえば、最も優先度の高いテリトリーを設定するには、優先度を1に設定し、優先度の低いテリトリーには2を使用します。最大5つの優先度を設定できます。異なるテリトリーで同じ優先度を設定できます。車両のジョブスケジュールを評価する場合、優先度の高いテリトリーのジョブが、優先度の低いテリトリーのジョブよりも優先されます。

"fleet": {
    "types": [
        {
            ...
            "territories": {
                "strict": true,
                "items": [
                    {
                        "id": "North",
                        "priority": 1
                    },
                    {
                        "id": "South",
                        "priority": 2
                    },                    
                    {
                        "id": "South-East",
                        "priority": 2
                    }
                ]
            }
        }
    ]
}

1台の車両に同じ優先度の複数のテリトリーを設定するオプションを使用すると、標準のテリトリーに限定された車両でジョブを実行できない場合に問題が解決することがあります。車両の1台に複数のテリトリー (またはそれらのすべて) を低い優先度で設定すると、その車両は残りの車両に割り当てられないジョブを実行することになります。例の車両タイプjokerを確認して、どのように運用するかを確認してください。

以下の例では、3台の車両を使用しています。

  • car_1は2つのテリトリーで厳密に運用されます。Northは優先度が高く、Southは優先度が低くなります。
  • car_2は3つのテリトリーで厳格に運用されます。Southは優先度は高く、NorthSouth-Eastはどちらも優先度が低くなります。
  • jokerは3つのテリトリー (NorthSouthSouth-East) すべてで、残りの運行管理より低い優先度で運用されます。地域外での運用も認められています。

これらの車両は、異なるエリアで6つのジョブを実行することを目的としています。

  • AはNorth (北部方面) のジョブ
  • BはSouth (南部方面) のジョブ
  • CはSouth-East (南東部方面) のジョブ
  • DはNorth (北部方面) のジョブ
  • Eは優先順位付けされたテリトリー外のジョブ
  • FはSouth-East (南東部方面) のジョブ
集配センター (@)、6つのジョブ (A~F)、優先順位付けされたテリトリー (Northはバイオレット、Southはレッド、South-Eastはオレンジ) のジョブプラン
{
    "fleet": {
        "types": [
            {
                "id": "car_1",
                "profile": "car_profile",
                "costs": {
                    "distance": 0.0001,
                    "time": 0
                },
                "territories": {
                    "strict": true,
                    "items": [
                        {
                            "id": "North",
                            "priority": 1
                        },
                        {
                            "id": "South",
                            "priority": 2
                        }
                    ]
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2021-07-04T06:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        },
                        "end": {
                            "time": "2021-07-04T06:08:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        }
                    }
                ],
                "capacity": [
                    0
                ],
                "amount": 1
            },
            {
                "id": "car_2",
                "profile": "car_profile",
                "costs": {
                    "distance": 0.0001,
                    "time": 0
                },
                "territories": {
                    "strict": true,
                    "items": [
                        {
                            "id": "South",
                            "priority": 1
                        },
                        {
                            "id": "North",
                            "priority": 2
                        },
                        {
                            "id": "South-East",
                            "priority": 2
                        }
                    ]
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2021-07-04T06:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        },
                        "end": {
                            "time": "2021-07-04T06:11:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        }
                    }
                ],
                "capacity": [
                    0
                ],
                "amount": 1
            },
            {
                "id": "joker",
                "profile": "car_profile",
                "costs": {
                    "distance": 0.0001,
                    "time": 0
                },
                "territories": {
                    "strict": false,
                    "items": [
                        {
                            "id": "North",
                            "priority": 3
                        },
                        {
                            "id": "South",
                            "priority": 3
                        },
                        {
                            "id": "South-East",
                            "priority": 3
                        }
                    ]
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2021-07-04T06:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        },
                        "end": {
                            "time": "2021-07-04T13:03:00Z",
                            "location": {
                                "lat": 47.625729,
                                "lng": -122.337255
                            }
                        }
                    }
                ],
                "capacity": [
                    0
                ],
                "amount": 1
            }
        ],
        "profiles": [
            {
                "type": "car",
                "name": "car_profile"
            }
        ]
    },
    "plan": {
        "jobs": [
            {
                "id": "A",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.628661,
                                        "lng": -122.342312
                                    },
                                    "territoryIds": [
                                        "North"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "B",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.623887,
                                        "lng": -122.341163
                                    },
                                    "territoryIds": [
                                        "South"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "C",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.622523,
                                        "lng": -122.337323
                                    },
                                    "territoryIds": [
                                        "South-East"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "D",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.624891,
                                        "lng": -122.347445
                                    },
                                    "territoryIds": [
                                        "North"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "E",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.623208,
                                        "lng": -122.330536
                                    },
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            },
            {
                "id": "F",
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 47.621933,
                                        "lng": -122.334567
                                    },
                                    "territoryIds": [
                                        "South-East"
                                    ],
                                    "duration": 0
                                }
                            ],
                            "demand": [
                                0
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

このソリューションでは、車両タイプcar_1は高優先度ゾーンNorthにあるためジョブAを実行できますが、シフト時間の制限によりNorthのジョブDまたはSouth-EastのジョブFは割り当てられません。

車両タイプcar_2は最優先テリトリーSouthのジョブB、優先順位の低いテリトリーNorthでのジョブD、優先順位の低いテリトリーSouth-EastでのジョブCに使用されます。

最後に、jokerのテリトリーの設定は厳密ではないため、South-WestでジョブFを実行し、優先順位付けされたテリトリー外でジョブEを実行します。

car_1 (イエロールート)、car_2 (ライトグリーンルート)、ジョーカー (ダークグリーンルート) による優先順位付けされたテリトリー向けのソリューション
{
    "statistic": {
        "cost": 0.6223000000000001,
        "distance": 6223,
        "duration": 1066,
        "times": {
            "driving": 1066,
            "serving": 0,
            "waiting": 0,
            "break": 0
        }
    },
    "tours": [
        {
            "vehicleId": "car_1_1",
            "typeId": "car_1",
            "stops": [
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:03:00Z",
                        "departure": "2021-07-04T06:03:00Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure"
                        }
                    ],
                    "distance": 0
                },
                {
                    "location": {
                        "lat": 47.628661,
                        "lng": -122.342312
                    },
                    "time": {
                        "arrival": "2021-07-04T06:04:48Z",
                        "departure": "2021-07-04T06:04:48Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "A",
                            "type": "delivery"
                        }
                    ],
                    "distance": 923
                },
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:06:54Z",
                        "departure": "2021-07-04T06:06:54Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival"
                        }
                    ],
                    "distance": 1532
                }
            ],
            "statistic": {
                "cost": 0.152,
                "distance": 1520,
                "duration": 234,
                "times": {
                    "driving": 234,
                    "serving": 0,
                    "waiting": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "car_2_1",
            "typeId": "car_2",
            "stops": [
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:03:00Z",
                        "departure": "2021-07-04T06:03:00Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure"
                        }
                    ],
                    "distance": 0
                },
                {
                    "location": {
                        "lat": 47.624891,
                        "lng": -122.347445
                    },
                    "time": {
                        "arrival": "2021-07-04T06:05:18Z",
                        "departure": "2021-07-04T06:05:18Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "D",
                            "type": "delivery"
                        }
                    ],
                    "distance": 923
                },
                {
                    "location": {
                        "lat": 47.623887,
                        "lng": -122.341163
                    },
                    "time": {
                        "arrival": "2021-07-04T06:06:50Z",
                        "departure": "2021-07-04T06:06:50Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "B",
                            "type": "delivery"
                        }
                    ],
                    "distance": 1532
                },
                {
                    "location": {
                        "lat": 47.622523,
                        "lng": -122.337323
                    },
                    "time": {
                        "arrival": "2021-07-04T06:09:10Z",
                        "departure": "2021-07-04T06:09:10Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "C",
                            "type": "delivery"
                        }
                    ],
                    "distance": 2246
                },
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:10:59Z",
                        "departure": "2021-07-04T06:10:59Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival"
                        }
                    ],
                    "distance": 2607
                }
            ],
            "statistic": {
                "cost": 0.2811,
                "distance": 2811,
                "duration": 479,
                "times": {
                    "driving": 479,
                    "serving": 0,
                    "waiting": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "joker_1",
            "typeId": "joker",
            "stops": [
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:03:00Z",
                        "departure": "2021-07-04T06:03:00Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure"
                        }
                    ],
                    "distance": 0
                },
                {
                    "location": {
                        "lat": 47.623208,
                        "lng": -122.330536
                    },
                    "time": {
                        "arrival": "2021-07-04T06:05:22Z",
                        "departure": "2021-07-04T06:05:22Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "E",
                            "type": "delivery"
                        }
                    ],
                    "distance": 923
                },
                {
                    "location": {
                        "lat": 47.621933,
                        "lng": -122.334567
                    },
                    "time": {
                        "arrival": "2021-07-04T06:06:48Z",
                        "departure": "2021-07-04T06:06:48Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "F",
                            "type": "delivery"
                        }
                    ],
                    "distance": 1532
                },
                {
                    "location": {
                        "lat": 47.625729,
                        "lng": -122.337255
                    },
                    "time": {
                        "arrival": "2021-07-04T06:08:53Z",
                        "departure": "2021-07-04T06:08:53Z"
                    },
                    "load": [
                        0
                    ],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival"
                        }
                    ],
                    "distance": 2246
                }
            ],
            "statistic": {
                "cost": 0.18920000000000003,
                "distance": 1892,
                "duration": 353,
                "times": {
                    "driving": 353,
                    "serving": 0,
                    "waiting": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        }
    ]
}

次のステップ

詳細については、以下を参照してください。