Package google.maps.routeoptimization.v1

شاخص

بهینه سازی مسیر

خدماتی برای بهینه سازی تورهای خودرو.

اعتبار انواع خاصی از فیلدها:

  • google.protobuf.Timestamp
    • زمان ها در زمان یونیکس هستند: ثانیه از 1970-01-01T00:00:00+00:00.
    • ثانیه باید در [0, 253402300799]، یعنی در [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00] باشد.
    • نانو باید تنظیم نشده یا روی 0 تنظیم شود.
  • google.protobuf.Duration
    • ثانیه باید در [0, 253402300799]، یعنی در [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00] باشد.
    • نانو باید تنظیم نشده یا روی 0 تنظیم شود.
  • google.type.LatLng
    • عرض جغرافیایی باید در [90.0-، 90.0] باشد.
    • طول جغرافیایی باید در [-180.0، 180.0] باشد.
    • حداقل یکی از طول و عرض جغرافیایی باید غیر صفر باشد.
BatchOptimizeTours

rpc BatchOptimizeTours( BatchOptimizeToursRequest ) returns ( Operation )

تورهای وسیله نقلیه را برای یک یا چند پیام OptimizeToursRequest به صورت دسته ای بهینه می کند.

این روش یک عملیات طولانی مدت (LRO) است. ورودی‌های بهینه‌سازی (پیام‌های OptimizeToursRequest ) و خروجی‌ها (پیام‌های OptimizeToursResponse ) در قالبی که کاربر مشخص می‌کند در فضای ذخیره‌سازی ابری خوانده شده و نوشته می‌شود. مانند روش OptimizeTours ، هر OptimizeToursRequest حاوی یک ShipmentModel است و یک OptimizeToursResponse حاوی فیلدهای ShipmentRoute برمی گرداند، که مجموعه ای از مسیرها هستند که باید توسط وسایل نقلیه انجام شود و هزینه کلی را به حداقل می رساند.

کاربر می تواند برای بررسی وضعیت LRO از operations.get نظرسنجی کند:

اگر قسمت LRO done نادرست باشد، حداقل یک درخواست هنوز در حال پردازش است. سایر درخواست‌ها ممکن است با موفقیت تکمیل شده باشند و نتایج آنها در Cloud Storage موجود باشد.

اگر قسمت done LRO درست باشد، تمام درخواست ها پردازش شده اند. هر درخواستی که با موفقیت پردازش شود، نتایج خود را در فضای ذخیره‌سازی ابری در دسترس خواهد داشت. هر درخواستی که ناموفق باشد، نتایج خود را در فضای ذخیره‌سازی ابری در دسترس نخواهد داشت. اگر قسمت error LRO تنظیم شده باشد، حاوی خطای یکی از درخواست های ناموفق است.

محدوده مجوز

به محدوده OAuth زیر نیاز دارد:

  • https://www.googleapis.com/auth/cloud-platform
مجوزهای IAM

به مجوز IAM زیر در منبع parent نیاز دارد:

  • routeoptimization.operations.create

برای اطلاعات بیشتر، به مستندات IAM مراجعه کنید.

OptimizeTours

rpc OptimizeTours( OptimizeToursRequest ) returns ( OptimizeToursResponse )

یک OptimizeToursRequest حاوی ShipmentModel ارسال می کند و OptimizeToursResponse حاوی ShipmentRoute را برمی گرداند، که مجموعه ای از مسیرها هستند که باید توسط وسایل نقلیه انجام شود و هزینه کلی را به حداقل می رساند.

یک مدل ShipmentModel عمدتاً شامل Shipment هایی است که باید انجام شوند و Vehicle که می توانند برای حمل و نقل Shipment ها استفاده شوند. ShipmentRoute Shipment s را به Vehicle s اختصاص می دهد. به طور خاص، آنها یک سری از Visit را به هر وسیله نقلیه اختصاص می دهند، که در آن یک Visit مربوط به VisitRequest است، که یک تحویل یا تحویل برای یک Shipment است.

هدف این است که تخصیصی از ShipmentRoute به Vehicle ارائه شود که هزینه کل را در جایی که هزینه دارای اجزای زیادی است که در ShipmentModel تعریف شده است، به حداقل می رساند.

محدوده مجوز

به محدوده OAuth زیر نیاز دارد:

  • https://www.googleapis.com/auth/cloud-platform
مجوزهای IAM

به مجوز IAM زیر در منبع parent نیاز دارد:

  • routeoptimization.locations.use

برای اطلاعات بیشتر، به مستندات IAM مراجعه کنید.

متریک های جمع شده

معیارهای جمع‌آوری‌شده برای ShipmentRoute (مثلاً برای OptimizeToursResponse روی همه عناصر Transition و/یا Visit (در مقابل همه ShipmentRoute ).

فیلدها
performed_ shipment_ count

int32

تعداد محموله های انجام شده توجه داشته باشید که یک جفت تحویل و تحویل فقط یک بار حساب می شود.

travel_ duration

Duration

کل مدت سفر برای یک مسیر یا یک راه حل.

wait_ duration

Duration

کل مدت زمان انتظار برای یک مسیر یا یک راه حل.

delay_ duration

Duration

کل مدت تاخیر برای یک مسیر یا یک راه حل.

break_ duration

Duration

کل مدت زمان استراحت برای یک مسیر یا یک راه حل.

visit_ duration

Duration

کل مدت زمان بازدید برای یک مسیر یا یک راه حل.

total_ duration

Duration

کل مدت زمان باید برابر با مجموع تمام مدت زمان بالا باشد. برای مسیرها نیز با موارد زیر مطابقت دارد:

[ShipmentRoute.vehicle_end_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_end_time] - [ShipmentRoute.vehicle_start_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_start_time]
travel_ distance_ meters

double

کل مسافت سفر برای یک مسیر یا یک راه حل.

max_ loads

map<string, VehicleLoad >

حداکثر بار به‌دست‌آمده در کل مسیر (وظیفه راه‌حل)، برای هر یک از کمیت‌های این مسیر (مشخصات راه‌حل)، که به‌عنوان حداکثر روی همه Transition.vehicle_loads (مثلا ShipmentRoute.metrics.max_loads محاسبه می‌شود.

BatchOptimizeToursMetadata

این نوع هیچ فیلدی ندارد.

فراداده عملیات برای تماس های BatchOptimizeToursRequest .

BatchOptimizeToursRequest

درخواست بهینه سازی دسته ای تورها به عنوان یک عملیات ناهمزمان. هر فایل ورودی باید حاوی یک OptimizeToursRequest باشد و هر فایل خروجی حاوی یک OptimizeToursResponse باشد. درخواست حاوی اطلاعاتی برای خواندن/نوشتن و تجزیه فایل‌ها است. تمام فایل های ورودی و خروجی باید تحت یک پروژه باشند.

فیلدها
parent

string

مورد نیاز. پروژه و مکان مورد نظر برای برقراری تماس.

قالب: * projects/{project-id} * projects/{project-id}/locations/{location-id}

اگر مکانی مشخص نشده باشد، یک منطقه به طور خودکار انتخاب می شود.

model_ configs[]

AsyncModelConfig

مورد نیاز. اطلاعات ورودی/خروجی هر مدل خرید، مانند مسیرهای فایل و فرمت های داده.

AsyncModelConfig

اطلاعاتی برای حل یک مدل بهینه سازی به صورت ناهمزمان.

فیلدها
display_ name

string

اختیاری. نام مدل تعریف شده توسط کاربر، می تواند به عنوان نام مستعار توسط کاربران برای پیگیری مدل ها استفاده شود.

input_ config

InputConfig

مورد نیاز. اطلاعات مربوط به مدل ورودی

output_ config

OutputConfig

مورد نیاز. اطلاعات مکان خروجی مورد نظر

BatchOptimizeToursResponse

این نوع هیچ فیلدی ندارد.

پاسخ به BatchOptimizeToursRequest . این در عملیات طولانی مدت پس از اتمام عملیات برگردانده می شود.

BreakRule

قوانینی برای ایجاد وقفه زمانی برای یک وسیله نقلیه (مثلاً استراحت ناهار). استراحت یک دوره زمانی پیوسته است که طی آن وسیله نقلیه در موقعیت فعلی خود بیکار می ماند و نمی تواند هیچ بازدیدی را انجام دهد. وقفه ممکن است رخ دهد:

  • در طول سفر بین دو بازدید (که شامل زمان درست قبل یا بعد از بازدید می شود، اما نه در وسط یک بازدید)، در این صورت زمان حمل و نقل مربوطه بین بازدیدها را افزایش می دهد.
  • یا قبل از شروع خودرو (ممکن است وسیله نقلیه در وسط یک استراحت استارت نخورد)، در این صورت بر زمان استارت خودرو تأثیری نمی گذارد.
  • یا پس از پایان خودرو (همچنین، با زمان پایان خودرو).
فیلدها
break_ requests[]

BreakRequest

توالی استراحت. پیام BreakRequest را ببینید.

frequency_ constraints[]

FrequencyConstraint

ممکن است چندین FrequencyConstraint اعمال شود. همه آنها باید توسط BreakRequest های این BreakRule راضی شوند. FrequencyConstraint ببینید.

Break Request

توالی وقفه ها (یعنی تعداد و ترتیب آنها) که برای هر وسیله نقلیه اعمال می شود باید از قبل مشخص باشد. BreakRequest های مکرر آن توالی را به ترتیبی که باید رخ دهند، تعریف می کنند. پنجره‌های زمانی آن‌ها ( earliest_start_time / latest_start_time ) ممکن است با هم همپوشانی داشته باشند، اما باید با سفارش سازگار باشند (این مورد بررسی شده است).

فیلدها
earliest_ start_ time

Timestamp

مورد نیاز. کران پایین (شامل) در شروع استراحت.

latest_ start_ time

Timestamp

مورد نیاز. کران بالا (شامل) در شروع استراحت.

min_ duration

Duration

مورد نیاز. حداقل مدت زمان استراحت. باید مثبت باشه

محدودیت فرکانس

ممکن است با اعمال یک حداقل فرکانس استراحت، مانند "هر 12 ساعت حداقل 1 ساعت وقفه وجود داشته باشد." با فرض اینکه این می تواند به عنوان "در هر پنجره زمانی کشویی 12 ساعته، حداقل یک وقفه حداقل یک ساعته وجود داشته باشد" تفسیر شود، این مثال به FrequencyConstraint زیر ترجمه می شود:

{
   min_break_duration { seconds: 3600 }         # 1 hour.
   max_inter_break_duration { seconds: 39600 }  # 11 hours (12 - 1 = 11).
}

زمان و مدت وقفه‌ها در راه‌حل، به همه این محدودیت‌ها، علاوه بر پنجره‌های زمانی و حداقل مدت زمان‌هایی که قبلاً در BreakRequest مشخص شده‌اند، احترام می‌گذارد.

یک FrequencyConstraint ممکن است در عمل برای وقفه های غیر متوالی اعمال شود. به عنوان مثال، برنامه زیر به مثال "1 ساعت هر 12 ساعت" احترام می گذارد:

  04:00 vehicle start
   .. performing travel and visits ..
  09:00 1 hour break
  10:00 end of the break
   .. performing travel and visits ..
  12:00 20-min lunch break
  12:20 end of the break
   .. performing travel and visits ..
  21:00 1 hour break
  22:00 end of the break
   .. performing travel and visits ..
  23:59 vehicle end
فیلدها
min_ break_ duration

Duration

مورد نیاز. حداقل مدت زمان استراحت برای این محدودیت. غیر منفی. به توضیحات FrequencyConstraint مراجعه کنید.

max_ inter_ break_ duration

Duration

مورد نیاز. حداکثر بازه مجاز هر بازه زمانی در مسیر که حداقل تا حدی شامل وقفه duration >= min_break_duration نیست. باید مثبت باشه

DataFormat

فرمت های داده برای فایل های ورودی و خروجی

Enums
DATA_FORMAT_UNSPECIFIED مقدار نامعتبر است، قالب نباید نامشخص باشد.
JSON نشانه گذاری شی جاوا اسکریپت.
PROTO_TEXT فرمت متنی بافرهای پروتکل. به https://protobuf.dev/reference/protobuf/textformat-spec/ مراجعه کنید

محدودیت فاصله

حدی که حداکثر مسافت قابل پیمودن را تعیین می کند. می تواند سخت یا نرم باشد.

اگر یک حد نرم تعریف شده باشد، هم soft_max_meters و هم cost_per_kilometer_above_soft_max باید تعریف شده و غیرمنفی باشد.

فیلدها
max_ meters

int64

حد سختی که فاصله را حداکثر حداکثر مکس_متر محدود می کند. حد باید غیرمنفی باشد.

soft_ max_ meters

int64

یک حد نرم محدودیت حداکثر فاصله را اعمال نمی کند، اما زمانی که نقض شود منجر به هزینه ای می شود که به هزینه های دیگر تعریف شده در مدل، با همان واحد اضافه می شود.

اگر soft_max_meters تعریف شده باید کمتر از max_meters باشد و باید غیرمنفی باشد.

cost_ per_ kilometer_ below_ soft_ max

double

هزینه هر کیلومتر متحمل شده، افزایش تا soft_max_meters ، با فرمول:

  min(distance_meters, soft_max_meters) / 1000.0 *
  cost_per_kilometer_below_soft_max.

این هزینه در route_distance_limit پشتیبانی نمی شود.

cost_ per_ kilometer_ above_ soft_ max

double

اگر مسافت بالاتر از حد مجاز soft_max_meters باشد، هزینه هر کیلومتر متحمل می شود. هزینه اضافی 0 است اگر فاصله کمتر از حد باشد، در غیر این صورت فرمول مورد استفاده برای محاسبه هزینه به شرح زیر است:

  (distance_meters - soft_max_meters) / 1000.0 *
  cost_per_kilometer_above_soft_max.

هزینه باید غیرمنفی باشد.

GcsDestination

مکان Google Cloud Storage که فایل(های) خروجی در آن نوشته می شود.

فیلدها
uri

string

مورد نیاز. URI Google Cloud Storage.

منبع Gcs

مکان Google Cloud Storage که فایل ورودی از آنجا خوانده می شود.

فیلدها
uri

string

مورد نیاز. URI یک شی Google Cloud Storage با فرمت gs://bucket/path/to/object .

InjectedSolution Constraint

راه حل تزریق شده در درخواست شامل اطلاعاتی در مورد اینکه کدام بازدیدها باید محدود شوند و چگونه باید محدود شوند.

فیلدها
routes[]

ShipmentRoute

مسیرهای محلول برای تزریق برخی از مسیرها ممکن است از راه حل اصلی حذف شوند. مسیرها و محموله های نادیده گرفته شده باید مفروضات اعتبار اولیه فهرست شده برای injected_first_solution_routes را برآورده کنند.

skipped_ shipments[]

SkippedShipment

محموله های محلول برای تزریق نادیده گرفته شده است. ممکن است برخی از راه حل اصلی حذف شوند. قسمت routes را ببینید.

constraint_ relaxations[]

ConstraintRelaxation

برای گروه های صفر یا چند وسیله نقلیه، زمان و میزان کاهش محدودیت ها را مشخص می کند. اگر این فیلد خالی باشد، تمام مسیرهای غیرخالی وسایل نقلیه کاملاً محدود می شوند.

محدودیت آرامش

برای گروهی از وسایل نقلیه، مشخص می‌کند که محدودیت‌های بازدید در چه آستانه‌ای کاهش می‌یابند و تا چه سطحی. محموله های فهرست شده در قسمت skipped_shipment محدود به نادیده گرفتن هستند. یعنی نمی توان آنها را اجرا کرد.

فیلدها
relaxations[]

Relaxation

تمام محدودیت‌های بازدید که برای بازدید از مسیرهایی با وسایل نقلیه در vehicle_indices اعمال می‌شود.

vehicle_ indices[]

int32

شاخص‌های وسیله نقلیه را مشخص می‌کند که relaxations محدودیت بازدید برای آنها اعمال می‌شود. اگر خالی باشد، این به عنوان پیش‌فرض در نظر گرفته می‌شود و relaxations برای همه وسایل نقلیه‌ای اعمال می‌شوند که در سایر constraint_relaxations مشخص نشده‌اند. حداکثر یک پیش‌فرض می‌تواند وجود داشته باشد، به عنوان مثال، حداکثر یک فیلد آرام‌سازی محدودیت مجاز vehicle_indices خالی است. یک شاخص خودرو فقط یک بار می‌تواند فهرست شود، حتی در چند constraint_relaxations .

اگر interpret_injected_solutions_using_labels درست باشد، یک نمایه خودرو همانند ShipmentRoute.vehicle_index ترسیم می‌شود (به نظر fields مراجعه کنید).

آرامش

اگر relaxations خالی باشد، زمان شروع و ترتیب همه بازدیدها در routes کاملاً محدود است و هیچ بازدید جدیدی نمی تواند در آن مسیرها درج یا اضافه شود. همچنین، زمان شروع و پایان یک وسیله نقلیه در routes کاملاً محدود است، مگر اینکه وسیله نقلیه خالی باشد (یعنی هیچ بازدیدی نداشته باشد و در مدل used_if_route_is_empty روی false تنظیم شده باشد).

relaxations(i).level سطح آرامش محدودیت اعمال شده برای بازدید #j را مشخص می کند که:

  • route.visits(j).start_time >= relaxations(i).threshold_time AND
  • j + 1 >= relaxations(i).threshold_visit_count

به طور مشابه، استارت وسیله نقلیه تا relaxations(i).level اگر برآورده شود:

  • vehicle_start_time >= relaxations(i).threshold_time AND
  • relaxations(i).threshold_visit_count == 0 و انتهای وسیله نقلیه به relaxations(i).level رها می شود اگر برآورده شود:
  • vehicle_end_time >= relaxations(i).threshold_time AND
  • route.visits_size() + 1 >= relaxations(i).threshold_visit_count

برای اعمال سطح آرامش، اگر بازدیدی با threshold_visit_count یا threshold_time مطابقت داشته باشد، دو relaxations با همان level اضافه کنید: یکی با مجموعه فقط threshold_visit_count و دیگری با تنها threshold_time تنظیم شده است. اگر یک بازدید شرایط relaxations متعدد را برآورده کند، آرام ترین سطح اعمال می شود. در نتیجه، از شروع وسیله نقلیه تا بازدیدهای مسیر تا پایان وسیله نقلیه، سطح آرامش بیشتر می شود: یعنی با پیشرفت مسیر، سطح آرامش کاهش نمی یابد.

زمان و توالی بازدیدهای مسیری که شرایط آستانه هر relaxations را برآورده نمی کند کاملاً محدود است و هیچ بازدیدی ممکن است در این توالی درج نشود. همچنین، اگر شروع یا پایان وسیله نقلیه شرایط آرامش را برآورده نکند، زمان ثابت است، مگر اینکه وسیله نقلیه خالی باشد.

فیلدها
level

Level

سطح آرامش محدودیت که زمانی اعمال می شود که شرایط در threshold_time یا پس از آن و حداقل threshold_visit_count برآورده شود.

threshold_ time

Timestamp

زمانی که level آرامش ممکن است اعمال شود یا بعد از آن.

threshold_ visit_ count

int32

تعداد بازدیدهایی که ممکن است level آرامش یا پس از آن اعمال شود. اگر threshold_visit_count 0 باشد (یا تنظیم نشده باشد)، level ممکن است مستقیماً در شروع خودرو اعمال شود.

اگر route.visits_size() + 1 باشد، level ممکن است فقط برای انتهای خودرو اعمال شود. اگر بیشتر از route.visits_size() + 1 باشد، level به هیچ وجه برای آن مسیر اعمال نمی شود.

سطح

سطوح مختلف آرامش محدودیت را بیان می‌کند که برای یک بازدید اعمال می‌شود و آن‌هایی که پس از آن زمانی که شرایط آستانه را برآورده می‌کنند، اعمال می‌شوند.

شمارش زیر به ترتیب افزایش آرامش است.

Enums
LEVEL_UNSPECIFIED

سطح آرامش پیش‌فرض ضمنی: هیچ محدودیتی کاهش نمی‌یابد، یعنی همه بازدیدها کاملاً محدود می‌شوند.

این مقدار نباید به صراحت در level استفاده شود.

RELAX_VISIT_TIMES_AFTER_THRESHOLD زمان شروع بازدید و زمان شروع/پایان وسیله نقلیه آرام خواهد بود، اما هر بازدید به همان وسیله نقلیه محدود می‌شود و توالی بازدید باید رعایت شود: هیچ بازدیدی بین آنها یا قبل از آنها نمی‌تواند وارد شود.
RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD مانند RELAX_VISIT_TIMES_AFTER_THRESHOLD ، اما توالی بازدید نیز آرام است: بازدیدها فقط توسط این وسیله نقلیه قابل انجام است، اما به طور بالقوه ممکن است انجام نشوند.
RELAX_ALL_AFTER_THRESHOLD مانند RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD ، اما وسیله نقلیه نیز آرام است: بازدیدها در زمان آستانه یا بعد از آن کاملا رایگان هستند و ممکن است به طور بالقوه انجام نشوند.

InputConfig

یک ورودی برای [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours] مشخص کنید.

فیلدها
data_ format

DataFormat

مورد نیاز. فرمت داده های ورودی

source میدان اتحادیه مورد نیاز. source می تواند تنها یکی از موارد زیر باشد:
gcs_ source

GcsSource

یک مکان Google Cloud Storage. این باید یک شی (فایل) واحد باشد.

مکان

یک مکان (نقطه جغرافیایی و عنوان اختیاری) را در بر می گیرد.

فیلدها
lat_ lng

LatLng

مختصات جغرافیایی نقطه راه.

heading

int32

عنوان قطب نما با جهت جریان ترافیک مرتبط است. این مقدار برای تعیین سمت جاده مورد استفاده برای حمل و نقل استفاده می شود. مقادیر سرفصل می تواند از 0 تا 360 باشد، جایی که 0 یک عنوان شمال را مشخص می کند، 90 عنوان یک عنوان شرق و غیره را مشخص می کند.

OptimizeToursRequest

درخواست به یک حل کننده بهینه سازی تور داده شود که مدل حمل و نقل را برای حل و همچنین پارامترهای بهینه سازی تعریف می کند.

فیلدها
parent

string

مورد نیاز. پروژه یا مکان را برای برقراری تماس هدف قرار دهید.

قالب: * projects/{project-id} * projects/{project-id}/locations/{location-id}

اگر مکانی مشخص نشده باشد، یک منطقه به طور خودکار انتخاب می شود.

timeout

Duration

اگر این مهلت تنظیم شود، سرور قبل از سپری شدن مدت زمان یا رسیدن به مهلت سرور برای درخواست‌های همزمان، هرکدام زودتر، پاسخی را برمی‌گرداند.

برای درخواست های ناهمزمان، سرور یک راه حل (در صورت امکان) را قبل از سپری شدن مهلت ایجاد می کند.

model

ShipmentModel

مدل حمل و نقل برای حل.

solving_ mode

SolvingMode

به طور پیش فرض، حالت حل DEFAULT_SOLVE (0) است.

search_ mode

SearchMode

حالت جستجو برای حل درخواست استفاده می شود.

injected_ first_ solution_ routes[]

ShipmentRoute

الگوریتم بهینه سازی را در یافتن راه حل اول که مشابه راه حل قبلی است، راهنمایی کنید.

وقتی اولین راه حل ساخته می شود، مدل محدود می شود. هر محموله ای که در یک مسیر انجام نشده باشد به طور ضمنی در راه حل اول نادیده گرفته می شود، اما ممکن است در راه حل های متوالی انجام شود.

راه حل باید برخی از مفروضات اعتبار پایه را برآورده کند:

  • برای همه مسیرها، vehicle_index باید در محدوده باشد و تکراری نباشد.
  • برای همه بازدیدها، shipment_index و visit_request_index باید در محدوده باشند.
  • یک محموله ممکن است فقط در یک مسیر ارجاع داده شود.
  • تحویل محموله وانت باید قبل از تحویل انجام شود.
  • بیش از یک بار جایگزین یا جایگزین تحویل یک محموله را نمی توان انجام داد.
  • برای همه مسیرها، زمان در حال افزایش است (به عنوان مثال، vehicle_start_time <= visits[0].start_time <= visits[1].start_time ... <= vehicle_end_time ).
  • حمل و نقل فقط با وسیله نقلیه مجاز انجام می شود. اگر Shipment.allowed_vehicle_indices خالی باشد یا vehicle_index آن در Shipment.allowed_vehicle_indices گنجانده شده باشد، خودرو مجاز است.

اگر راه حل تزریق شده امکان پذیر نباشد، یک خطای اعتبار سنجی لزوما برگردانده نمی شود و ممکن است به جای آن خطای نشان دهنده غیرممکن بودن برگردانده شود.

injected_ solution_ constraint

InjectedSolutionConstraint

الگوریتم بهینه سازی را برای یافتن راه حل نهایی که مشابه راه حل قبلی است محدود کنید. به عنوان مثال، این ممکن است برای مسدود کردن بخش‌هایی از مسیرهایی که قبلاً تکمیل شده‌اند یا باید تکمیل شوند اما نباید اصلاح شوند استفاده شود.

اگر راه حل تزریق شده امکان پذیر نباشد، یک خطای اعتبار سنجی لزوما برگردانده نمی شود و ممکن است به جای آن خطای نشان دهنده غیرممکن بودن برگردانده شود.

refresh_ details_ routes[]

ShipmentRoute

در صورت خالی نبودن، مسیرهای داده شده بدون تغییر توالی بازدیدها یا زمان سفر، به روز می شوند: فقط سایر جزئیات به روز می شوند. این مدل را حل نمی کند.

از سال 2020/11، این فقط چند خطوط مسیرهای غیر خالی را پر می کند و مستلزم آن است که populate_polylines درست باشد.

فیلدهای route_polyline مسیرهای تصویب شده ممکن است با transitions مسیر ناسازگار باشد.

این فیلد نباید همراه با injected_first_solution_routes یا injected_solution_constraint استفاده شود.

Shipment.ignore و Vehicle.ignore هیچ تاثیری بر رفتار ندارند. خطوط چندگانه همچنان بین همه بازدیدها در همه مسیرهای غیر خالی بدون توجه به محموله ها یا وسایل نقلیه مربوطه پر شده است.

interpret_ injected_ solutions_ using_ labels

bool

اگر درست باشد:

  • از ShipmentRoute.vehicle_label به جای vehicle_index برای تطبیق مسیرها در محلول تزریق شده با وسایل نقلیه در درخواست استفاده می کند. نگاشت ShipmentRoute.vehicle_index اصلی به ShipmentRoute.vehicle_index جدید را مجدداً برای به روز رسانی ConstraintRelaxation.vehicle_indices در صورت خالی نبودن استفاده می کند، اما نگاشت باید بدون ابهام باشد (یعنی چندین ShipmentRoute نباید یک vehicle_index اصلی را به اشتراک بگذارند).
  • از ShipmentRoute.Visit.shipment_label به جای shipment_index برای تطبیق بازدیدها در یک راه حل تزریقی با محموله های موجود در درخواست استفاده می کند.
  • از SkippedShipment.label به جای SkippedShipment.index برای تطبیق محموله های نادیده گرفته شده در محلول تزریق شده با محموله های درخواستی استفاده می کند.

این تفسیر برای فیلدهای injected_first_solution_routes ، injected_solution_constraint و refresh_details_routes اعمال می‌شود. می توان از آن زمانی استفاده کرد که شاخص های حمل و نقل یا وسیله نقلیه در درخواست از زمان ایجاد راه حل تغییر کرده است، شاید به این دلیل که محموله ها یا وسایل نقلیه از درخواست حذف شده یا به آن اضافه شده اند.

اگر درست باشد، برچسب‌های دسته‌های زیر باید حداکثر یک بار در دسته خود ظاهر شوند:

اگر یک vehicle_label در محلول تزریق شده با وسیله نقلیه درخواستی مطابقت نداشته باشد، مسیر مربوطه به همراه بازدیدهای آن از محلول حذف می شود. اگر یک shipment_label در محلول تزریق شده با یک ارسال درخواست مطابقت نداشته باشد، بازدید مربوطه از محلول حذف می شود. اگر یک SkippedShipment.label در محلول تزریق شده با یک ارسال درخواست مطابقت نداشته باشد، SkippedShipment از محلول حذف می شود.

حذف بازدیدهای مسیر یا کل مسیرها از یک راه حل تزریقی ممکن است بر محدودیت های ضمنی تأثیر بگذارد، که ممکن است منجر به تغییر در راه حل، خطاهای اعتبارسنجی یا غیرممکن شود.

توجه: تماس‌گیرنده باید اطمینان حاصل کند که هر Vehicle.label (مثلاً Shipment.label ) به طور منحصر به فرد یک وسیله نقلیه (resp. transport) را شناسایی می‌کند که در دو درخواست مرتبط استفاده می‌شود: درخواست قبلی که OptimizeToursResponse استفاده شده در محلول تزریق شده را تولید کرده است و درخواست فعلی که شامل محلول تزریق شده است. بررسی های منحصر به فرد توضیح داده شده در بالا برای تضمین این نیاز کافی نیست.

consider_ road_ traffic

bool

در محاسبه فیلدهای ShipmentRoute Transition.travel_duration ، Visit.start_time ، و vehicle_end_time ، تخمین ترافیک را در نظر بگیرید. در تنظیم فیلد ShipmentRoute.has_traffic_infeasibilities و در محاسبه فیلد OptimizeToursResponse.total_cost .

populate_ polylines

bool

اگر درست باشد، چند خطوط در پاسخ ShipmentRoute s پر می شوند.

populate_ transition_ polylines

bool

اگر درست باشد، چند خطوط و نشانه‌های مسیر در پاسخ ShipmentRoute.transitions پر می‌شوند.

allow_ large_ deadline_ despite_ interruption_ risk

bool

اگر این تنظیم شده باشد، درخواست می تواند حداکثر 60 دقیقه مهلت داشته باشد (به https://grpc.io/blog/deadlines مراجعه کنید). در غیر این صورت حداکثر مهلت فقط 30 دقیقه است. توجه داشته باشید که درخواست های طولانی مدت خطر وقفه به طور قابل توجهی بزرگتر (اما هنوز کوچک) دارند.

use_ geodesic_ distances

bool

اگر درست باشد، مسافت‌های سفر با استفاده از فواصل ژئودزیکی به جای مسافت‌های Google Maps و زمان سفر با استفاده از فواصل ژئودزیکی با سرعتی که توسط geodesic_meters_per_second تعریف شده است، محاسبه می‌شود.

label

string

برچسبی که ممکن است برای شناسایی این درخواست استفاده شود، در OptimizeToursResponse.request_label گزارش شده است.

geodesic_ meters_ per_ second

double

وقتی use_geodesic_distances درست است، این فیلد باید تنظیم شود و سرعت اعمال شده برای محاسبه زمان سفر را مشخص کند. مقدار آن باید حداقل 1.0 متر در ثانیه باشد.

max_ validation_ errors

int32

تعداد خطاهای اعتبارسنجی برگشتی را کوتاه می کند. این خطاها معمولاً به یک بار خطای INVALID_ARGUMENT به عنوان جزئیات خطای BadRequest ( https://cloud.google.com/apis/design/errors#error_details) متصل می شوند، مگر اینکه solving_mode=VALIDATE_ONLY: به قسمت OptimizeToursResponse.validation_errors مراجعه کنید. این به طور پیش فرض روی 100 است و روی 10000 محدود شده است.

حالت جستجو

حالتی که رفتار جستجو را تعریف می‌کند، تاخیر در مقایسه با کیفیت راه‌حل را کاهش می‌دهد. در همه حالت ها، مهلت درخواست جهانی اجرا می شود.

Enums
SEARCH_MODE_UNSPECIFIED حالت جستجوی نامشخص، معادل RETURN_FAST .
RETURN_FAST پس از یافتن اولین راه حل خوب، جستجو را متوقف کنید.
CONSUME_ALL_AVAILABLE_TIME تمام زمان موجود را صرف جستجوی راه حل های بهتر کنید.

حالت حل

نحوه رسیدگی به درخواست را مشخص می کند. در همه حالت‌ها به جز VALIDATE_ONLY ، اگر درخواست نامعتبر باشد، یک خطای INVALID_REQUEST دریافت خواهید کرد. به max_validation_errors مراجعه کنید تا تعداد خطاهای برگشتی را محدود کنید.

Enums
DEFAULT_SOLVE مدل را حل کنید. هشدارها ممکن است در [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] صادر شود.
VALIDATE_ONLY فقط مدل را بدون حل آن تأیید می کند: تا آنجا که ممکن است OptimizeToursResponse.validation_errors پر می کند.
DETECT_SOME_INFEASIBLE_SHIPMENTS

فقط OptimizeToursResponse.validation_errors یا OptimizeToursResponse.skipped_shipments را پر می کند و در واقع بقیه درخواست را حل نمی کند ( status و routes در پاسخ تنظیم نشده اند). اگر امکان پذیری در مسیرهای injected_solution_constraint شناسایی شود، در قسمت OptimizeToursResponse.validation_errors پر می شوند و OptimizeToursResponse.skipped_shipments خالی می ماند.

مهم : همه محموله‌های غیرممکن به اینجا بازگردانده نمی‌شوند، بلکه فقط آنهایی که در طول پیش پردازش غیرممکن تشخیص داده می‌شوند.

OptimizeToursResponse

پاسخ پس از حل یک مشکل بهینه سازی تور شامل مسیرهایی که هر وسیله نقلیه دنبال می کند، محموله هایی که نادیده گرفته شده اند و هزینه کلی راه حل.

فیلدها
routes[]

ShipmentRoute

مسیرهای محاسبه شده برای هر وسیله نقلیه؛ مسیر i-ام مربوط به i-امین وسیله نقلیه در مدل است.

request_ label

string

کپی OptimizeToursRequest.label ، اگر برچسبی در درخواست مشخص شده باشد.

skipped_ shipments[]

SkippedShipment

لیست تمام محموله‌های نادیده گرفته شده

validation_ errors[]

OptimizeToursValidationError

فهرستی از تمام خطاهای اعتبار سنجی که توانستیم به طور مستقل شناسایی کنیم. توضیحات "MULTIPLE ERRORS" را برای پیام OptimizeToursValidationError ببینید. به جای خطا، این شامل اخطارهایی در حالت solving_mode DEFAULT_SOLVE است.

metrics

Metrics

مدت زمان، مسافت و معیارهای استفاده برای این راه حل.

معیارها

معیارهای کلی، در همه مسیرها جمع آوری شده است.

فیلدها
aggregated_ route_ metrics

AggregatedMetrics

در مسیرها جمع شده است. هر متریک مجموع (یا حداکثر، برای بارها) در تمام فیلدهای ShipmentRoute.metrics با همان نام است.

skipped_ mandatory_ shipment_ count

int32

تعداد محموله های اجباری حذف شده

used_ vehicle_ count

int32

تعداد وسایل نقلیه استفاده شده توجه: اگر مسیر وسیله نقلیه خالی باشد و Vehicle.used_if_route_is_empty درست باشد، وسیله نقلیه استفاده شده در نظر گرفته می شود.

earliest_ vehicle_ start_ time

Timestamp

اولین زمان شروع برای یک وسیله نقلیه دست دوم، که به عنوان حداقل برای همه وسایل نقلیه استفاده شده در ShipmentRoute.vehicle_start_time محاسبه می شود.

latest_ vehicle_ end_ time

Timestamp

آخرین زمان پایان برای یک وسیله نقلیه کارکرده، که به عنوان حداکثر برای همه وسایل نقلیه استفاده شده ShipmentRoute.vehicle_end_time محاسبه می شود.

costs

map<string, double>

هزینه راه حل، به تفکیک فیلدهای درخواست مربوط به هزینه. کلیدها مسیرهای اولیه هستند، نسبت به ورودی OptimizeToursRequest، به عنوان مثال "model.shipments.pickups.cost"، و مقادیر کل هزینه تولید شده توسط فیلد هزینه مربوطه هستند که در کل راه حل جمع می شوند. به عبارت دیگر، هزینه‌ها ["model.shipments.picups.cost"] مجموع تمام هزینه‌های برداشت بیش از راه‌حل است. تمام هزینه‌های تعریف‌شده در مدل در اینجا به‌جز هزینه‌های مربوط به TransitionAttributes که فقط به صورت تجمیع شده از سال 2022/01 گزارش شده‌اند، در اینجا گزارش می‌شوند.

total_ cost

double

هزینه کل راه حل مجموع تمام مقادیر در نقشه هزینه ها.

OptimizeToursValidationError

خطا یا اخطاری را که هنگام تأیید اعتبار OptimizeToursRequest با آن مواجه می شود، توصیف می کند.

فیلدها
code

int32

یک خطای اعتبارسنجی توسط جفت ( code ، display_name ) که همیشه وجود دارد، تعریف می‌شود.

فیلدهای زیر این بخش زمینه بیشتری در مورد خطا ارائه می دهند.

خطاهای چندگانه : هنگامی که چندین خطا وجود دارد، فرآیند اعتبارسنجی سعی می کند چندین مورد از آنها را خروجی دهد. بسیار شبیه یک کامپایلر، این یک فرآیند ناقص است. برخی از خطاهای اعتبارسنجی "کشنده" خواهند بود، به این معنی که کل فرآیند اعتبار سنجی را متوقف می کنند. این مورد برای خطاهای display_name="UNSPECIFIED" در میان سایر موارد است. برخی از خطاها ممکن است باعث شود که فرآیند اعتبارسنجی از سایر خطاها رد شود.

STABILITY : code و display_name باید بسیار پایدار باشند. اما کدها و نام‌های نمایشی جدید ممکن است در طول زمان ظاهر شوند، که ممکن است باعث شود یک درخواست داده شده (نامعتبر) یک جفت متفاوت ( code ، display_name ) ارائه دهد زیرا خطای جدید خطای قدیمی را پنهان کرده است. به عنوان مثال، "خطاهای متعدد" را ببینید.

display_ name

string

نام نمایش خطا

fields[]

FieldReference

زمینه خطا ممکن است شامل 0، 1 (بیشتر اوقات) یا بیشتر فیلد باشد. به عنوان مثال، مراجعه به وسیله نقلیه شماره 4 و اولین پیکاپ محموله شماره 2 را می توان به صورت زیر انجام داد:

fields { name: "vehicles" index: 4}
fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} }

البته توجه داشته باشید که کاردینالیته fields نباید برای یک کد خطای مشخص تغییر کند.

error_ message

string

رشته قابل خواندن توسط انسان که خطا را توصیف می کند. یک نگاشت 1:1 بین code و error_message وجود دارد (وقتی کد != "نامشخص" است).

پایداری : پایدار نیست: پیام خطای مرتبط با code معین ممکن است در طول زمان تغییر کند (امیدواریم که آن را روشن کنیم). لطفاً در عوض به display_name و code تکیه کنید.

offending_ values

string

ممکن است حاوی مقدار(های) فیلد(ها) باشد. این همیشه در دسترس نیست. شما مطلقاً نباید به آن تکیه کنید و فقط برای اشکال زدایی مدل دستی از آن استفاده کنید.

مرجع فیلد

زمینه ای را برای خطای اعتبارسنجی مشخص می کند. یک FieldReference همیشه به یک فیلد معین در این فایل اشاره دارد و از ساختار سلسله مراتبی یکسانی پیروی می کند. به عنوان مثال، ممکن است عنصر #2 start_time_windows شماره 5 را با استفاده از:

name: "vehicles" index: 5 sub_field { name: "end_time_windows" index: 2 }

با این حال، ما نهادهای سطح بالا مانند OptimizeToursRequest یا ShipmentModel را حذف می کنیم تا از شلوغ شدن پیام جلوگیری کنیم.

فیلدها
name

string

نام رشته، به عنوان مثال، "وسایل نقلیه".

sub_ field

FieldReference

در صورت نیاز، زیر فیلد تودرتوی بازگشتی.

فیلد اتحادیه index_or_key .

index_or_key فقط می تواند یکی از موارد زیر باشد:

index

int32

فهرست فیلد در صورت تکرار.

key

string

اگر فیلد نقشه است، کلید بزنید.

OutputConfig

مقصدی را برای نتایج [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours] مشخص کنید.

فیلدها
data_ format

DataFormat

مورد نیاز. فرمت داده های خروجی

destination میدان اتحادیه مورد نیاز. destination فقط می تواند یکی از موارد زیر باشد:
gcs_ destination

GcsDestination

مکان Google Cloud Storage برای نوشتن خروجی.

RouteModifiers

مجموعه ای از شرایط اختیاری را در بر می گیرد تا هنگام محاسبه مسیرهای وسیله نقلیه برآورده شود. این شبیه به RouteModifiers در Google Maps Platform Routes Preferred API است. ببینید: https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteModifiers .

فیلدها
avoid_ tolls

bool

مشخص می کند که آیا در صورت معقول بودن از جاده های عوارضی اجتناب شود یا خیر. اولویت با مسیرهایی است که دارای عوارضی نیستند. فقط برای حالت های سفر موتوری اعمال می شود.

avoid_ highways

bool

مشخص می کند که آیا در صورت لزوم از بزرگراه ها اجتناب شود یا خیر. اولویت با مسیرهای فاقد بزرگراه است. فقط برای حالت های سفر موتوری اعمال می شود.

avoid_ ferries

bool

مشخص می‌کند که آیا در صورت لزوم از کشتی‌ها اجتناب شود یا خیر. اولویت با مسیرهایی است که شامل سفر با کشتی نباشد. فقط برای حالت های سفر موتوری اعمال می شود.

avoid_ indoor

bool

اختیاری. مشخص می کند که آیا از پیمایش در داخل خانه در صورت لزوم اجتناب شود. اولویت به مسیرهایی داده می شود که دارای ناوبری داخلی نیستند. فقط برای حالت سفر WALKING اعمال می شود.

حمل و نقل

حمل و نقل یک کالا، از یکی از وانت های آن تا یکی از تحویل های آن. برای اینکه حمل و نقل انجام شده در نظر گرفته شود، یک وسیله نقلیه منحصربه‌فرد باید از یکی از مکان‌های وانت خود بازدید کند (و ظرفیت یدکی خود را بر این اساس کاهش دهد)، سپس بعداً از یکی از مکان‌های تحویل آن بازدید کند (و بنابراین ظرفیت‌های یدکی خود را مجدداً افزایش دهد).

فیلدها
display_ name

string

نام نمایشی تعریف شده توسط کاربر برای محموله. می تواند حداکثر 63 کاراکتر باشد و ممکن است از نویسه های UTF-8 استفاده کند.

pickups[]

VisitRequest

مجموعه ای از جایگزین های پیکاپ مرتبط با محموله. اگر مشخص نشده باشد، وسیله نقلیه فقط باید از مکان مربوط به تحویل بازدید کند.

deliveries[]

VisitRequest

مجموعه ای از جایگزین های تحویل مرتبط با حمل و نقل. اگر مشخص نشده باشد، وسیله نقلیه فقط باید از مکان مربوط به پیکاپ بازدید کند.

load_ demands

map<string, Load >

نیازهای بار حمل و نقل (به عنوان مثال وزن، حجم، تعداد پالت ها و غیره). کلیدهای نقشه باید شناسه‌هایی باشند که نوع بار مربوطه را توصیف می‌کنند و در حالت ایده‌آل، واحدها را نیز شامل می‌شوند. به عنوان مثال: "weight_kg"، "volume_gallons"، "pallet_count"، و غیره. اگر کلید داده شده در نقشه ظاهر نشود، بار مربوطه به عنوان null در نظر گرفته می شود.

allowed_ vehicle_ indices[]

int32

مجموعه وسایل نقلیه ای که ممکن است این حمل و نقل را انجام دهند. اگر خالی باشد، همه وسایل نقلیه می توانند آن را انجام دهند. وسایل نقلیه با شاخص آنها در لیست vehicles ShipmentModel ارائه می شوند.

costs_ per_ vehicle[]

double

هزینه ای را که هنگام تحویل این محموله توسط هر وسیله نقلیه متحمل می شود را مشخص می کند. اگر مشخص شده باشد، باید یکی از این موارد را داشته باشد:

  • همان تعداد عناصر به عنوان costs_per_vehicle_indices . costs_per_vehicle[i] مربوط به costs_per_vehicle_indices[i] مدل است.
  • همان تعداد عناصری که وسایل نقلیه در مدل وجود دارد. عنصر i با وسیله نقلیه #i مدل مطابقت دارد.

این هزینه ها باید با penalty_cost یکسان باشد و منفی نباشد. اگر چنین هزینه هایی وجود ندارد، این قسمت را خالی بگذارید.

costs_ per_ vehicle_ indices[]

int32

شاخص های وسایل نقلیه ای که costs_per_vehicle برای آنها اعمال می شود. اگر خالی نباشد، باید همان تعداد عناصر costs_per_vehicle را داشته باشد. شاخص خودرو را نمی توان بیش از یک بار مشخص کرد. اگر یک وسیله نقلیه از costs_per_vehicle_indices حذف شود، هزینه آن صفر است.

pickup_ to_ delivery_ absolute_ detour_ limit

Duration

حداکثر زمان انحراف مطلق را در مقایسه با کوتاه ترین مسیر از تحویل گرفتن تا تحویل مشخص می کند. اگر مشخص شده باشد، باید غیرمنفی باشد و محموله باید حداقل شامل یک تحویل و یک تحویل باشد.

برای مثال، اجازه دهید t کوتاه‌ترین زمان برای رفتن مستقیم از جایگزین انتخاب‌شده به جایگزین تحویل انتخاب‌شده باشد. سپس تنظیم pickup_to_delivery_absolute_detour_limit اعمال می‌شود:

start_time(delivery) - start_time(pickup) <=
t + pickup_to_delivery_absolute_detour_limit

اگر هر دو محدودیت نسبی و مطلق در یک محموله مشخص شده باشند، از حد محدودتر برای هر جفت تحویل/تحویل ممکن استفاده می شود. از سال ۲۰۱۷/۲۰۱۰، انحراف‌ها فقط زمانی پشتیبانی می‌شوند که مدت زمان سفر به وسایل نقلیه بستگی نداشته باشد.

pickup_ to_ delivery_ time_ limit

Duration

حداکثر مدت زمان از شروع تحویل تا شروع تحویل یک محموله را مشخص می کند. اگر مشخص شده باشد، باید غیرمنفی باشد و محموله باید حداقل شامل یک تحویل و یک تحویل باشد. این بستگی به این ندارد که کدام گزینه برای تحویل و تحویل انتخاب شده است و نه به سرعت خودرو. این را می توان در کنار حداکثر محدودیت های انحرافی مشخص کرد: راه حل هر دو مشخصات را رعایت می کند.

shipment_ type

string

رشته غیر خالی که یک "نوع" را برای این محموله مشخص می کند. از این ویژگی می توان برای تعریف ناسازگاری ها یا الزامات بین shipment_types استفاده کرد (به shipment_type_incompatibilities و shipment_type_requirements در ShipmentModel مراجعه کنید).

با visit_types که برای یک بازدید مشخص شده است متفاوت است: همه تحویل/تحویل متعلق به یک محموله یک نوع shipment_type دارند.

label

string

یک برچسب برای این محموله مشخص می کند. این برچسب در پاسخ در shipment_label مربوطه ShipmentRoute.Visit گزارش شده است.

ignore

bool

اگر درست است، از این ارسال صرفنظر کنید، اما penalty_cost اعمال نکنید.

نادیده گرفتن یک محموله منجر به خطای اعتبار سنجی زمانی می شود که هر نوع shipment_type_requirements در مدل وجود داشته باشد.

نادیده گرفتن محموله‌ای که در injected_first_solution_routes یا injected_solution_constraint انجام می‌شود، مجاز است. حل کننده بازدیدهای دریافت/تحویل مربوطه را از مسیر در حال انجام حذف می کند. precedence_rules که ارجاع به محموله های نادیده گرفته شده نیز نادیده گرفته خواهد شد.

penalty_ cost

double

در صورت عدم تکمیل ارسال، این جریمه به هزینه کلی مسیرها اضافه می شود. در صورت بازدید از یکی از گزینه های تحویل و تحویل، یک محموله تکمیل شده تلقی می شود. هزینه ممکن است در همان واحد مورد استفاده برای سایر زمینه های مربوط به هزینه در مدل بیان شود و باید مثبت باشد.

مهم : اگر این جریمه مشخص نشده باشد، بی نهایت در نظر گرفته می شود، یعنی حمل و نقل باید تکمیل شود.

pickup_ to_ delivery_ relative_ detour_ limit

double

حداکثر زمان انحراف نسبی را در مقایسه با کوتاه ترین مسیر از تحویل گرفتن تا تحویل مشخص می کند. اگر مشخص شده باشد، باید غیرمنفی باشد و محموله باید حداقل شامل یک تحویل و یک تحویل باشد.

برای مثال، اجازه دهید t کوتاه‌ترین زمان برای رفتن مستقیم از جایگزین انتخاب‌شده به جایگزین تحویل انتخاب‌شده باشد. سپس تنظیم pickup_to_delivery_relative_detour_limit اعمال می‌شود:

start_time(delivery) - start_time(pickup) <=
std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit))

اگر هر دو محدودیت نسبی و مطلق در همان محموله مشخص شوند ، برای هر جفت وانت/تحویل ممکن از محدودیت بیشتر استفاده می شود. از سال 2017/10 ، دوری ها فقط زمانی پشتیبانی می شوند که مدت زمان سفر به وسایل نقلیه وابسته نباشد.

بارگذاری کنید

در هنگام انجام بازدید ، در صورت وانت ممکن است مبلغ از پیش تعریف شده به بار وسیله نقلیه اضافه شود یا در صورت تحویل کم شود. این پیام چنین مبلغی را تعریف می کند. به load_demands مراجعه کنید.

فیلدها
amount

int64

مبلغی که بار وسیله نقلیه انجام بازدید مربوطه با آن متفاوت خواهد بود. از آنجا که این یک عدد صحیح است ، به کاربران توصیه می شود یک واحد مناسب را برای جلوگیری از از دست دادن دقت انتخاب کنند. باید ≥ 0 باشد.

بازدید از

درخواست بازدیدی که توسط یک وسیله نقلیه انجام می شود: دارای موقعیت جغرافیایی است (یا دو مورد ، در زیر مشاهده کنید) ، زمان باز و بسته شدن توسط ویندوزهای زمان و مدت زمان خدمات (زمان صرف شده توسط وسیله نقلیه پس از رسیدن به وانت یا رها کردن کالاها).

فیلدها
arrival_ location

LatLng

مکان جغرافیایی که در آن وسیله نقلیه هنگام انجام این VisitRequest وارد می شود. اگر مدل حمل و نقل دارای ماتریس مسافت با مدت زمان باشد ، arrival_location نباید مشخص شود.

arrival_ waypoint

Waypoint

نقطه راه که در آن وسیله نقلیه هنگام انجام این VisitRequest وارد می شود. اگر مدل حمل و نقل دارای ماتریس فاصله با مدت زمان باشد ، نباید arrival_waypoint مشخص شود.

departure_ location

LatLng

مکان جغرافیایی که در آن وسیله نقلیه پس از اتمام این VisitRequest از آن خارج می شود. اگر همان arrival_location باشد ، می تواند حذف شود. اگر مدل حمل و نقل دارای ماتریس مسافت با مدت زمان باشد ، نباید departure_location مشخص کرد.

departure_ waypoint

Waypoint

ایستگاه راه که در آن وسیله نقلیه پس از اتمام این VisitRequest از آنجا خارج می شود. اگر همان arrival_waypoint باشد ، می تواند حذف شود. اگر مدل حمل و نقل دارای ماتریس مسافت با مدت زمان باشد ، نباید departure_waypoint مشخص شود.

tags[]

string

برچسب های پیوست شده به درخواست بازدید را مشخص می کند. رشته های خالی یا کپی مجاز نیستند.

time_ windows[]

TimeWindow

ویندوزهای زمانی که زمان ورود را در یک بازدید محدود می کند. توجه داشته باشید که یک وسیله نقلیه ممکن است خارج از پنجره زمان ورود حرکت کند ، یعنی زمان ورود + مدت زمان لازم نیست در یک پنجره زمانی باشد. اگر وسیله نقلیه قبل از TimeWindow.start_time وارد شود ، می تواند به زمان انتظار منجر شود.

عدم وجود TimeWindow به این معنی است که وسیله نقلیه می تواند در هر زمان این بازدید را انجام دهد.

ویندوزهای زمانی باید از هم جدا شوند ، یعنی هیچ پنجره زمانی نباید با دیگری همپوشانی داشته باشد یا در مجاورت دیگری باشد و باید در حال افزایش باشد.

cost_per_hour_after_soft_end_time و soft_end_time فقط در صورت وجود یک پنجره زمانی تنظیم می شود.

duration

Duration

مدت زمان بازدید ، یعنی زمان صرف شده توسط وسیله نقلیه بین ورود و عزیمت (برای اضافه شدن به زمان انتظار احتمالی ؛ به time_windows مراجعه کنید).

cost

double

هزینه خدمات این درخواست بازدید در مسیر وسیله نقلیه. این می تواند برای پرداخت هزینه های مختلف برای هر وانت جایگزین یا تحویل حمل و نقل استفاده شود. این هزینه باید در همان واحد Shipment.penalty_cost باشد. penalty_cost و نباید منفی باشد.

load_ demands

map<string, Load >

تقاضای بار این درخواست بازدید. این دقیقاً مانند زمینه Shipment.load_demands ، به جز این که فقط به جای کل Shipment در مورد این VisitRequest صدق می کند. مطالبات ذکر شده در اینجا به خواسته های ذکر شده در Shipment.load_demands اضافه می شود. bload_demands.

visit_ types[]

string

انواع بازدید را مشخص می کند. این ممکن است برای تخصیص زمان اضافی مورد نیاز وسیله نقلیه برای تکمیل این بازدید استفاده شود (به Vehicle.extra_visit_duration_for_visit_type مراجعه کنید.

یک نوع فقط یک بار ظاهر می شود.

label

string

یک برچسب برای این VisitRequest مشخص می کند. این برچسب در پاسخ به عنوان visit_label در ShipmentRoute.Visit مربوطه. Visit گزارش شده است.

کشتی گیر

یک مدل حمل و نقل شامل مجموعه ای از محموله ها است که باید توسط مجموعه ای از وسایل نقلیه انجام شود ، در حالی که هزینه کلی را به حداقل می رساند ، که این جمع است:

  • هزینه مسیریابی وسایل نقلیه (مبلغ هزینه در کل زمان ، هزینه در هر زمان سفر و هزینه ثابت در تمام وسایل نقلیه).
  • مجازات های حمل و نقل بدون عملکرد.
  • هزینه مدت جهانی محموله ها
فیلدها
shipments[]

Shipment

مجموعه محموله هایی که باید در مدل انجام شود.

vehicles[]

Vehicle

مجموعه ای از وسایل نقلیه که می توانند برای انجام بازدیدها استفاده شوند.

global_ start_ time

Timestamp

زمان شروع و پایان جهانی مدل: هیچ بار خارج از این محدوده نمی تواند معتبر تلقی شود.

مدت زمان مدل باید کمتر از یک سال باشد ، یعنی global_end_time و global_start_time باید در 31536000 ثانیه از یکدیگر باشد.

هنگام استفاده از زمینه های cost_per_*hour ، ممکن است بخواهید این پنجره را در یک بازه کوچکتر تنظیم کنید تا عملکرد افزایش یابد (به عنوان مثال اگر یک روز را مدل می کنید ، باید محدودیت های زمان جهانی را تا آن روز تعیین کنید). اگر UNET ، 00:00:00 UTC ، 1 ژانویه 1970 (یعنی ثانیه: 0 ، نانو: 0) به عنوان پیش فرض استفاده می شود.

global_ end_ time

Timestamp

اگر UNET ، 00:00:00 UTC ، 1 ژانویه 1971 (یعنی ثانیه: 31536000 ، نانو: 0) به عنوان پیش فرض استفاده می شود.

global_ duration_ cost_ per_ hour

double

"مدت زمان جهانی" برنامه کلی ، تفاوت بین اولین زمان شروع موثر و آخرین زمان پایان مؤثر همه وسایل نقلیه است. به عنوان مثال کاربران می توانند در هر ساعت هزینه ای را به آن مقدار اختصاص دهند تا به عنوان مثال برای اتمام کار زودرس و بهینه سازی کنند. این هزینه باید در همان واحد Shipment.penalty_cost .

duration_ distance_ matrices[]

DurationDistanceMatrix

مدت زمان و ماتریس فاصله مورد استفاده در مدل را مشخص می کند. اگر این قسمت خالی باشد ، بسته به مقدار قسمت use_geodesic_distances ، از نقشه های گوگل یا مسافت های ژئودزیک استفاده می شود. اگر خالی نباشد ، use_geodesic_distances نمی تواند درست باشد و نه duration_distance_matrix_src_tags و نه duration_distance_matrix_dst_tags می تواند خالی باشد.

نمونه های استفاده:

  • دو مکان وجود دارد: LOCA و LOCB.
  • 1 وسیله نقلیه که مسیر خود را در Loca شروع کرده و آن را در Loca پایان می دهد.
  • 1 درخواست وانت در LOCB.
model {
  vehicles { start_tags: "locA"  end_tags: "locA" }
  shipments { pickups { tags: "locB" } }
  duration_distance_matrix_src_tags: "locA"
  duration_distance_matrix_src_tags: "locB"
  duration_distance_matrix_dst_tags: "locA"
  duration_distance_matrix_dst_tags: "locB"
  duration_distance_matrices {
    rows {  # from: locA
      durations { seconds: 0 }   meters: 0    # to: locA
      durations { seconds: 100 } meters: 1000 # to: locB
    }
    rows {  # from: locB
      durations { seconds: 102 } meters: 990 # to: locA
      durations { seconds: 0 }   meters: 0   # to: locB
    }
  }
}
  • سه مکان وجود دارد: LOCA ، LOCB و LOCC.
  • 1 وسیله نقلیه با استفاده از ماتریس "Fast" مسیر خود را در Loca شروع کرده و آن را در LOCB پایان می دهد.
  • 1 وسیله نقلیه با استفاده از ماتریس "آهسته" مسیر خود را در LOCB شروع کرده و آن را در LOCB پایان می دهد.
  • 1 وسیله نقلیه با استفاده از ماتریس "سریع" مسیر خود را در LOCB شروع کرده و آن را در LOCB پایان می دهد.
  • 1 درخواست وانت در LOCC.
model {
  vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" }
  vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" }
  vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" }
  shipments { pickups { tags: "locC" } }
  duration_distance_matrix_src_tags: "locA"
  duration_distance_matrix_src_tags: "locB"
  duration_distance_matrix_src_tags: "locC"
  duration_distance_matrix_dst_tags: "locB"
  duration_distance_matrix_dst_tags: "locC"
  duration_distance_matrices {
    vehicle_start_tag: "fast"
    rows {  # from: locA
      durations { seconds: 1000 } meters: 2000 # to: locB
      durations { seconds: 600 }  meters: 1000 # to: locC
    }
    rows {  # from: locB
      durations { seconds: 0 }   meters: 0    # to: locB
      durations { seconds: 700 } meters: 1200 # to: locC
    }
    rows {  # from: locC
      durations { seconds: 702 } meters: 1190 # to: locB
      durations { seconds: 0 }   meters: 0    # to: locC
    }
  }
  duration_distance_matrices {
    vehicle_start_tag: "slow"
    rows {  # from: locA
      durations { seconds: 1800 } meters: 2001 # to: locB
      durations { seconds: 900 }  meters: 1002 # to: locC
    }
    rows {  # from: locB
      durations { seconds: 0 }    meters: 0    # to: locB
      durations { seconds: 1000 } meters: 1202 # to: locC
    }
    rows {  # from: locC
      durations { seconds: 1001 } meters: 1195 # to: locB
      durations { seconds: 0 }    meters: 0    # to: locC
    }
  }
}
duration_ distance_ matrix_ src_ tags[]

string

برچسب های تعریف منابع ماتریس مدت زمان و فاصله. duration_distance_matrices(i).rows(j) مدت زمان و مسافت را از بازدیدها با مدت زمان برچسب_ duration_distance_matrix_src_tags(j) تا سایر بازدیدها در ماتریس i تعریف می کند.

برچسب ها با VisitRequest.tags یا Vehicle.start_tags مطابقت دارند. یک VisitRequest یا Vehicle معین باید دقیقاً با یک برچسب در این زمینه مطابقت داشته باشد. توجه داشته باشید که برچسب های منبع ، مقصد و ماتریس یک Vehicle ممکن است یکسان باشد. به همین ترتیب برچسب های منبع و مقصد VisitRequest ممکن است یکسان باشد. همه برچسب ها باید متفاوت باشند و نمی توانند رشته های خالی باشند. اگر این قسمت خالی نباشد ، پس از duration_distance_matrices نباید خالی باشد.

duration_ distance_ matrix_ dst_ tags[]

string

برچسب های تعیین کننده مقصد ماتریس مدت زمان و فاصله. duration_distance_matrices(i).rows(j).durations(k) (repation. duration_distance_matrices(i).rows(j).meters(k)) مدت زمان (فاصله) مسافت را از سفر با برچسب duration_distance_matrix_src_tags(j) duration_distance_matrix_dst_tags(k) تعریف می کند. در ماتریس i.

برچسب ها با VisitRequest.tags یا Vehicle.start_tags مطابقت دارند. یک VisitRequest یا Vehicle معین باید دقیقاً با یک برچسب در این زمینه مطابقت داشته باشد. توجه داشته باشید که برچسب های منبع ، مقصد و ماتریس یک Vehicle ممکن است یکسان باشد. به همین ترتیب برچسب های منبع و مقصد VisitRequest ممکن است یکسان باشد. همه برچسب ها باید متفاوت باشند و نمی توانند رشته های خالی باشند. اگر این قسمت خالی نباشد ، پس از duration_distance_matrices نباید خالی باشد.

transition_ attributes[]

TransitionAttributes

ویژگی های انتقال به مدل اضافه شده است.

shipment_ type_ incompatibilities[]

ShipmentTypeIncompatibility

مجموعه ای از حمل و نقل ناسازگار_تایپ (به ShipmentTypeIncompatibility مراجعه کنید).

shipment_ type_ requirements[]

ShipmentTypeRequirement

مجموعه ای از الزامات shipment_type (به ShipmentTypeRequirement مراجعه کنید).

precedence_ rules[]

PrecedenceRule

مجموعه ای از قوانین تقدم که باید در مدل اجرا شود.

نکته مهم : استفاده از قوانین فراتر از اندازه مشکل بهینه سازی شده محدود می شود. درخواست هایی با استفاده از قوانین تقدم که شامل بسیاری از محموله ها است ممکن است رد شود.

max_ active_ vehicles

int32

حداکثر تعداد وسایل نقلیه فعال را محدود می کند. اگر مسیر آن حداقل یک محموله انجام شود ، وسیله نقلیه فعال است. این می تواند برای محدود کردن تعداد مسیرها در مواردی که رانندگان کمتری نسبت به وسایل نقلیه وجود دارد استفاده شود و ناوگان وسایل نقلیه ناهمگن باشد. بهینه سازی سپس بهترین زیر مجموعه وسایل نقلیه را برای استفاده انتخاب می کند. باید کاملاً مثبت باشد.

مدت زمان بندی

ماتریس مدت زمان و مسافت را از مکان های بازدید و شروع وسایل نقلیه برای بازدید و مکان های انتهای وسیله نقلیه مشخص می کند.

فیلدها
rows[]

Row

ردیف های ماتریس مدت زمان و فاصله را مشخص می کند. این باید به عنوان عناصر زیادی به عنوان ShipmentModel.duration_distance_matrix_src_tags داشته باشد.

vehicle_ start_ tag

string

تگ تعریف می کند که در این ماتریس مدت زمان و مسافت از وسایل نقلیه استفاده می شود. اگر خالی باشد ، این در مورد همه وسایل نقلیه صدق می کند ، و فقط یک ماتریس واحد وجود دارد.

هر شروع وسیله نقلیه باید دقیقاً با یک ماتریس مطابقت داشته باشد ، یعنی دقیقاً یکی از قسمت start_tags آنها باید با vehicle_start_tag یک ماتریس (و فقط از آن ماتریس) مطابقت داشته باشد.

همه ماتریس ها باید یک vehicle_start_tag متفاوت_ستارت_تگ داشته باشند.

ردیف

یک ردیف از ماتریس مدت زمان و فاصله را مشخص می کند.

فیلدها
durations[]

Duration

مقادیر مدت زمان برای یک ردیف معین. این باید به عنوان عناصر زیادی به عنوان ShipmentModel.duration_distance_matrix_dst_tags داشته باشد.

meters[]

double

مقادیر فاصله برای یک ردیف معین. اگر هیچ هزینه یا محدودیتی به مسافت های مدل اشاره داشته باشد ، این می تواند خالی بماند. در غیر این صورت باید به اندازه durations عناصر داشته باشد.

پیشگام

یک قانون تقدم بین دو رویداد (هر رویداد وانت یا تحویل حمل و نقل است): رویداد "دوم" باید offset_duration پس از شروع "اول" حداقل شروع به کار کند.

چندین سابقه می تواند به همان وقایع (یا مرتبط) مربوط باشد ، به عنوان مثال ، "وانت B پس از تحویل" و "وانت C اتفاق می افتد که پس از وانت B" اتفاق می افتد.

علاوه بر این ، مقدمات فقط در صورت انجام هر دو محموله اعمال می شود و در غیر این صورت نادیده گرفته می شوند.

فیلدها
first_ is_ delivery

bool

نشان می دهد که آیا رویداد "اول" تحویل است.

second_ is_ delivery

bool

نشان می دهد که آیا رویداد "دوم" تحویل است.

offset_ duration

Duration

جبران بین رویداد "اول" و "دوم". می تواند منفی باشد.

first_ index

int32

شاخص حمل و نقل رویداد "اولین". این فیلد باید مشخص شود.

second_ index

int32

شاخص حمل و نقل رویداد "دوم". این فیلد باید مشخص شود.

حمل و نقل

مسیر وسیله نقلیه را می توان تجزیه کرد ، در طول محور زمان ، مانند این (فرض می کنیم تعداد بازدیدی وجود دارد):

  |            |            |          |       |  T[2], |        |      |
  | Transition |  Visit #0  |          |       |  V[2], |        |      |
  |     #0     |    aka     |   T[1]   |  V[1] |  ...   | V[n-1] | T[n] |
  |  aka T[0]  |    V[0]    |          |       | V[n-2],|        |      |
  |            |            |          |       | T[n-1] |        |      |
  ^            ^            ^          ^       ^        ^        ^      ^
vehicle    V[0].start   V[0].end     V[1].   V[1].    V[n].    V[n]. vehicle
 start     (arrival)   (departure)   start   end      start    end     end

توجه داشته باشید که ما بین:

  • "وقایع دقیق" ، مانند شروع و پایان خودرو و شروع و پایان هر بازدید (ورود و عزیمت با نام مستعار). آنها در یک ثانیه معین اتفاق می افتد.
  • "فواصل زمانی" ، مانند خود بازدیدها و انتقال بین بازدیدها. اگرچه فواصل زمانی ممکن است گاهی اوقات صفر داشته باشد ، یعنی شروع و پایان در همان ثانیه ، آنها اغلب مدت مثبت دارند.

متغیرها:

  • اگر تعداد بازدیدی وجود داشته باشد ، انتقال N+1 وجود دارد.
  • یک بازدید همیشه با یک انتقال قبل از آن (همان شاخص) و انتقال پس از آن (شاخص + 1) احاطه شده است.
  • شروع وسیله نقلیه همیشه با انتقال شماره 0 دنبال می شود.
  • انتهای وسیله نقلیه همیشه با انتقال #N انجام می شود.

بزرگنمایی ، در اینجا اتفاقی است که در هنگام Transition و Visit رخ می دهد:

---+-------------------------------------+-----------------------------+-->
   |           TRANSITION[i]             |           VISIT[i]          |
   |                                     |                             |
   |  * TRAVEL: the vehicle moves from   |      PERFORM the visit:     |
   |    VISIT[i-1].departure_location to |                             |
   |    VISIT[i].arrival_location, which |  * Spend some time:         |
   |    takes a given travel duration    |    the "visit duration".    |
   |    and distance                     |                             |
   |                                     |  * Load or unload           |
   |  * BREAKS: the driver may have      |    some quantities from the |
   |    breaks (e.g. lunch break).       |    vehicle: the "demand".   |
   |                                     |                             |
   |  * WAIT: the driver/vehicle does    |                             |
   |    nothing. This can happen for     |                             |
   |    many reasons, for example when   |                             |
   |    the vehicle reaches the next     |                             |
   |    event's destination before the   |                             |
   |    start of its time window         |                             |
   |                                     |                             |
   |  * DELAY: *right before* the next   |                             |
   |    arrival. E.g. the vehicle and/or |                             |
   |    driver spends time unloading.    |                             |
   |                                     |                             |
---+-------------------------------------+-----------------------------+-->
   ^                                     ^                             ^
V[i-1].end                           V[i].start                    V[i].end

سرانجام ، در اینجا نحوه سفر ، استراحت ، تأخیر و انتظار می تواند در طول انتقال ترتیب داده شود.

  • همپوشانی ندارند
  • تأخیر منحصر به فرد است و باید یک دوره متناوب درست قبل از بازدید بعدی (یا پایان وسیله نقلیه) باشد. بنابراین ، دانستن مدت زمان تأخیر برای دانستن زمان شروع و پایان آن کافی است.
  • استراحت ها دوره های متناقض و غیر همپوشانی هستند. پاسخ زمان و مدت زمان شروع هر استراحت را مشخص می کند.
  • مسافرت و انتظار "قابل حمل" است: در طی این انتقال می توان چندین بار قطع شد. مشتریان می توانند فرض کنند که سفر "در اسرع وقت" اتفاق می افتد و "صبر کنید" زمان باقی مانده را پر می کند.

مثال (پیچیده):

                               TRANSITION[i]
--++-----+-----------------------------------------------------------++-->
  ||     |       |           |       |           |         |         ||
  ||  T  |   B   |     T     |       |     B     |         |    D    ||
  ||  r  |   r   |     r     |   W   |     r     |    W    |    e    ||
  ||  a  |   e   |     a     |   a   |     e     |    a    |    l    ||
  ||  v  |   a   |     v     |   i   |     a     |    i    |    a    ||
  ||  e  |   k   |     e     |   t   |     k     |    t    |    y    ||
  ||  l  |       |     l     |       |           |         |         ||
  ||     |       |           |       |           |         |         ||
--++-----------------------------------------------------------------++-->
فیلدها
vehicle_ index

int32

وسیله نقلیه ای که مسیر را انجام می دهد ، که توسط شاخص آن در Source ShipmentModel مشخص شده است.

vehicle_ label

string

در صورت مشخص شدن ، برچسب وسیله نقلیه ای که این مسیر را انجام می دهد ، برابر با ShipmentModel.vehicles(vehicle_index).label .

vehicle_ start_ time

Timestamp

زمانی که وسیله نقلیه مسیر خود را شروع می کند.

vehicle_ end_ time

Timestamp

زمانی که وسیله نقلیه مسیر خود را تمام می کند.

visits[]

Visit

دنباله سفارش داده شده از بازدیدهای یک مسیر. بازدیدها [i] بازدید I-Th در مسیر است. اگر این میدان خالی باشد ، وسیله نقلیه به عنوان استفاده نشده در نظر گرفته می شود.

transitions[]

Transition

لیست سفارش داده شده برای مسیر.

has_ traffic_ infeasibilities

bool

هنگامی که OptimizeToursRequest.consider_road_traffic تنظیم شده است ، این قسمت نشان می دهد که ناسازگاری در زمان بندی مسیر با استفاده از برآورد مدت زمان سفر مبتنی بر ترافیک پیش بینی می شود. ممکن است زمان کافی برای تکمیل سفرهای تنظیم شده در ترافیک ، تأخیر و استراحت بین بازدیدها ، قبل از اولین بازدید یا بعد از آخرین بازدید ، در حالی که هنوز هم ویندوز بازدید و زمان وسیله نقلیه را برآورده می کند ، وجود نداشته باشد. به عنوان مثال،

  start_time(previous_visit) + duration(previous_visit) +
  travel_duration(previous_visit, next_visit) > start_time(next_visit)

ورود به Next_visit احتمالاً دیرتر از پنجره زمانی فعلی خود به دلیل افزایش برآورد زمان سفر travel_duration(previous_visit, next_visit) به دلیل ترافیک اتفاق می افتد. همچنین ، یک استراحت ممکن است به دلیل افزایش تخمین زمان سفر و بازدید یا محدودیت های پنجره زمان ، مجبور به همپوشانی شود.

route_ polyline

EncodedPolyline

بازنمایی پلی خطی رمزگذاری شده از مسیر. این قسمت فقط در صورتی جمع می شود که OptimizeToursRequest.populate_polylines درست تنظیم شود.

breaks[]

Break

استراحت برنامه ریزی شده برای وسیله نقلیه در حال انجام این مسیر. دنباله breaks نشان دهنده فواصل زمانی است که هر یک از ثانیه های مربوط به start_time و duration مربوطه را شروع می کنند.

metrics

AggregatedMetrics

مدت زمان ، فاصله و معیارهای بار برای این مسیر. زمینه های جمع آوری شده در کلیه AggregatedMetrics بسته به متن ، در کلیه ShipmentRoute.transitions یا ShipmentRoute.visits خلاصه می شود.

route_ costs

map<string, double>

هزینه مسیر ، توسط زمینه های درخواست مربوط به هزینه تقسیم می شود. کلیدها مسیرهای پروتئین هستند ، نسبت به ورودی OptimizetoursRequest ، به عنوان مثال "model.shipments.pickups.cost" ، و مقادیر کل هزینه تولید شده توسط میدان هزینه مربوطه است که در کل مسیر جمع می شوند. به عبارت دیگر ، هزینه ها ["model.shipments.pickups.cost"] مجموع هزینه های وانت در مسیر است. تمام هزینه های تعریف شده در مدل در اینجا به استثنای هزینه های مربوط به انتقال attributes که فقط از سال 2022/01 گزارش می شوند ، به تفصیل گزارش شده است.

route_ total_ cost

double

هزینه کل مسیر. مجموع هزینه های موجود در نقشه هزینه.

شکستن

داده های نمایانگر اجرای یک استراحت.

فیلدها
start_ time

Timestamp

زمان شروع استراحت.

duration

Duration

مدت زمان استراحت.

رمز رمز

بازنمایی رمزگذاری شده یک پلی خط. اطلاعات بیشتر در مورد رمزگذاری پلیلین را می توان در اینجا یافت: https://developers.google.com/maps/documentation/utilities/polylinealgorithm https://develops.google.com/maps/documentation/javascript/reference/geometry.encoding .

فیلدها
points

string

رشته نمایانگر نقاط رمزگذاری شده پلی خط.

انتقال

انتقال بین دو رویداد در مسیر. توضیحات مربوط به ShipmentRoute را ببینید.

اگر وسیله نقلیه دارای start_location و/یا end_location نباشد ، معیارهای سفر مربوطه 0 است.

فیلدها
travel_ duration

Duration

مدت زمان سفر در طول این انتقال.

travel_ distance_ meters

double

مسافت طی شده در طول انتقال.

traffic_ info_ unavailable

bool

هنگامی که ترافیک از طریق OptimizeToursRequest.consider_road_traffic درخواست می شود ، و اطلاعات ترافیک برای Transition قابل بازیابی نیست ، این بولی به درستی تنظیم شده است. این ممکن است موقتی باشد (سکسکه نادر در سرورهای ترافیک در زمان واقعی) یا دائمی (بدون داده ای برای این مکان).

delay_ duration

Duration

مجموع مدت زمان تأخیر در این انتقال اعمال می شود. در صورت وجود ، تأخیر دقیقاً delay_duration ثانیه قبل از رویداد بعدی (بازدید یا پایان وسیله نقلیه) شروع می شود. به TransitionAttributes.delay مراجعه کنید.

break_ duration

Duration

در صورت وجود ، مجموع مدت زمان وقفه هایی که در طول این انتقال رخ می دهد. جزئیات مربوط به زمان و مدت زمان شروع هر شکست ShipmentRoute.breaks ذخیره می شود.

wait_ duration

Duration

زمان صرف انتظار در طول این انتقال. مدت زمان انتظار با زمان بیکار مطابقت دارد و شامل زمان شکستن نیست. همچنین توجه داشته باشید که این زمان انتظار ممکن است به چندین فواصل غیر مبهم تقسیم شود.

total_ duration

Duration

مدت زمان انتقال ، برای راحتی فراهم شده است. برابر است با:

  • بازدید بعدی start_time (یا vehicle_end_time اگر این آخرین انتقال است) - این انتقال start_time ؛
  • اگر ShipmentRoute.has_traffic_infeasibilities نادرست است ، موارد زیر علاوه بر این نیز وجود دارد: `total_duration = travel_duration + relase_duration
  • BREAK_DURATION + WATE_DURATION '.
start_ time

Timestamp

زمان شروع این انتقال.

route_ polyline

EncodedPolyline

بازنمایی پلی خطی رمزگذاری شده از مسیر که در طول انتقال دنبال می شود. این قسمت فقط در صورتی جمع می شود که populate_transition_polylines روی درست تنظیم شود.

route_ token

string

فقط خروجی یک نشانه مات که می تواند برای بازسازی مسیر در حین ناوبری به SDK ناوبری منتقل شود ، و در صورت تجدید نظر ، هنگام ایجاد مسیر ، به قصد اصلی احترام می گذارد. این نشانه را به عنوان حباب مات درمان کنید. ارزش آن را در بین درخواست ها مقایسه نکنید زیرا ممکن است ارزش آن تغییر کند حتی اگر سرویس دقیقاً همان مسیر را برگرداند. این قسمت فقط در صورتی جمع می شود که populate_transition_polylines روی درست تنظیم شود.

vehicle_ loads

map<string, VehicleLoad >

در طی این انتقال ، برای هر نوع که در این وسیله نقلیه ظاهر می شود ، بار خودرو را بارهای خودرو می کند Vehicle.load_limits ، یا Shipment.load_demands در برخی از محموله ها در این مسیر انجام می شود.

بارها در اولین انتقال بارهای شروع مسیر وسیله نقلیه است. سپس ، پس از هر بازدید ، بسته به اینکه این بازدید وانت یا load_demands باشد ، اضافه شده یا کمرنگ می شود تا بارهای انتقال بعدی را بدست آورید.

بارگیری وسایل نقلیه

گزارش بار واقعی وسیله نقلیه در مقطعی در طول مسیر ، برای یک نوع معین (به Transition.vehicle_loads مراجعه کنید).

فیلدها
amount

int64

مقدار بار در وسیله نقلیه ، برای نوع داده شده. واحد بار معمولاً توسط نوع نشان داده می شود. به Transition.vehicle_loads مراجعه کنید.

بازدید کنید

بازدیدی که در طی یک مسیر انجام شد. این بازدید مربوط به وانت یا تحویل Shipment است.

فیلدها
shipment_ index

int32

فهرست زمینه shipments در Source ShipmentModel .

is_ pickup

bool

در صورت صحت این دیدار با وانت Shipment مطابقت دارد. در غیر این صورت ، مربوط به تحویل است.

visit_ request_ index

int32

فهرست VisitRequest در وانت یا زمینه تحویل Shipment (به is_pickup مراجعه کنید).

start_ time

Timestamp

زمانی که بازدید از آن شروع می شود. توجه داشته باشید که وسیله نقلیه ممکن است زودتر از این در محل بازدید وارد شود. بارها با ShipmentModel سازگار است.

load_ demands

map<string, Load >

کل تقاضای بار بازدید به عنوان مبلغ حمل و نقل و درخواست بازدید load_demands . مقادیر منفی هستند اگر بازدید تحویل باشد. تقاضا برای انواع مشابه با Transition.loads گزارش شده است (این زمینه را ببینید).

detour

Duration

زمان دفع اضافی به دلیل محموله های بازدید شده در مسیر قبل از بازدید و زمان احتمالی انتظار ناشی از ویندوزهای زمان. اگر این بازدید تحویل باشد ، دفع از وانت مربوطه محاسبه می شود و برابر است با:

start_time(delivery) - start_time(pickup)
- (duration(pickup) + travel duration from the pickup location
to the delivery location).

در غیر این صورت ، آن را از start_location وسیله نقلیه محاسبه می کند و برابر است با:

start_time - vehicle_start_time - travel duration from
the vehicle's `start_location` to the visit.
shipment_ label

string

کپی از Shipment.label مربوطه. label ، در صورت مشخص شدن در Shipment .

visit_ label

string

در صورت مشخص شدن در VisitRequest ، کپی از VisitRequest.label مربوطه. label.

قابلیت سازگاری حمل و نقل

بسته به نوع حمل و نقل آنها ، ناسازگاری بین محموله ها را مشخص می کند. ظاهر محموله های ناسازگار در همان مسیر بر اساس حالت ناسازگاری محدود می شود.

فیلدها
types[]

string

لیست انواع ناسازگار. دو محموله دارای shipment_types مختلف در میان موارد ذکر شده "ناسازگار" هستند.

incompatibility_ mode

IncompatibilityMode

حالت برای ناسازگاری اعمال می شود.

نامطلوب

حالت هایی که چگونگی محدود شدن ظاهر محموله های ناسازگار در همان مسیر را تعریف می کنند.

Enums
INCOMPATIBILITY_MODE_UNSPECIFIED حالت ناسازگاری نامشخص. این مقدار هرگز نباید استفاده شود.
NOT_PERFORMED_BY_SAME_VEHICLE در این حالت ، دو محموله با انواع ناسازگار هرگز نمی توانند همان وسیله نقلیه را به اشتراک بگذارند.
NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY

برای دو محموله با انواع ناسازگار با NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY به صورت ناسازگاری:

  • اگر هر دو وانت فقط (بدون تحویل) یا فقط تحویل (بدون وانت) باشند ، آنها به هیچ وجه نمی توانند یک وسیله نقلیه یکسان را به اشتراک بگذارند.
  • اگر یکی از محموله ها تحویل داشته باشد و دیگری وانت ، این دو محموله می توانند با همان وسیله نقلیه در صورتی که حمل و نقل قبلی قبل از برداشت دوم تحویل داده شود ، به اشتراک بگذارند.

حمل و نقل

الزامات بین محموله ها را بر اساس حمل و نقل_تایپ آنها مشخص می کند. مشخصات مورد نیاز توسط حالت مورد نیاز تعریف شده است.

فیلدها
required_ shipment_ type_ alternatives[]

string

لیست انواع حمل و نقل جایگزین مورد نیاز توسط dependent_shipment_types .

dependent_ shipment_ types[]

string

کلیه محموله ها با یک نوع در قسمت dependent_shipment_types حداقل به یک حمل و نقل از نوع required_shipment_type_alternatives نیاز دارند تا در همان مسیر بازدید کنند.

توجه: زنجیره های مورد نیاز به گونه ای که یک shipment_type بستگی به خود داشته باشد.

requirement_ mode

RequirementMode

حالت اعمال شده برای نیاز.

روش

حالت هایی که ظاهر محموله های وابسته را در یک مسیر تعریف می کنند.

Enums
REQUIREMENT_MODE_UNSPECIFIED حالت مورد نیاز نامشخص. این مقدار هرگز نباید استفاده شود.
PERFORMED_BY_SAME_VEHICLE در این حالت ، کلیه محموله های "وابسته" باید حداقل وسیله نقلیه حداقل یکی از محموله های "مورد نیاز" خود را به اشتراک بگذارند.
IN_SAME_VEHICLE_AT_PICKUP_TIME

با استفاده از حالت IN_SAME_VEHICLE_AT_PICKUP_TIME ، کلیه محموله های "وابسته" باید در زمان وانت خود حداقل یک حمل "مورد نیاز" را در وسیله نقلیه خود داشته باشند.

وانت حمل و نقل "وابسته" بنابراین باید داشته باشد:

  • حمل و نقل "مورد نیاز" فقط تحویل در مسیر پس از آن ، یا
  • حمل و نقل "مورد نیاز" قبل از آن در مسیر انتخاب شده است ، و اگر حمل و نقل "مورد نیاز" تحویل داشته باشد ، این تحویل باید پس از وانت حمل "وابسته" انجام شود.
IN_SAME_VEHICLE_AT_DELIVERY_TIME مانند گذشته ، به جز محموله های "وابسته" باید در زمان تحویل خود حمل و نقل "مورد نیاز" را بر روی وسیله نقلیه خود داشته باشند.

تحصیل

جزئیات محموله های بدون عملکرد را در یک راه حل مشخص می کند. برای موارد بی اهمیت و/یا اگر قادر به شناسایی علت پرش هستیم ، دلیل را در اینجا گزارش می دهیم.

فیلدها
index

int32

این شاخص مطابق با شاخص حمل و نقل در منبع ShipmentModel است.

label

string

کپی از Shipment.label مربوطه. label ، در صورت مشخص شدن در Shipment .

reasons[]

Reason

لیستی از دلایلی که توضیح می دهد چرا این محموله رد شد. Reason بالا را ببینید. اگر نتوانیم بفهمیم چرا یک محموله رد شد ، دلایل تعیین نمی شود.

دلیل

اگر بتوانیم توضیح دهیم که چرا حمل و نقل از بین رفته است ، دلایل در اینجا ذکر می شود. اگر دلیل برای همه وسایل نقلیه یکسان نباشد ، reason بیش از 1 عنصر خواهد داشت. حمل و نقل پرش نمی تواند دلایل تکراری داشته باشد ، یعنی جایی که همه زمینه ها به جز example_vehicle_index یکسان هستند. مثال:

reasons {
  code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
  example_vehicle_index: 1
  example_exceeded_capacity_type: "Apples"
}
reasons {
  code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
  example_vehicle_index: 3
  example_exceeded_capacity_type: "Pears"
}
reasons {
  code: CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT
  example_vehicle_index: 1
}

حمل و نقل پرش با تمام وسایل نقلیه ناسازگار است. این دلایل ممکن است برای همه وسایل نقلیه متفاوت باشد اما حداقل ظرفیت "سیب" یک وسیله نقلیه (از جمله وسیله نقلیه 1) فراتر رود ، حداقل ظرفیت "گلابی" یک وسیله نقلیه از (از جمله وسیله نقلیه 3) فراتر رود و حداقل از فاصله فاصله یک وسیله نقلیه (از جمله وسیله نقلیه 1) فراتر رود.

فیلدها
code

Code

به نظرات کد مراجعه کنید.

example_ exceeded_ capacity_ type

string

اگر دلیل کد DEMAND_EXCEEDS_VEHICLE_CAPACITY است ، یک نوع ظرفیت را که از آن فراتر رفته است ، اسناد می کند.

example_ vehicle_ index

int32

اگر دلیل آن مربوط به ناسازگاری یک وسیله نقلیه حمل و نقل باشد ، این زمینه شاخص یک وسیله نقلیه مربوطه را فراهم می کند.

کد

کد شناسایی نوع دلیل. سفارش در اینجا بی معنی است. به طور خاص ، در صورت اعمال هر دو ، هیچ نشانه ای از اینكه آیا دلیل مشخصی در راه حل ظاهر خواهد شد.

Enums
CODE_UNSPECIFIED این هرگز نباید استفاده شود.
NO_VEHICLE هیچ وسیله نقلیه در مدل وجود ندارد که همه محموله ها را غیرقابل نفوذ کند.
DEMAND_EXCEEDS_VEHICLE_CAPACITY تقاضای حمل و نقل از ظرفیت وسیله نقلیه برای برخی از انواع ظرفیت فراتر می رود که یکی از آنها example_exceeded_capacity_type است.
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT

حداقل مسافت لازم برای انجام این محموله ، یعنی از start_location وسیله نقلیه تا وانت و/یا محل تحویل حمل و نقل حمل و نقل و محل پایان خودرو از route_distance_limit از وسیله نقلیه فراتر می رود.

توجه داشته باشید که برای این محاسبه از مسافت های ژئودزیکی استفاده می کنیم.

CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT

حداقل زمان لازم برای انجام این محموله ، از جمله زمان سفر ، زمان انتظار و زمان خدمات بیش از route_duration_limit وسیله نقلیه_دوراسیون_یمیت است.

توجه: زمان سفر در بهترین سناریو محاسبه می شود ، یعنی فاصله ژئودزیک x 36 متر بر ثانیه (تقریباً 130 کیلومتر در ساعت).

CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT همانند بالا ، اما ما فقط حداقل زمان سفر و travel_duration_limit وسیله نقلیه_دوراسیون_یمیت را مقایسه می کنیم.
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS وسیله نقلیه نمی تواند این محموله را در سناریوی بهترین حالت انجام دهد (به CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT برای محاسبه زمان مراجعه کنید) اگر در اولین زمان شروع خود شروع شود: زمان کل باعث می شود که وسیله نقلیه پس از آخرین زمان پایان خود پایان یابد.
VEHICLE_NOT_ALLOWED میدان allowed_vehicle_indices حمل و نقل خالی نیست و این وسیله نقلیه متعلق به آن نیست.

سیم تایم

Windows Time زمان یک رویداد را محدود می کند ، مانند زمان ورود در یک بازدید یا زمان شروع و پایان یک وسیله نقلیه.

محدودیت های پنجره زمان سخت ، start_time و end_time ، اولین و آخرین زمان رویداد را اجرا کنید ، به گونه ای که start_time <= event_time <= end_time . پنجره زمان نرم محدود ، soft_start_time ، ترجیح می دهد این رویداد در یا بعد از soft_start_time اتفاق بیفتد و با تحمل هزینه متناسب با چه مدت قبل از SOFT_START_TIME اتفاق بیفتد. پنجره زمانی نرم که دارای قسمت بالایی ، soft_end_time است ، ترجیح می دهد این رویداد در یا قبل از soft_end_time اتفاق بیفتد و با تحمل هزینه متناسب با چه مدت بعد از soft_end_time اتفاق بیفتد. start_time ، end_time ، soft_start_time و soft_end_time باید در محدوده زمان جهانی باشد (به ShipmentModel.global_start_time و ShipmentModel.global_end_time مراجعه کنید) و باید احترام بگذارید:

  0 <= `start_time` <= `end_time` and
  0 <= `start_time` <= `soft_start_time` and
  0 <= `soft_end_time` <= `end_time`.
فیلدها
start_ time

Timestamp

زمان شروع پنجره زمان سخت. اگر نامشخص باشد ، آن را به ShipmentModel.global_start_time تنظیم می شود.

end_ time

Timestamp

زمان پایان پنجره زمان سخت. اگر نامشخص باشد ، آن را به ShipmentModel.global_end_time تنظیم می شود.

soft_ start_ time

Timestamp

زمان شروع نرم پنجره زمان.

soft_ end_ time

Timestamp

زمان پایان نرم پنجره زمان.

cost_ per_ hour_ before_ soft_ start_ time

double

در صورت وقوع این رویداد قبل از soft_start_time ، هزینه ای در هر ساعت به سایر هزینه ها اضافه می شود ، محاسبه می شود:

   max(0, soft_start_time - t.seconds)
                          * cost_per_hour_before_soft_start_time / 3600,
t being the time of the event.

این هزینه باید مثبت باشد و در صورت تنظیم SOFT_START_TIME ، می توان آن را تنظیم کرد.

cost_ per_ hour_ after_ soft_ end_ time

double

در صورت وقوع این رویداد پس از soft_end_time ، هزینه در هر ساعت به سایر هزینه های مدل اضافه می شود: محاسبه شده است:

   max(0, t.seconds - soft_end_time.seconds)
                    * cost_per_hour_after_soft_end_time / 3600,
t being the time of the event.

این هزینه باید مثبت باشد و در صورت تنظیم soft_end_time ، می توان زمینه را تنظیم کرد.

انتقال

ویژگی های انتقال بین دو بازدید متوالی در یک مسیر را مشخص می کند. چندین TransitionAttributes ممکن است برای همان انتقال اعمال شود: در این حالت ، تمام هزینه های اضافی اضافه می شوند و سخت ترین محدودیت یا حد اعمال می شود (به دنبال معناشناسی طبیعی "و" معناشناسی).

فیلدها
src_ tag

string

برچسب هایی که مجموعه ای از انتقال (SRC-> DST) را تعیین می کند ، این ویژگی ها به آن اعمال می شود.

بازدید از منبع یا شروع وسیله نقلیه در صورت بازدید از VisitRequest.tags یا Vehicle.start_tags یا شامل src_tag است یا حاوی excluded_src_tag نیست (بسته به اینکه کدام یک از این دو زمینه غیر خالی است).

excluded_ src_ tag

string

src_tag ببینید. دقیقاً یکی از src_tag و excluded_src_tag باید غیر خالی باشد.

dst_ tag

string

بازدید از مقصد یا پایان خودرو مطابقت دارد اگر VisitRequest.tags یا Vehicle.end_tags باشد. end_tags یا حاوی dst_tag است یا حاوی excluded_dst_tag نیست (بسته به اینکه کدام یک از این دو زمینه خالی نیست).

excluded_ dst_ tag

string

به dst_tag مراجعه کنید. دقیقاً یکی از dst_tag و excluded_dst_tag باید غیر خالی باشد.

cost

double

هزینه ای را برای انجام این انتقال مشخص می کند. این در همان واحد مانند سایر هزینه های مدل است و نباید منفی باشد. در بالای تمام هزینه های موجود دیگر اعمال می شود.

cost_ per_ kilometer

double

هزینه ای را برای هر کیلومتر اعمال شده برای مسافت طی شده هنگام انجام این انتقال مشخص می کند. این به هر Vehicle.cost_per_kilometer اضافه می کند. cost_per_kilometer مشخص شده در وسایل نقلیه.

distance_ limit

DistanceLimit

محدودیت در مسافت طی شده هنگام انجام این انتقال را مشخص می کند.

از سال 2021/06 ، فقط از محدودیت های نرم پشتیبانی می شود.

delay

Duration

تأخیر ناشی از انجام این انتقال را مشخص می کند.

این تأخیر همیشه پس از اتمام بازدید منبع و قبل از شروع بازدید از مقصد اتفاق می افتد.

وسیله نقلیه

یک وسیله نقلیه را در مشکل حمل و نقل مدل می کند. حل یک مشکل حمل و نقل مسیری را که از start_location شروع می شود و به پایان می رسد در end_location برای این وسیله نقلیه ساخته می شود. یک مسیر دنباله ای از بازدیدها است (به ShipmentRoute مراجعه کنید).

فیلدها
display_ name

string

نام نمایشگر تعریف شده توسط کاربر. این می تواند تا 63 کاراکتر طول داشته باشد و ممکن است از شخصیت های UTF-8 استفاده کند.

travel_ mode

TravelMode

حالت سفر که بر جاده های قابل استفاده توسط وسیله نقلیه و سرعت آن تأثیر می گذارد. همچنین به travel_duration_multiple مراجعه کنید.

route_ modifiers

RouteModifiers

مجموعه ای از شرایط برای برآورده کردن تأثیرگذاری بر نحوه محاسبه مسیرها برای وسیله نقلیه داده شده.

start_ location

LatLng

موقعیت جغرافیایی که در آن وسیله نقلیه قبل از انتخاب هرگونه محموله شروع می شود. اگر مشخص نشده باشد ، وسیله نقلیه در اولین وانت خود شروع می شود. اگر مدل حمل و نقل دارای ماتریس مدت و فاصله باشد ، start_location نباید مشخص شود.

start_ waypoint

Waypoint

Waypoint نمایانگر یک مکان جغرافیایی است که در آن وسیله نقلیه قبل از انتخاب هرگونه محموله شروع می شود. اگر نه start_waypoint و نه start_location مشخص نشده باشد ، وسیله نقلیه در اولین وانت خود شروع می شود. اگر مدل حمل و نقل دارای ماتریس مدت زمان و فاصله باشد ، نباید start_waypoint مشخص شود.

end_ location

LatLng

موقعیت جغرافیایی که پس از اتمام آخرین VisitRequest خود ، وسیله نقلیه به پایان می رسد. اگر مشخص نشده باشد ShipmentRoute وسیله نقلیه بلافاصله با پایان یافتن آخرین VisitRequest خود به پایان می رسد. اگر مدل حمل و نقل دارای ماتریس مدت و فاصله باشد ، باید end_location مشخص شود.

end_ waypoint

Waypoint

Waypoint نمایانگر یک مکان جغرافیایی است که وسیله نقلیه پس از اتمام آخرین VisitRequest خود به پایان می رسد. اگر نه end_waypoint و نه end_location مشخص نشود ، ShipmentRoute وسیله نقلیه بلافاصله با پایان یافتن آخرین VisitRequest خود به پایان می رسد. اگر مدل حمل و نقل دارای ماتریس مدت زمان و فاصله باشد ، end_waypoint نباید مشخص شود.

start_ tags[]

string

برچسب های متصل به شروع مسیر وسیله نقلیه را مشخص می کند.

رشته های خالی یا کپی مجاز نیستند.

end_ tags[]

string

برچسب های متصل به انتهای مسیر وسیله نقلیه را مشخص می کند.

رشته های خالی یا کپی مجاز نیستند.

start_ time_ windows[]

TimeWindow

ویندوزهای زمانی که در طی آن وسیله نقلیه ممکن است محل شروع خود را ترک کند. آنها باید در محدوده زمان جهانی باشند (به زمینه های ShipmentModel.global_* مراجعه کنید). اگر نامشخص باشد ، علاوه بر محدودیت های زمان جهانی ، هیچ محدودیتی وجود ندارد.

ویندوزهای زمانی متعلق به همان زمینه مکرر باید از هم جدا شوند ، یعنی هیچ پنجره زمانی نمی تواند با دیگری همپوشانی داشته باشد یا در مجاورت دیگری باشد و باید به ترتیب زمانی باشد.

cost_per_hour_after_soft_end_time و soft_end_time فقط در صورت وجود یک پنجره زمانی تنظیم می شود.

end_ time_ windows[]

TimeWindow

ویندوزهای زمانی که در طی آن وسیله نقلیه ممکن است به محل انتها برسد. آنها باید در محدوده زمان جهانی باشند (به زمینه های ShipmentModel.global_* مراجعه کنید). اگر نامشخص باشد ، علاوه بر محدودیت های زمان جهانی ، هیچ محدودیتی وجود ندارد.

ویندوزهای زمانی متعلق به همان زمینه مکرر باید از هم جدا شوند ، یعنی هیچ پنجره زمانی نمی تواند با دیگری همپوشانی داشته باشد یا در مجاورت دیگری باشد و باید به ترتیب زمانی باشد.

cost_per_hour_after_soft_end_time و soft_end_time فقط در صورت وجود یک پنجره زمانی تنظیم می شود.

unloading_ policy

UnloadingPolicy

خط مشی تخلیه شده روی وسیله نقلیه.

load_ limits

map<string, LoadLimit >

ظرفیت وسیله نقلیه (وزن ، حجم ، # پالت به عنوان مثال). کلیدهای موجود در نقشه شناسه های نوع بار هستند ، مطابق با کلیدهای قسمت Shipment.load_demands . bload_demands. اگر یک کلید معین از این نقشه غایب باشد ، ظرفیت مربوطه بی حد و حصر در نظر گرفته می شود.

cost_ per_ hour

double

هزینه های وسیله نقلیه: تمام هزینه ها اضافه می شوند و باید در واحد Shipment.penalty_cost قرار داشته باشند. PENATTY_COST.

هزینه در هر ساعت مسیر وسیله نقلیه. این هزینه برای کل زمان که در طول مسیر گرفته شده اعمال می شود و شامل زمان سفر ، زمان انتظار و زمان بازدید است. استفاده از cost_per_hour به جای فقط cost_per_traveled_hour ممکن است منجر به تأخیر اضافی شود.

cost_ per_ traveled_ hour

double

هزینه هر ساعت سفر از مسیر وسیله نقلیه. این هزینه فقط برای زمان سفر گرفته شده توسط مسیر (یعنی گزارش شده در ShipmentRoute.transitions ) اعمال می شود ، و زمان انتظار و زمان بازدید را حذف نمی کند.

cost_ per_ kilometer

double

هزینه هر کیلومتر مسیر وسیله نقلیه. این هزینه برای مسافت گزارش arrival_location departure_location ShipmentRoute.transitions VisitRequest شده است.

fixed_ cost

double

در صورت استفاده از این وسیله نقلیه برای رسیدگی به محموله ، هزینه ثابت اعمال می شود.

used_ if_ route_ is_ empty

bool

این زمینه فقط در مورد وسایل نقلیه اعمال می شود که مسیر آنها در خدمت هیچ محموله ای نباشد. این نشان می دهد که آیا وسیله نقلیه باید در این مورد استفاده شود یا خیر.

اگر درست باشد ، وسیله نقلیه از شروع خود به محل پایان خود می رود حتی اگر در خدمت هیچ محموله ای نباشد ، و هزینه های زمان و مسافت ناشی از شروع آن -> سفر پایان در نظر گرفته می شود.

در غیر این صورت ، از شروع آن به محل پایان خود سفر نمی کند ، و هیچ break_rule یا Dealy (از TransitionAttributes ) برای این وسیله نقلیه برنامه ریزی نشده است. در این حالت ، ShipmentRoute وسیله نقلیه هیچ اطلاعاتی به جز شاخص و برچسب وسیله نقلیه ندارد.

route_ duration_ limit

DurationLimit

حد اعمال شده در کل مدت زمان مسیر وسیله نقلیه. در OptimizeToursResponse شده ، مدت زمان مسیر یک وسیله نقلیه تفاوت بین vehicle_end_time و vehicle_start_time است.

travel_ duration_ limit

DurationLimit

محدودیت اعمال شده در طول سفر مسیر وسیله نقلیه. در یک OptimizeToursResponse بهینه ، مدت زمان سفر ، مجموع تمام transitions.travel_duration آن است. travel_duration.

route_ distance_ limit

DistanceLimit

Limit applied to the total distance of the vehicle's route. In a given OptimizeToursResponse , the route distance is the sum of all its transitions.travel_distance_meters .

extra_ visit_ duration_ for_ visit_ type

map<string, Duration >

Specifies a map from visit_types strings to durations. The duration is time in addition to VisitRequest.duration to be taken at visits with the specified visit_types . This extra visit duration adds cost if cost_per_hour is specified. Keys (ie visit_types ) cannot be empty strings.

If a visit request has multiple types, a duration will be added for each type in the map.

break_ rule

BreakRule

Describes the break schedule to be enforced on this vehicle. If empty, no breaks will be scheduled for this vehicle.

label

string

Specifies a label for this vehicle. This label is reported in the response as the vehicle_label of the corresponding ShipmentRoute .

ignore

bool

If true, used_if_route_is_empty must be false, and this vehicle will remain unused.

If a shipment is performed by an ignored vehicle in injected_first_solution_routes , it is skipped in the first solution but is free to be performed in the response.

If a shipment is performed by an ignored vehicle in injected_solution_constraint and any related pickup/delivery is constrained to remain on the vehicle (ie, not relaxed to level RELAX_ALL_AFTER_THRESHOLD ), it is skipped in the response. If a shipment has a non-empty allowed_vehicle_indices field and all of the allowed vehicles are ignored, it is skipped in the response.

travel_ duration_ multiple

double

Specifies a multiplicative factor that can be used to increase or decrease travel times of this vehicle. For example, setting this to 2.0 means that this vehicle is slower and has travel times that are twice what they are for standard vehicles. This multiple does not affect visit durations. It does affect cost if cost_per_hour or cost_per_traveled_hour are specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle is standard, and this multiple is considered 1.0.

WARNING: Travel times will be rounded to the nearest second after this multiple is applied but before performing any numerical operations, thus, a small multiple may result in a loss of precision.

See also extra_visit_duration_for_visit_type below.

DurationLimit

A limit defining a maximum duration of the route of a vehicle. It can be either hard or soft.

When a soft limit field is defined, both the soft max threshold and its associated cost must be defined together.

فیلدها
max_ duration

Duration

A hard limit constraining the duration to be at most max_duration.

soft_ max_ duration

Duration

A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit.

If defined, soft_max_duration must be nonnegative. If max_duration is also defined, soft_max_duration must be less than max_duration.

quadratic_ soft_ max_ duration

Duration

A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit.

If defined, quadratic_soft_max_duration must be nonnegative. If max_duration is also defined, quadratic_soft_max_duration must be less than max_duration , and the difference must be no larger than one day:

max_duration - quadratic_soft_max_duration <= 86400 seconds

cost_ per_ hour_ after_ soft_ max

double

Cost per hour incurred if the soft_max_duration threshold is violated. The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows:

  cost_per_hour_after_soft_max * (duration - soft_max_duration)

The cost must be nonnegative.

cost_ per_ square_ hour_ after_ quadratic_ soft_ max

double

Cost per square hour incurred if the quadratic_soft_max_duration threshold is violated.

The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows:

  cost_per_square_hour_after_quadratic_soft_max *
  (duration - quadratic_soft_max_duration)^2

The cost must be nonnegative.

LoadLimit

Defines a load limit applying to a vehicle, eg "this truck may only carry up to 3500 kg". See load_limits .

فیلدها
soft_ max_ load

int64

A soft limit of the load. See cost_per_unit_above_soft_max .

cost_ per_ unit_ above_ soft_ max

double

If the load ever exceeds soft_max_load along this vehicle's route, the following cost penalty applies (only once per vehicle): (load - soft_max_load ) * cost_per_unit_above_soft_max . All costs add up and must be in the same unit as Shipment.penalty_cost .

start_ load_ interval

Interval

The acceptable load interval of the vehicle at the start of the route.

end_ load_ interval

Interval

The acceptable load interval of the vehicle at the end of the route.

max_ load

int64

The maximum acceptable amount of load.

فاصله زمانی

Interval of acceptable load amounts.

فیلدها
min

int64

A minimum acceptable load. Must be ≥ 0. If they're both specified, min must be ≤ max .

max

int64

A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum load is unrestricted by this message. If they're both specified, min must be ≤ max .

TravelMode

Travel modes which can be used by vehicles.

These should be a subset of the Google Maps Platform Routes API travel modes, see: https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteTravelMode

Note: WALKING routes are in beta and might sometimes be missing clear sidewalks or pedestrian paths. You must display this warning to the user for all walking routes that you display in your app.

Enums
TRAVEL_MODE_UNSPECIFIED Unspecified travel mode, equivalent to DRIVING .
DRIVING Travel mode corresponding to driving directions (car, ...).
WALKING Travel mode corresponding to walking directions.

UnloadingPolicy

Policy on how a vehicle can be unloaded. Applies only to shipments having both a pickup and a delivery.

Other shipments are free to occur anywhere on the route independent of unloading_policy .

Enums
UNLOADING_POLICY_UNSPECIFIED Unspecified unloading policy; deliveries must just occur after their corresponding pickups.
LAST_IN_FIRST_OUT Deliveries must occur in reverse order of pickups
FIRST_IN_FIRST_OUT Deliveries must occur in the same order as pickups

نقطه راه

Encapsulates a waypoint. Waypoints mark arrival and departure locations of VisitRequests, and start and end locations of Vehicles.

فیلدها
side_ of_ road

bool

اختیاری. Indicates that the location of this waypoint is meant to have a preference for the vehicle to stop at a particular side of road. When you set this value, the route will pass through the location so that the vehicle can stop at the side of road that the location is biased towards from the center of the road. This option doesn't work for the 'WALKING' travel mode.

Union field location_type . Different ways to represent a location. location_type can be only one of the following:
location

Location

A point specified using geographic coordinates, including an optional heading.

place_ id

string

The POI place ID associated with the waypoint.

When using a place ID to specify arrival or departure location of a VisitRequest, use a place ID that is specific enough to determine a LatLng location for navigation to the place. For example, a place ID representing a building is suitable, but a place ID representing a road is discouraged.

،

شاخص

RouteOptimization

A service for optimizing vehicle tours.

Validity of certain types of fields:

  • google.protobuf.Timestamp
    • Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00.
    • seconds must be in [0, 253402300799], ie in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
    • nanos must be unset or set to 0.
  • google.protobuf.Duration
    • seconds must be in [0, 253402300799], ie in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
    • nanos must be unset or set to 0.
  • google.type.LatLng
    • latitude must be in [-90.0, 90.0].
    • longitude must be in [-180.0, 180.0].
    • at least one of latitude and longitude must be non-zero.
BatchOptimizeTours

rpc BatchOptimizeTours( BatchOptimizeToursRequest ) returns ( Operation )

Optimizes vehicle tours for one or more OptimizeToursRequest messages as a batch.

This method is a Long Running Operation (LRO). The inputs for optimization ( OptimizeToursRequest messages) and outputs ( OptimizeToursResponse messages) are read from and written to Cloud Storage in user-specified format. Like the OptimizeTours method, each OptimizeToursRequest contains a ShipmentModel and returns an OptimizeToursResponse containing ShipmentRoute fields, which are a set of routes to be performed by vehicles minimizing the overall cost.

The user can poll operations.get to check the status of the LRO:

If the LRO done field is false, then at least one request is still being processed. Other requests may have completed successfully and their results are available in Cloud Storage.

If the LRO's done field is true, then all requests have been processed. Any successfully processed requests will have their results available in Cloud Storage. Any requests that failed will not have their results available in Cloud Storage. If the LRO's error field is set, then it contains the error from one of the failed requests.

محدوده مجوز

به محدوده OAuth زیر نیاز دارد:

  • https://www.googleapis.com/auth/cloud-platform
مجوزهای IAM

Requires the following IAM permission on the parent resource:

  • routeoptimization.operations.create

For more information, see the IAM documentation .

OptimizeTours

rpc OptimizeTours( OptimizeToursRequest ) returns ( OptimizeToursResponse )

Sends an OptimizeToursRequest containing a ShipmentModel and returns an OptimizeToursResponse containing ShipmentRoute s, which are a set of routes to be performed by vehicles minimizing the overall cost.

A ShipmentModel model consists mainly of Shipment s that need to be carried out and Vehicle s that can be used to transport the Shipment s. The ShipmentRoute s assign Shipment s to Vehicle s. More specifically, they assign a series of Visit s to each vehicle, where a Visit corresponds to a VisitRequest , which is a pickup or delivery for a Shipment .

The goal is to provide an assignment of ShipmentRoute s to Vehicle s that minimizes the total cost where cost has many components defined in the ShipmentModel .

محدوده مجوز

به محدوده OAuth زیر نیاز دارد:

  • https://www.googleapis.com/auth/cloud-platform
مجوزهای IAM

Requires the following IAM permission on the parent resource:

  • routeoptimization.locations.use

For more information, see the IAM documentation .

AggregatedMetrics

Aggregated metrics for ShipmentRoute (resp. for OptimizeToursResponse over all Transition and/or Visit (resp. over all ShipmentRoute ) elements.

فیلدها
performed_ shipment_ count

int32

Number of shipments performed. Note that a pickup and delivery pair only counts once.

travel_ duration

Duration

Total travel duration for a route or a solution.

wait_ duration

Duration

Total wait duration for a route or a solution.

delay_ duration

Duration

Total delay duration for a route or a solution.

break_ duration

Duration

Total break duration for a route or a solution.

visit_ duration

Duration

Total visit duration for a route or a solution.

total_ duration

Duration

The total duration should be equal to the sum of all durations above. For routes, it also corresponds to:

[ShipmentRoute.vehicle_end_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_end_time] - [ShipmentRoute.vehicle_start_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_start_time]
travel_ distance_ meters

double

Total travel distance for a route or a solution.

max_ loads

map<string, VehicleLoad >

Maximum load achieved over the entire route (resp. solution), for each of the quantities on this route (resp. solution), computed as the maximum over all Transition.vehicle_loads (resp. ShipmentRoute.metrics.max_loads .

BatchOptimizeToursMetadata

This type has no fields.

Operation metadata for BatchOptimizeToursRequest calls.

BatchOptimizeToursRequest

Request to batch optimize tours as an asynchronous operation. Each input file should contain one OptimizeToursRequest , and each output file will contain one OptimizeToursResponse . The request contains information to read/write and parse the files. All the input and output files should be under the same project.

فیلدها
parent

string

مورد نیاز. Target project and location to make a call.

Format: * projects/{project-id} * projects/{project-id}/locations/{location-id}

If no location is specified, a region will be chosen automatically.

model_ configs[]

AsyncModelConfig

مورد نیاز. Input/Output information each purchase model, such as file paths and data formats.

AsyncModelConfig

Information for solving one optimization model asynchronously.

فیلدها
display_ name

string

اختیاری. User defined model name, can be used as alias by users to keep track of models.

input_ config

InputConfig

مورد نیاز. Information about the input model.

output_ config

OutputConfig

مورد نیاز. The desired output location information.

BatchOptimizeToursResponse

This type has no fields.

Response to a BatchOptimizeToursRequest . This is returned in the Long Running Operation after the operation is complete.

BreakRule

Rules to generate time breaks for a vehicle (eg lunch breaks). A break is a contiguous period of time during which the vehicle remains idle at its current position and cannot perform any visit. A break may occur:

  • during the travel between two visits (which includes the time right before or right after a visit, but not in the middle of a visit), in which case it extends the corresponding transit time between the visits,
  • or before the vehicle start (the vehicle may not start in the middle of a break), in which case it does not affect the vehicle start time.
  • or after the vehicle end (ditto, with the vehicle end time).
فیلدها
break_ requests[]

BreakRequest

Sequence of breaks. See the BreakRequest message.

frequency_ constraints[]

FrequencyConstraint

Several FrequencyConstraint may apply. They must all be satisfied by the BreakRequest s of this BreakRule . See FrequencyConstraint .

BreakRequest

The sequence of breaks (ie their number and order) that apply to each vehicle must be known beforehand. The repeated BreakRequest s define that sequence, in the order in which they must occur. Their time windows ( earliest_start_time / latest_start_time ) may overlap, but they must be compatible with the order (this is checked).

فیلدها
earliest_ start_ time

Timestamp

مورد نیاز. Lower bound (inclusive) on the start of the break.

latest_ start_ time

Timestamp

مورد نیاز. Upper bound (inclusive) on the start of the break.

min_ duration

Duration

مورد نیاز. Minimum duration of the break. باید مثبت باشه

FrequencyConstraint

One may further constrain the frequency and duration of the breaks specified above, by enforcing a minimum break frequency, such as "There must be a break of at least 1 hour every 12 hours". Assuming that this can be interpreted as "Within any sliding time window of 12h, there must be at least one break of at least one hour", that example would translate to the following FrequencyConstraint :

{
   min_break_duration { seconds: 3600 }         # 1 hour.
   max_inter_break_duration { seconds: 39600 }  # 11 hours (12 - 1 = 11).
}

The timing and duration of the breaks in the solution will respect all such constraints, in addition to the time windows and minimum durations already specified in the BreakRequest .

A FrequencyConstraint may in practice apply to non-consecutive breaks. For example, the following schedule honors the "1h every 12h" example:

  04:00 vehicle start
   .. performing travel and visits ..
  09:00 1 hour break
  10:00 end of the break
   .. performing travel and visits ..
  12:00 20-min lunch break
  12:20 end of the break
   .. performing travel and visits ..
  21:00 1 hour break
  22:00 end of the break
   .. performing travel and visits ..
  23:59 vehicle end
فیلدها
min_ break_ duration

Duration

مورد نیاز. Minimum break duration for this constraint. Nonnegative. See description of FrequencyConstraint .

max_ inter_ break_ duration

Duration

مورد نیاز. Maximum allowed span of any interval of time in the route that does not include at least partially a break of duration >= min_break_duration . باید مثبت باشه

DataFormat

Data formats for input and output files.

Enums
DATA_FORMAT_UNSPECIFIED Invalid value, format must not be UNSPECIFIED.
JSON نشانه گذاری شی جاوا اسکریپت.
PROTO_TEXT Protocol Buffers text format. See https://protobuf.dev/reference/protobuf/textformat-spec/

DistanceLimit

A limit defining a maximum distance which can be traveled. It can be either hard or soft.

If a soft limit is defined, both soft_max_meters and cost_per_kilometer_above_soft_max must be defined and be nonnegative.

فیلدها
max_ meters

int64

A hard limit constraining the distance to be at most max_meters. The limit must be nonnegative.

soft_ max_ meters

int64

A soft limit not enforcing a maximum distance limit, but when violated results in a cost which adds up to other costs defined in the model, with the same unit.

If defined soft_max_meters must be less than max_meters and must be nonnegative.

cost_ per_ kilometer_ below_ soft_ max

double

Cost per kilometer incurred, increasing up to soft_max_meters , with formula:

  min(distance_meters, soft_max_meters) / 1000.0 *
  cost_per_kilometer_below_soft_max.

This cost is not supported in route_distance_limit .

cost_ per_ kilometer_ above_ soft_ max

double

Cost per kilometer incurred if distance is above soft_max_meters limit. The additional cost is 0 if the distance is under the limit, otherwise the formula used to compute the cost is the following:

  (distance_meters - soft_max_meters) / 1000.0 *
  cost_per_kilometer_above_soft_max.

The cost must be nonnegative.

GcsDestination

The Google Cloud Storage location where the output file(s) will be written to.

فیلدها
uri

string

مورد نیاز. Google Cloud Storage URI.

منبع Gcs

The Google Cloud Storage location where the input file will be read from.

فیلدها
uri

string

مورد نیاز. URI of a Google Cloud Storage object with the format gs://bucket/path/to/object .

InjectedSolutionConstraint

راه حل تزریق شده در درخواست شامل اطلاعاتی در مورد اینکه کدام بازدیدها باید محدود شوند و چگونه باید محدود شوند.

فیلدها
routes[]

ShipmentRoute

مسیرهای محلول برای تزریق برخی از مسیرها ممکن است از راه حل اصلی حذف شوند. The routes and skipped shipments must satisfy the basic validity assumptions listed for injected_first_solution_routes .

skipped_ shipments[]

SkippedShipment

محموله های محلول برای تزریق نادیده گرفته شده است. ممکن است برخی از راه حل اصلی حذف شوند. قسمت routes را ببینید.

constraint_ relaxations[]

ConstraintRelaxation

برای گروه های صفر یا چند وسیله نقلیه، زمان و میزان کاهش محدودیت ها را مشخص می کند. اگر این فیلد خالی باشد، تمام مسیرهای غیرخالی وسایل نقلیه کاملاً محدود می شوند.

محدودیت آرامش

برای گروهی از وسایل نقلیه، مشخص می‌کند که محدودیت‌های بازدید در چه آستانه‌ای کاهش می‌یابند و تا چه سطحی. محموله های فهرست شده در قسمت skipped_shipment محدود به نادیده گرفتن هستند. یعنی نمی توان آنها را اجرا کرد.

فیلدها
relaxations[]

Relaxation

All the visit constraint relaxations that will apply to visits on routes with vehicles in vehicle_indices .

vehicle_ indices[]

int32

شاخص‌های وسیله نقلیه را مشخص می‌کند که relaxations محدودیت بازدید برای آنها اعمال می‌شود. If empty, this is considered the default and the relaxations apply to all vehicles that are not specified in other constraint_relaxations . There can be at most one default, ie, at most one constraint relaxation field is allowed empty vehicle_indices . A vehicle index can only be listed once, even within several constraint_relaxations .

A vehicle index is mapped the same as ShipmentRoute.vehicle_index , if interpret_injected_solutions_using_labels is true (see fields comment).

آرامش

اگر relaxations خالی باشد، زمان شروع و ترتیب همه بازدیدها در routes کاملاً محدود است و هیچ بازدید جدیدی نمی تواند در آن مسیرها درج یا اضافه شود. Also, a vehicle's start and end time in routes is fully constrained, unless the vehicle is empty (ie, has no visits and has used_if_route_is_empty set to false in the model).

relaxations(i).level سطح آرامش محدودیت اعمال شده برای بازدید #j را مشخص می کند که:

  • route.visits(j).start_time >= relaxations(i).threshold_time AND
  • j + 1 >= relaxations(i).threshold_visit_count

به طور مشابه، استارت وسیله نقلیه تا relaxations(i).level اگر برآورده شود:

  • vehicle_start_time >= relaxations(i).threshold_time AND
  • relaxations(i).threshold_visit_count == 0 و انتهای وسیله نقلیه به relaxations(i).level رها می شود اگر برآورده شود:
  • vehicle_end_time >= relaxations(i).threshold_time AND
  • route.visits_size() + 1 >= relaxations(i).threshold_visit_count

To apply a relaxation level if a visit meets the threshold_visit_count OR the threshold_time add two relaxations with the same level : one with only threshold_visit_count set and the other with only threshold_time set. اگر یک بازدید شرایط relaxations متعدد را برآورده کند، آرام ترین سطح اعمال می شود. در نتیجه، از شروع وسیله نقلیه تا بازدیدهای مسیر تا پایان وسیله نقلیه، سطح آرامش بیشتر می شود: یعنی با پیشرفت مسیر، سطح آرامش کاهش نمی یابد.

زمان و توالی بازدیدهای مسیری که شرایط آستانه هر relaxations را برآورده نمی کند کاملاً محدود است و هیچ بازدیدی ممکن است در این توالی درج نشود. همچنین، اگر شروع یا پایان وسیله نقلیه شرایط آرامش را برآورده نکند، زمان ثابت است، مگر اینکه وسیله نقلیه خالی باشد.

فیلدها
level

Level

The constraint relaxation level that applies when the conditions at or after threshold_time AND at least threshold_visit_count are satisfied.

threshold_ time

Timestamp

زمانی که level آرامش ممکن است اعمال شود یا بعد از آن.

threshold_ visit_ count

int32

تعداد بازدیدهایی که ممکن است level آرامش یا پس از آن اعمال شود. If threshold_visit_count is 0 (or unset), the level may be applied directly at the vehicle start.

اگر route.visits_size() + 1 باشد، level ممکن است فقط برای انتهای خودرو اعمال شود. اگر بیشتر از route.visits_size() + 1 باشد، level به هیچ وجه برای آن مسیر اعمال نمی شود.

سطح

سطوح مختلف آرامش محدودیت را بیان می‌کند که برای یک بازدید اعمال می‌شود و آن‌هایی که پس از آن زمانی که شرایط آستانه را برآورده می‌کنند، اعمال می‌شوند.

شمارش زیر به ترتیب افزایش آرامش است.

Enums
LEVEL_UNSPECIFIED

سطح آرامش پیش‌فرض ضمنی: هیچ محدودیتی کاهش نمی‌یابد، یعنی همه بازدیدها کاملاً محدود می‌شوند.

این مقدار نباید به صراحت در level استفاده شود.

RELAX_VISIT_TIMES_AFTER_THRESHOLD زمان شروع بازدید و زمان شروع/پایان وسیله نقلیه آرام خواهد بود، اما هر بازدید به همان وسیله نقلیه محدود می‌شود و توالی بازدید باید رعایت شود: هیچ بازدیدی بین آنها یا قبل از آنها نمی‌تواند وارد شود.
RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD مانند RELAX_VISIT_TIMES_AFTER_THRESHOLD ، اما توالی بازدید نیز آرام است: بازدیدها فقط توسط این وسیله نقلیه قابل انجام است، اما به طور بالقوه ممکن است انجام نشوند.
RELAX_ALL_AFTER_THRESHOLD مانند RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD ، اما وسیله نقلیه نیز آرام است: بازدیدها در زمان آستانه یا بعد از آن کاملا رایگان هستند و ممکن است به طور بالقوه انجام نشوند.

InputConfig

Specify an input for [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours].

فیلدها
data_ format

DataFormat

مورد نیاز. The input data format.

Union field source . مورد نیاز. source can be only one of the following:
gcs_ source

GcsSource

A Google Cloud Storage location. This must be a single object (file).

مکان

Encapsulates a location (a geographic point, and an optional heading).

فیلدها
lat_ lng

LatLng

The waypoint's geographic coordinates.

heading

int32

The compass heading associated with the direction of the flow of traffic. This value is used to specify the side of the road to use for pickup and drop-off. Heading values can be from 0 to 360, where 0 specifies a heading of due North, 90 specifies a heading of due East, etc.

OptimizeToursRequest

Request to be given to a tour optimization solver which defines the shipment model to solve as well as optimization parameters.

فیلدها
parent

string

مورد نیاز. Target project or location to make a call.

Format: * projects/{project-id} * projects/{project-id}/locations/{location-id}

If no location is specified, a region will be chosen automatically.

timeout

Duration

If this timeout is set, the server returns a response before the timeout period has elapsed or the server deadline for synchronous requests is reached, whichever is sooner.

For asynchronous requests, the server will generate a solution (if possible) before the timeout has elapsed.

model

ShipmentModel

Shipment model to solve.

solving_ mode

SolvingMode

By default, the solving mode is DEFAULT_SOLVE (0).

search_ mode

SearchMode

Search mode used to solve the request.

injected_ first_ solution_ routes[]

ShipmentRoute

Guide the optimization algorithm in finding a first solution that is similar to a previous solution.

The model is constrained when the first solution is built. Any shipments not performed on a route are implicitly skipped in the first solution, but they may be performed in successive solutions.

The solution must satisfy some basic validity assumptions:

  • for all routes, vehicle_index must be in range and not be duplicated.
  • for all visits, shipment_index and visit_request_index must be in range.
  • a shipment may only be referenced on one route.
  • the pickup of a pickup-delivery shipment must be performed before the delivery.
  • no more than one pickup alternative or delivery alternative of a shipment may be performed.
  • for all routes, times are increasing (ie, vehicle_start_time <= visits[0].start_time <= visits[1].start_time ... <= vehicle_end_time ).
  • a shipment may only be performed on a vehicle that is allowed. A vehicle is allowed if Shipment.allowed_vehicle_indices is empty or its vehicle_index is included in Shipment.allowed_vehicle_indices .

If the injected solution is not feasible, a validation error is not necessarily returned and an error indicating infeasibility may be returned instead.

injected_ solution_ constraint

InjectedSolutionConstraint

Constrain the optimization algorithm to find a final solution that is similar to a previous solution. For example, this may be used to freeze portions of routes which have already been completed or which are to be completed but must not be modified.

If the injected solution is not feasible, a validation error is not necessarily returned and an error indicating infeasibility may be returned instead.

refresh_ details_ routes[]

ShipmentRoute

If non-empty, the given routes will be refreshed, without modifying their underlying sequence of visits or travel times: only other details will be updated. This does not solve the model.

As of 2020/11, this only populates the polylines of non-empty routes and requires that populate_polylines is true.

The route_polyline fields of the passed-in routes may be inconsistent with route transitions .

This field must not be used together with injected_first_solution_routes or injected_solution_constraint .

Shipment.ignore and Vehicle.ignore have no effect on the behavior. Polylines are still populated between all visits in all non-empty routes regardless of whether the related shipments or vehicles are ignored.

interpret_ injected_ solutions_ using_ labels

bool

اگر درست باشد:

This interpretation applies to the injected_first_solution_routes , injected_solution_constraint , and refresh_details_routes fields. It can be used when shipment or vehicle indices in the request have changed since the solution was created, perhaps because shipments or vehicles have been removed from or added to the request.

If true, labels in the following categories must appear at most once in their category:

If a vehicle_label in the injected solution does not correspond to a request vehicle, the corresponding route is removed from the solution along with its visits. If a shipment_label in the injected solution does not correspond to a request shipment, the corresponding visit is removed from the solution. If a SkippedShipment.label in the injected solution does not correspond to a request shipment, the SkippedShipment is removed from the solution.

Removing route visits or entire routes from an injected solution may have an effect on the implied constraints, which may lead to change in solution, validation errors, or infeasibility.

NOTE: The caller must ensure that each Vehicle.label (resp. Shipment.label ) uniquely identifies a vehicle (resp. shipment) entity used across the two relevant requests: the past request that produced the OptimizeToursResponse used in the injected solution and the current request that includes the injected solution. The uniqueness checks described above are not enough to guarantee this requirement.

consider_ road_ traffic

bool

Consider traffic estimation in calculating ShipmentRoute fields Transition.travel_duration , Visit.start_time , and vehicle_end_time ; in setting the ShipmentRoute.has_traffic_infeasibilities field, and in calculating the OptimizeToursResponse.total_cost field.

populate_ polylines

bool

If true, polylines will be populated in response ShipmentRoute s.

populate_ transition_ polylines

bool

If true, polylines and route tokens will be populated in response ShipmentRoute.transitions .

allow_ large_ deadline_ despite_ interruption_ risk

bool

If this is set, then the request can have a deadline (see https://grpc.io/blog/deadlines ) of up to 60 minutes. Otherwise, the maximum deadline is only 30 minutes. Note that long-lived requests have a significantly larger (but still small) risk of interruption.

use_ geodesic_ distances

bool

If true, travel distances will be computed using geodesic distances instead of Google Maps distances, and travel times will be computed using geodesic distances with a speed defined by geodesic_meters_per_second .

label

string

Label that may be used to identify this request, reported back in the OptimizeToursResponse.request_label .

geodesic_ meters_ per_ second

double

When use_geodesic_distances is true, this field must be set and defines the speed applied to compute travel times. Its value must be at least 1.0 meters/seconds.

max_ validation_ errors

int32

Truncates the number of validation errors returned. These errors are typically attached to an INVALID_ARGUMENT error payload as a BadRequest error detail ( https://cloud.google.com/apis/design/errors#error_details) , unless solving_mode=VALIDATE_ONLY: see the OptimizeToursResponse.validation_errors field. This defaults to 100 and is capped at 10,000.

SearchMode

Mode defining the behavior of the search, trading off latency versus solution quality. In all modes, the global request deadline is enforced.

Enums
SEARCH_MODE_UNSPECIFIED Unspecified search mode, equivalent to RETURN_FAST .
RETURN_FAST Stop the search after finding the first good solution.
CONSUME_ALL_AVAILABLE_TIME Spend all the available time to search for better solutions.

SolvingMode

Defines how the solver should handle the request. In all modes but VALIDATE_ONLY , if the request is invalid, you will receive an INVALID_REQUEST error. See max_validation_errors to cap the number of errors returned.

Enums
DEFAULT_SOLVE Solve the model. Warnings may be issued in [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors].
VALIDATE_ONLY Only validates the model without solving it: populates as many OptimizeToursResponse.validation_errors as possible.
DETECT_SOME_INFEASIBLE_SHIPMENTS

Only populates OptimizeToursResponse.validation_errors or OptimizeToursResponse.skipped_shipments , and doesn't actually solve the rest of the request ( status and routes are unset in the response). If infeasibilities in injected_solution_constraint routes are detected they are populated in the OptimizeToursResponse.validation_errors field and OptimizeToursResponse.skipped_shipments is left empty.

IMPORTANT : not all infeasible shipments are returned here, but only the ones that are detected as infeasible during preprocessing.

OptimizeToursResponse

Response after solving a tour optimization problem containing the routes followed by each vehicle, the shipments which have been skipped and the overall cost of the solution.

فیلدها
routes[]

ShipmentRoute

Routes computed for each vehicle; the i-th route corresponds to the i-th vehicle in the model.

request_ label

string

Copy of the OptimizeToursRequest.label , if a label was specified in the request.

skipped_ shipments[]

SkippedShipment

The list of all shipments skipped.

validation_ errors[]

OptimizeToursValidationError

List of all the validation errors that we were able to detect independently. See the "MULTIPLE ERRORS" explanation for the OptimizeToursValidationError message. Instead of errors, this will include warnings in the case solving_mode is DEFAULT_SOLVE .

metrics

Metrics

Duration, distance and usage metrics for this solution.

معیارها

Overall metrics, aggregated over all routes.

فیلدها
aggregated_ route_ metrics

AggregatedMetrics

Aggregated over the routes. Each metric is the sum (or max, for loads) over all ShipmentRoute.metrics fields of the same name.

skipped_ mandatory_ shipment_ count

int32

Number of mandatory shipments skipped.

used_ vehicle_ count

int32

Number of vehicles used. Note: if a vehicle route is empty and Vehicle.used_if_route_is_empty is true, the vehicle is considered used.

earliest_ vehicle_ start_ time

Timestamp

The earliest start time for a used vehicle, computed as the minimum over all used vehicles of ShipmentRoute.vehicle_start_time .

latest_ vehicle_ end_ time

Timestamp

The latest end time for a used vehicle, computed as the maximum over all used vehicles of ShipmentRoute.vehicle_end_time .

costs

map<string, double>

Cost of the solution, broken down by cost-related request fields. The keys are proto paths, relative to the input OptimizeToursRequest, eg "model.shipments.pickups.cost", and the values are the total cost generated by the corresponding cost field, aggregated over the whole solution. In other words, costs["model.shipments.pickups.cost"] is the sum of all pickup costs over the solution. All costs defined in the model are reported in detail here with the exception of costs related to TransitionAttributes that are only reported in an aggregated way as of 2022/01.

total_ cost

double

Total cost of the solution. The sum of all values in the costs map.

OptimizeToursValidationError

Describes an error or warning encountered when validating an OptimizeToursRequest .

فیلدها
code

int32

A validation error is defined by the pair ( code , display_name ) which are always present.

The fields following this section provide more context about the error.

MULTIPLE ERRORS : When there are multiple errors, the validation process tries to output several of them. Much like a compiler, this is an imperfect process. Some validation errors will be "fatal", meaning that they stop the entire validation process. This is the case for display_name="UNSPECIFIED" errors, among others. Some errors may cause the validation process to skip other errors.

STABILITY : code and display_name should be very stable. But new codes and display names may appear over time, which may cause a given (invalid) request to yield a different ( code , display_name ) pair because the new error hid the old one. For example, see "MULTIPLE ERRORS".

display_ name

string

The error display name.

fields[]

FieldReference

An error context may involve 0, 1 (most of the time) or more fields. For example, referring to vehicle #4 and shipment #2's first pickup can be done as follows:

fields { name: "vehicles" index: 4}
fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} }

Note, however, that the cardinality of fields should not change for a given error code.

error_ message

string

Human-readable string describing the error. There is a 1:1 mapping between code and error_message (when code != "UNSPECIFIED").

STABILITY : Not stable: the error message associated to a given code may change (hopefully to clarify it) over time. Please rely on the display_name and code instead.

offending_ values

string

May contain the value(s) of the field(s). This is not always available. You should absolutely not rely on it and use it only for manual model debugging.

FieldReference

Specifies a context for the validation error. A FieldReference always refers to a given field in this file and follows the same hierarchical structure. For example, we may specify element #2 of start_time_windows of vehicle #5 using:

name: "vehicles" index: 5 sub_field { name: "end_time_windows" index: 2 }

We however omit top-level entities such as OptimizeToursRequest or ShipmentModel to avoid crowding the message.

فیلدها
name

string

Name of the field, eg, "vehicles".

sub_ field

FieldReference

Recursively nested sub-field, if needed.

Union field index_or_key .

index_or_key can be only one of the following:

index

int32

Index of the field if repeated.

key

string

Key if the field is a map.

OutputConfig

Specify a destination for [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours] results.

فیلدها
data_ format

DataFormat

مورد نیاز. The output data format.

Union field destination . مورد نیاز. destination can be only one of the following:
gcs_ destination

GcsDestination

The Google Cloud Storage location to write the output to.

RouteModifiers

Encapsulates a set of optional conditions to satisfy when calculating vehicle routes. This is similar to RouteModifiers in the Google Maps Platform Routes Preferred API; see: https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteModifiers .

فیلدها
avoid_ tolls

bool

Specifies whether to avoid toll roads where reasonable. Preference will be given to routes not containing toll roads. Applies only to motorized travel modes.

avoid_ highways

bool

Specifies whether to avoid highways where reasonable. Preference will be given to routes not containing highways. Applies only to motorized travel modes.

avoid_ ferries

bool

Specifies whether to avoid ferries where reasonable. Preference will be given to routes not containing travel by ferries. Applies only to motorized travel modes.

avoid_ indoor

bool

اختیاری. Specifies whether to avoid navigating indoors where reasonable. Preference will be given to routes not containing indoor navigation. Applies only to the WALKING travel mode.

حمل و نقل

The shipment of a single item, from one of its pickups to one of its deliveries. For the shipment to be considered as performed, a unique vehicle must visit one of its pickup locations (and decrease its spare capacities accordingly), then visit one of its delivery locations later on (and therefore re-increase its spare capacities accordingly).

فیلدها
display_ name

string

The user-defined display name of the shipment. It can be up to 63 characters long and may use UTF-8 characters.

pickups[]

VisitRequest

Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.

deliveries[]

VisitRequest

Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.

load_ demands

map<string, Load >

Load demands of the shipment (for example weight, volume, number of pallets etc). The keys in the map should be identifiers describing the type of the corresponding load, ideally also including the units. For example: "weight_kg", "volume_gallons", "pallet_count", etc. If a given key does not appear in the map, the corresponding load is considered as null.

allowed_ vehicle_ indices[]

int32

The set of vehicles that may perform this shipment. If empty, all vehicles may perform it. Vehicles are given by their index in the ShipmentModel 's vehicles list.

costs_ per_ vehicle[]

double

Specifies the cost that is incurred when this shipment is delivered by each vehicle. If specified, it must have EITHER:

  • the same number of elements as costs_per_vehicle_indices . costs_per_vehicle[i] corresponds to vehicle costs_per_vehicle_indices[i] of the model.
  • the same number of elements as there are vehicles in the model. The i-th element corresponds to vehicle #i of the model.

These costs must be in the same unit as penalty_cost and must not be negative. Leave this field empty, if there are no such costs.

costs_ per_ vehicle_ indices[]

int32

Indices of the vehicles to which costs_per_vehicle applies. If non-empty, it must have the same number of elements as costs_per_vehicle . A vehicle index may not be specified more than once. If a vehicle is excluded from costs_per_vehicle_indices , its cost is zero.

pickup_ to_ delivery_ absolute_ detour_ limit

Duration

Specifies the maximum absolute detour time compared to the shortest path from pickup to delivery. If specified, it must be nonnegative, and the shipment must contain at least a pickup and a delivery.

For example, let t be the shortest time taken to go from the selected pickup alternative directly to the selected delivery alternative. Then setting pickup_to_delivery_absolute_detour_limit enforces:

start_time(delivery) - start_time(pickup) <=
t + pickup_to_delivery_absolute_detour_limit

If both relative and absolute limits are specified on the same shipment, the more constraining limit is used for each possible pickup/delivery pair. As of 2017/10, detours are only supported when travel durations do not depend on vehicles.

pickup_ to_ delivery_ time_ limit

Duration

Specifies the maximum duration from start of pickup to start of delivery of a shipment. If specified, it must be nonnegative, and the shipment must contain at least a pickup and a delivery. This does not depend on which alternatives are selected for pickup and delivery, nor on vehicle speed. This can be specified alongside maximum detour constraints: the solution will respect both specifications.

shipment_ type

string

Non-empty string specifying a "type" for this shipment. This feature can be used to define incompatibilities or requirements between shipment_types (see shipment_type_incompatibilities and shipment_type_requirements in ShipmentModel ).

Differs from visit_types which is specified for a single visit: All pickup/deliveries belonging to the same shipment share the same shipment_type .

label

string

Specifies a label for this shipment. This label is reported in the response in the shipment_label of the corresponding ShipmentRoute.Visit .

ignore

bool

If true, skip this shipment, but don't apply a penalty_cost .

Ignoring a shipment results in a validation error when there are any shipment_type_requirements in the model.

Ignoring a shipment that is performed in injected_first_solution_routes or injected_solution_constraint is permitted; the solver removes the related pickup/delivery visits from the performing route. precedence_rules that reference ignored shipments will also be ignored.

penalty_ cost

double

If the shipment is not completed, this penalty is added to the overall cost of the routes. A shipment is considered completed if one of its pickup and delivery alternatives is visited. The cost may be expressed in the same unit used for all other cost-related fields in the model and must be positive.

IMPORTANT : If this penalty is not specified, it is considered infinite, ie the shipment must be completed.

pickup_ to_ delivery_ relative_ detour_ limit

double

Specifies the maximum relative detour time compared to the shortest path from pickup to delivery. If specified, it must be nonnegative, and the shipment must contain at least a pickup and a delivery.

For example, let t be the shortest time taken to go from the selected pickup alternative directly to the selected delivery alternative. Then setting pickup_to_delivery_relative_detour_limit enforces:

start_time(delivery) - start_time(pickup) <=
std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit))

If both relative and absolute limits are specified on the same shipment, the more constraining limit is used for each possible pickup/delivery pair. As of 2017/10, detours are only supported when travel durations do not depend on vehicles.

بارگذاری کنید

When performing a visit, a predefined amount may be added to the vehicle load if it's a pickup, or subtracted if it's a delivery. This message defines such amount. See load_demands .

فیلدها
amount

int64

The amount by which the load of the vehicle performing the corresponding visit will vary. Since it is an integer, users are advised to choose an appropriate unit to avoid loss of precision. Must be ≥ 0.

VisitRequest

Request for a visit which can be done by a vehicle: it has a geo-location (or two, see below), opening and closing times represented by time windows, and a service duration time (time spent by the vehicle once it has arrived to pickup or drop off goods).

فیلدها
arrival_ location

LatLng

The geo-location where the vehicle arrives when performing this VisitRequest . If the shipment model has duration distance matrices, arrival_location must not be specified.

arrival_ waypoint

Waypoint

The waypoint where the vehicle arrives when performing this VisitRequest . If the shipment model has duration distance matrices, arrival_waypoint must not be specified.

departure_ location

LatLng

The geo-location where the vehicle departs after completing this VisitRequest . Can be omitted if it is the same as arrival_location . If the shipment model has duration distance matrices, departure_location must not be specified.

departure_ waypoint

Waypoint

The waypoint where the vehicle departs after completing this VisitRequest . Can be omitted if it is the same as arrival_waypoint . If the shipment model has duration distance matrices, departure_waypoint must not be specified.

tags[]

string

Specifies tags attached to the visit request. Empty or duplicate strings are not allowed.

time_ windows[]

TimeWindow

Time windows which constrain the arrival time at a visit. Note that a vehicle may depart outside of the arrival time window, ie arrival time + duration do not need to be inside a time window. This can result in waiting time if the vehicle arrives before TimeWindow.start_time .

The absence of TimeWindow means that the vehicle can perform this visit at any time.

Time windows must be disjoint, ie no time window must overlap with or be adjacent to another, and they must be in increasing order.

cost_per_hour_after_soft_end_time and soft_end_time can only be set if there is a single time window.

duration

Duration

Duration of the visit, ie time spent by the vehicle between arrival and departure (to be added to the possible waiting time; see time_windows ).

cost

double

Cost to service this visit request on a vehicle route. This can be used to pay different costs for each alternative pickup or delivery of a shipment. This cost must be in the same unit as Shipment.penalty_cost and must not be negative.

load_ demands

map<string, Load >

Load demands of this visit request. This is just like Shipment.load_demands field, except that it only applies to this VisitRequest instead of the whole Shipment . The demands listed here are added to the demands listed in Shipment.load_demands .

visit_ types[]

string

Specifies the types of the visit. This may be used to allocate additional time required for a vehicle to complete this visit (see Vehicle.extra_visit_duration_for_visit_type ).

A type can only appear once.

label

string

Specifies a label for this VisitRequest . This label is reported in the response as visit_label in the corresponding ShipmentRoute.Visit .

ShipmentModel

A shipment model contains a set of shipments which must be performed by a set of vehicles, while minimizing the overall cost, which is the sum of:

  • the cost of routing the vehicles (sum of cost per total time, cost per travel time, and fixed cost over all vehicles).
  • the unperformed shipment penalties.
  • the cost of the global duration of the shipments
فیلدها
shipments[]

Shipment

Set of shipments which must be performed in the model.

vehicles[]

Vehicle

Set of vehicles which can be used to perform visits.

global_ start_ time

Timestamp

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, ie the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (ie seconds: 0, nanos: 0) is used as default.

global_ end_ time

Timestamp

If unset, 00:00:00 UTC, January 1, 1971 (ie seconds: 31536000, nanos: 0) is used as default.

global_ duration_ cost_ per_ hour

double

The "global duration" of the overall plan is the difference between the earliest effective start time and the latest effective end time of all vehicles. Users can assign a cost per hour to that quantity to try and optimize for earliest job completion, for example. This cost must be in the same unit as Shipment.penalty_cost .

duration_ distance_ matrices[]

DurationDistanceMatrix

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

نمونه های استفاده:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.
model {
  vehicles { start_tags: "locA"  end_tags: "locA" }
  shipments { pickups { tags: "locB" } }
  duration_distance_matrix_src_tags: "locA"
  duration_distance_matrix_src_tags: "locB"
  duration_distance_matrix_dst_tags: "locA"
  duration_distance_matrix_dst_tags: "locB"
  duration_distance_matrices {
    rows {  # from: locA
      durations { seconds: 0 }   meters: 0    # to: locA
      durations { seconds: 100 } meters: 1000 # to: locB
    }
    rows {  # from: locB
      durations { seconds: 102 } meters: 990 # to: locA
      durations { seconds: 0 }   meters: 0   # to: locB
    }
  }
}
  • There are three locations: locA, locB and locC.
  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.
model {
  vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" }
  vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" }
  vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" }
  shipments { pickups { tags: "locC" } }
  duration_distance_matrix_src_tags: "locA"
  duration_distance_matrix_src_tags: "locB"
  duration_distance_matrix_src_tags: "locC"
  duration_distance_matrix_dst_tags: "locB"
  duration_distance_matrix_dst_tags: "locC"
  duration_distance_matrices {
    vehicle_start_tag: "fast"
    rows {  # from: locA
      durations { seconds: 1000 } meters: 2000 # to: locB
      durations { seconds: 600 }  meters: 1000 # to: locC
    }
    rows {  # from: locB
      durations { seconds: 0 }   meters: 0    # to: locB
      durations { seconds: 700 } meters: 1200 # to: locC
    }
    rows {  # from: locC
      durations { seconds: 702 } meters: 1190 # to: locB
      durations { seconds: 0 }   meters: 0    # to: locC
    }
  }
  duration_distance_matrices {
    vehicle_start_tag: "slow"
    rows {  # from: locA
      durations { seconds: 1800 } meters: 2001 # to: locB
      durations { seconds: 900 }  meters: 1002 # to: locC
    }
    rows {  # from: locB
      durations { seconds: 0 }    meters: 0    # to: locB
      durations { seconds: 1000 } meters: 1202 # to: locC
    }
    rows {  # from: locC
      durations { seconds: 1001 } meters: 1195 # to: locB
      durations { seconds: 0 }    meters: 0    # to: locC
    }
  }
}
duration_ distance_ matrix_ src_ tags[]

string

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags . A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle 's source, destination and matrix tags may be the same; similarly a VisitRequest 's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

duration_ distance_ matrix_ dst_ tags[]

string

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags . A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle 's source, destination and matrix tags may be the same; similarly a VisitRequest 's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

transition_ attributes[]

TransitionAttributes

Transition attributes added to the model.

shipment_ type_ incompatibilities[]

ShipmentTypeIncompatibility

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility ).

shipment_ type_ requirements[]

ShipmentTypeRequirement

Sets of shipment_type requirements (see ShipmentTypeRequirement ).

precedence_ rules[]

PrecedenceRule

Set of precedence rules which must be enforced in the model.

IMPORTANT : Use of precedence rules limits the size of problem that can be optimized. Requests using precedence rules that include many shipments may be rejected.

max_ active_ vehicles

int32

Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive.

DurationDistanceMatrix

Specifies a duration and distance matrix from visit and vehicle start locations to visit and vehicle end locations.

فیلدها
rows[]

Row

Specifies the rows of the duration and distance matrix. It must have as many elements as ShipmentModel.duration_distance_matrix_src_tags .

vehicle_ start_ tag

string

Tag defining to which vehicles this duration and distance matrix applies. If empty, this applies to all vehicles, and there can only be a single matrix.

Each vehicle start must match exactly one matrix, ie exactly one of their start_tags field must match the vehicle_start_tag of a matrix (and of that matrix only).

All matrices must have a different vehicle_start_tag .

ردیف

Specifies a row of the duration and distance matrix.

فیلدها
durations[]

Duration

Duration values for a given row. It must have as many elements as ShipmentModel.duration_distance_matrix_dst_tags .

meters[]

double

Distance values for a given row. If no costs or constraints refer to distances in the model, this can be left empty; otherwise it must have as many elements as durations .

PrecedenceRule

A precedence rule between two events (each event is the pickup or the delivery of a shipment): the "second" event has to start at least offset_duration after "first" has started.

Several precedences can refer to the same (or related) events, eg, "pickup of B happens after delivery of A" and "pickup of C happens after pickup of B".

Furthermore, precedences only apply when both shipments are performed and are otherwise ignored.

فیلدها
first_ is_ delivery

bool

Indicates if the "first" event is a delivery.

second_ is_ delivery

bool

Indicates if the "second" event is a delivery.

offset_ duration

Duration

The offset between the "first" and "second" event. It can be negative.

first_ index

int32

Shipment index of the "first" event. این فیلد باید مشخص شود.

second_ index

int32

Shipment index of the "second" event. این فیلد باید مشخص شود.

ShipmentRoute

A vehicle's route can be decomposed, along the time axis, like this (we assume there are n visits):

  |            |            |          |       |  T[2], |        |      |
  | Transition |  Visit #0  |          |       |  V[2], |        |      |
  |     #0     |    aka     |   T[1]   |  V[1] |  ...   | V[n-1] | T[n] |
  |  aka T[0]  |    V[0]    |          |       | V[n-2],|        |      |
  |            |            |          |       | T[n-1] |        |      |
  ^            ^            ^          ^       ^        ^        ^      ^
vehicle    V[0].start   V[0].end     V[1].   V[1].    V[n].    V[n]. vehicle
 start     (arrival)   (departure)   start   end      start    end     end

Note that we make a difference between:

  • "punctual events", such as the vehicle start and end and each visit's start and end (aka arrival and departure). They happen at a given second.
  • "time intervals", such as the visits themselves, and the transition between visits. Though time intervals can sometimes have zero duration, ie start and end at the same second, they often have a positive duration.

متغیرها:

  • If there are n visits, there are n+1 transitions.
  • A visit is always surrounded by a transition before it (same index) and a transition after it (index + 1).
  • The vehicle start is always followed by transition #0.
  • The vehicle end is always preceded by transition #n.

Zooming in, here is what happens during a Transition and a Visit :

---+-------------------------------------+-----------------------------+-->
   |           TRANSITION[i]             |           VISIT[i]          |
   |                                     |                             |
   |  * TRAVEL: the vehicle moves from   |      PERFORM the visit:     |
   |    VISIT[i-1].departure_location to |                             |
   |    VISIT[i].arrival_location, which |  * Spend some time:         |
   |    takes a given travel duration    |    the "visit duration".    |
   |    and distance                     |                             |
   |                                     |  * Load or unload           |
   |  * BREAKS: the driver may have      |    some quantities from the |
   |    breaks (e.g. lunch break).       |    vehicle: the "demand".   |
   |                                     |                             |
   |  * WAIT: the driver/vehicle does    |                             |
   |    nothing. This can happen for     |                             |
   |    many reasons, for example when   |                             |
   |    the vehicle reaches the next     |                             |
   |    event's destination before the   |                             |
   |    start of its time window         |                             |
   |                                     |                             |
   |  * DELAY: *right before* the next   |                             |
   |    arrival. E.g. the vehicle and/or |                             |
   |    driver spends time unloading.    |                             |
   |                                     |                             |
---+-------------------------------------+-----------------------------+-->
   ^                                     ^                             ^
V[i-1].end                           V[i].start                    V[i].end

Lastly, here is how the TRAVEL, BREAKS, DELAY and WAIT can be arranged during a transition.

  • همپوشانی ندارند
  • The DELAY is unique and must be a contiguous period of time right before the next visit (or vehicle end). Thus, it suffice to know the delay duration to know its start and end time.
  • The BREAKS are contiguous, non-overlapping periods of time. The response specifies the start time and duration of each break.
  • TRAVEL and WAIT are "preemptable": they can be interrupted several times during this transition. Clients can assume that travel happens "as soon as possible" and that "wait" fills the remaining time.

A (complex) example:

                               TRANSITION[i]
--++-----+-----------------------------------------------------------++-->
  ||     |       |           |       |           |         |         ||
  ||  T  |   B   |     T     |       |     B     |         |    D    ||
  ||  r  |   r   |     r     |   W   |     r     |    W    |    e    ||
  ||  a  |   e   |     a     |   a   |     e     |    a    |    l    ||
  ||  v  |   a   |     v     |   i   |     a     |    i    |    a    ||
  ||  e  |   k   |     e     |   t   |     k     |    t    |    y    ||
  ||  l  |       |     l     |       |           |         |         ||
  ||     |       |           |       |           |         |         ||
--++-----------------------------------------------------------------++-->
فیلدها
vehicle_ index

int32

Vehicle performing the route, identified by its index in the source ShipmentModel .

vehicle_ label

string

Label of the vehicle performing this route, equal to ShipmentModel.vehicles(vehicle_index).label , if specified.

vehicle_ start_ time

Timestamp

Time at which the vehicle starts its route.

vehicle_ end_ time

Timestamp

Time at which the vehicle finishes its route.

visits[]

Visit

Ordered sequence of visits representing a route. visits[i] is the i-th visit in the route. If this field is empty, the vehicle is considered as unused.

transitions[]

Transition

Ordered list of transitions for the route.

has_ traffic_ infeasibilities

bool

When OptimizeToursRequest.consider_road_traffic , is set to true, this field indicates that inconsistencies in route timings are predicted using traffic-based travel duration estimates. There may be insufficient time to complete traffic-adjusted travel, delays, and breaks between visits, before the first visit, or after the last visit, while still satisfying the visit and vehicle time windows. به عنوان مثال،

  start_time(previous_visit) + duration(previous_visit) +
  travel_duration(previous_visit, next_visit) > start_time(next_visit)

Arrival at next_visit will likely happen later than its current time window due the increased estimate of travel time travel_duration(previous_visit, next_visit) due to traffic. Also, a break may be forced to overlap with a visit due to an increase in travel time estimates and visit or break time window restrictions.

route_ polyline

EncodedPolyline

The encoded polyline representation of the route. This field is only populated if OptimizeToursRequest.populate_polylines is set to true.

breaks[]

Break

Breaks scheduled for the vehicle performing this route. The breaks sequence represents time intervals, each starting at the corresponding start_time and lasting duration seconds.

metrics

AggregatedMetrics

Duration, distance and load metrics for this route. The fields of AggregatedMetrics are summed over all ShipmentRoute.transitions or ShipmentRoute.visits , depending on the context.

route_ costs

map<string, double>

Cost of the route, broken down by cost-related request fields. The keys are proto paths, relative to the input OptimizeToursRequest, eg "model.shipments.pickups.cost", and the values are the total cost generated by the corresponding cost field, aggregated over the whole route. In other words, costs["model.shipments.pickups.cost"] is the sum of all pickup costs over the route. All costs defined in the model are reported in detail here with the exception of costs related to TransitionAttributes that are only reported in an aggregated way as of 2022/01.

route_ total_ cost

double

Total cost of the route. The sum of all costs in the cost map.

شکستن

Data representing the execution of a break.

فیلدها
start_ time

Timestamp

Start time of a break.

duration

Duration

Duration of a break.

EncodedPolyline

The encoded representation of a polyline. More information on polyline encoding can be found here: https://developers.google.com/maps/documentation/utilities/polylinealgorithm https://developers.google.com/maps/documentation/javascript/reference/geometry#encoding .

فیلدها
points

string

String representing encoded points of the polyline.

انتقال

Transition between two events on the route. See the description of ShipmentRoute .

If the vehicle does not have a start_location and/or end_location , the corresponding travel metrics are 0.

فیلدها
travel_ duration

Duration

Travel duration during this transition.

travel_ distance_ meters

double

Distance traveled during the transition.

traffic_ info_ unavailable

bool

When traffic is requested via OptimizeToursRequest.consider_road_traffic , and the traffic info couldn't be retrieved for a Transition , this boolean is set to true. This may be temporary (rare hiccup in the realtime traffic servers) or permanent (no data for this location).

delay_ duration

Duration

Sum of the delay durations applied to this transition. If any, the delay starts exactly delay_duration seconds before the next event (visit or vehicle end). See TransitionAttributes.delay .

break_ duration

Duration

Sum of the duration of the breaks occurring during this transition, if any. Details about each break's start time and duration are stored in ShipmentRoute.breaks .

wait_ duration

Duration

Time spent waiting during this transition. Wait duration corresponds to idle time and does not include break time. Also note that this wait time may be split into several non-contiguous intervals.

total_ duration

Duration

Total duration of the transition, provided for convenience. برابر است با:

  • next visit start_time (or vehicle_end_time if this is the last transition) - this transition's start_time ;
  • if ShipmentRoute.has_traffic_infeasibilities is false, the following additionally holds: `total_duration = travel_duration + delay_duration
  • break_duration + wait_duration`.
start_ time

Timestamp

Start time of this transition.

route_ polyline

EncodedPolyline

The encoded polyline representation of the route followed during the transition. This field is only populated if populate_transition_polylines is set to true.

route_ token

string

Output only. An opaque token that can be passed to Navigation SDK to reconstruct the route during navigation, and, in the event of rerouting, honor the original intention when the route was created. Treat this token as an opaque blob. Don't compare its value across requests as its value may change even if the service returns the exact same route. This field is only populated if populate_transition_polylines is set to true.

vehicle_ loads

map<string, VehicleLoad >

Vehicle loads during this transition, for each type that either appears in this vehicle's Vehicle.load_limits , or that have non-zero Shipment.load_demands on some shipment performed on this route.

The loads during the first transition are the starting loads of the vehicle route. Then, after each visit, the visit's load_demands are either added or subtracted to get the next transition's loads, depending on whether the visit was a pickup or a delivery.

VehicleLoad

Reports the actual load of the vehicle at some point along the route, for a given type (see Transition.vehicle_loads ).

فیلدها
amount

int64

The amount of load on the vehicle, for the given type. The unit of load is usually indicated by the type. See Transition.vehicle_loads .

بازدید کنید

A visit performed during a route. This visit corresponds to a pickup or a delivery of a Shipment .

فیلدها
shipment_ index

int32

Index of the shipments field in the source ShipmentModel .

is_ pickup

bool

If true the visit corresponds to a pickup of a Shipment . Otherwise, it corresponds to a delivery.

visit_ request_ index

int32

Index of VisitRequest in either the pickup or delivery field of the Shipment (see is_pickup ).

start_ time

Timestamp

Time at which the visit starts. Note that the vehicle may arrive earlier than this at the visit location. Times are consistent with the ShipmentModel .

load_ demands

map<string, Load >

Total visit load demand as the sum of the shipment and the visit request load_demands . The values are negative if the visit is a delivery. Demands are reported for the same types as the Transition.loads (see this field).

detour

Duration

Extra detour time due to the shipments visited on the route before the visit and to the potential waiting time induced by time windows. If the visit is a delivery, the detour is computed from the corresponding pickup visit and is equal to:

start_time(delivery) - start_time(pickup)
- (duration(pickup) + travel duration from the pickup location
to the delivery location).

Otherwise, it is computed from the vehicle start_location and is equal to:

start_time - vehicle_start_time - travel duration from
the vehicle's `start_location` to the visit.
shipment_ label

string

Copy of the corresponding Shipment.label , if specified in the Shipment .

visit_ label

string

Copy of the corresponding VisitRequest.label , if specified in the VisitRequest .

ShipmentTypeIncompatibility

Specifies incompatibilties between shipments depending on their shipment_type. The appearance of incompatible shipments on the same route is restricted based on the incompatibility mode.

فیلدها
types[]

string

List of incompatible types. Two shipments having different shipment_types among those listed are "incompatible".

incompatibility_ mode

IncompatibilityMode

Mode applied to the incompatibility.

IncompatibilityMode

Modes defining how the appearance of incompatible shipments are restricted on the same route.

Enums
INCOMPATIBILITY_MODE_UNSPECIFIED Unspecified incompatibility mode. This value should never be used.
NOT_PERFORMED_BY_SAME_VEHICLE In this mode, two shipments with incompatible types can never share the same vehicle.
NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY

For two shipments with incompatible types with the NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY incompatibility mode:

  • If both are pickups only (no deliveries) or deliveries only (no pickups), they cannot share the same vehicle at all.
  • If one of the shipments has a delivery and the other a pickup, the two shipments can share the same vehicle iff the former shipment is delivered before the latter is picked up.

ShipmentTypeRequirement

Specifies requirements between shipments based on their shipment_type. The specifics of the requirement are defined by the requirement mode.

فیلدها
required_ shipment_ type_ alternatives[]

string

List of alternative shipment types required by the dependent_shipment_types .

dependent_ shipment_ types[]

string

All shipments with a type in the dependent_shipment_types field require at least one shipment of type required_shipment_type_alternatives to be visited on the same route.

NOTE: Chains of requirements such that a shipment_type depends on itself are not allowed.

requirement_ mode

RequirementMode

Mode applied to the requirement.

RequirementMode

Modes defining the appearance of dependent shipments on a route.

Enums
REQUIREMENT_MODE_UNSPECIFIED Unspecified requirement mode. This value should never be used.
PERFORMED_BY_SAME_VEHICLE In this mode, all "dependent" shipments must share the same vehicle as at least one of their "required" shipments.
IN_SAME_VEHICLE_AT_PICKUP_TIME

With the IN_SAME_VEHICLE_AT_PICKUP_TIME mode, all "dependent" shipments need to have at least one "required" shipment on their vehicle at the time of their pickup.

A "dependent" shipment pickup must therefore have either:

  • A delivery-only "required" shipment delivered on the route after, or
  • A "required" shipment picked up on the route before it, and if the "required" shipment has a delivery, this delivery must be performed after the "dependent" shipment's pickup.
IN_SAME_VEHICLE_AT_DELIVERY_TIME Same as before, except the "dependent" shipments need to have a "required" shipment on their vehicle at the time of their delivery .

SkippedShipment

Specifies details of unperformed shipments in a solution. For trivial cases and/or if we are able to identify the cause for skipping, we report the reason here.

فیلدها
index

int32

The index corresponds to the index of the shipment in the source ShipmentModel .

label

string

Copy of the corresponding Shipment.label , if specified in the Shipment .

reasons[]

Reason

A list of reasons that explain why the shipment was skipped. See comment above Reason . If we are unable to understand why a shipment was skipped, reasons will not be set.

دلیل

If we can explain why the shipment was skipped, reasons will be listed here. If the reason is not the same for all vehicles, reason will have more than 1 element. A skipped shipment cannot have duplicate reasons, ie where all fields are the same except for example_vehicle_index . مثال:

reasons {
  code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
  example_vehicle_index: 1
  example_exceeded_capacity_type: "Apples"
}
reasons {
  code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
  example_vehicle_index: 3
  example_exceeded_capacity_type: "Pears"
}
reasons {
  code: CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT
  example_vehicle_index: 1
}

The skipped shipment is incompatible with all vehicles. The reasons may be different for all vehicles but at least one vehicle's "Apples" capacity would be exceeded (including vehicle 1), at least one vehicle's "Pears" capacity would be exceeded (including vehicle 3) and at least one vehicle's distance limit would be exceeded (including vehicle 1).

فیلدها
code

Code

Refer to the comments of Code.

example_ exceeded_ capacity_ type

string

If the reason code is DEMAND_EXCEEDS_VEHICLE_CAPACITY , documents one capacity type that is exceeded.

example_ vehicle_ index

int32

If the reason is related to a shipment-vehicle incompatibility, this field provides the index of one relevant vehicle.

کد

Code identifying the reason type. The order here is meaningless. In particular, it gives no indication of whether a given reason will appear before another in the solution, if both apply.

Enums
CODE_UNSPECIFIED This should never be used.
NO_VEHICLE There is no vehicle in the model making all shipments infeasible.
DEMAND_EXCEEDS_VEHICLE_CAPACITY The demand of the shipment exceeds a vehicle's capacity for some capacity types, one of which is example_exceeded_capacity_type .
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT

The minimum distance necessary to perform this shipment, ie from the vehicle's start_location to the shipment's pickup and/or delivery locations and to the vehicle's end location exceeds the vehicle's route_distance_limit .

Note that for this computation we use the geodesic distances.

CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT

The minimum time necessary to perform this shipment, including travel time, wait time and service time exceeds the vehicle's route_duration_limit .

Note: travel time is computed in the best-case scenario, namely as geodesic distance x 36 m/s (roughly 130 km/hour).

CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT Same as above but we only compare minimum travel time and the vehicle's travel_duration_limit .
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS The vehicle cannot perform this shipment in the best-case scenario (see CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT for time computation) if it starts at its earliest start time: the total time would make the vehicle end after its latest end time.
VEHICLE_NOT_ALLOWED The allowed_vehicle_indices field of the shipment is not empty and this vehicle does not belong to it.

TimeWindow

Time windows constrain the time of an event, such as the arrival time at a visit, or the start and end time of a vehicle.

Hard time window bounds, start_time and end_time , enforce the earliest and latest time of the event, such that start_time <= event_time <= end_time . The soft time window lower bound, soft_start_time , expresses a preference for the event to happen at or after soft_start_time by incurring a cost proportional to how long before soft_start_time the event occurs. The soft time window upper bound, soft_end_time , expresses a preference for the event to happen at or before soft_end_time by incurring a cost proportional to how long after soft_end_time the event occurs. start_time , end_time , soft_start_time and soft_end_time should be within the global time limits (see ShipmentModel.global_start_time and ShipmentModel.global_end_time ) and should respect:

  0 <= `start_time` <= `end_time` and
  0 <= `start_time` <= `soft_start_time` and
  0 <= `soft_end_time` <= `end_time`.
فیلدها
start_ time

Timestamp

The hard time window start time. If unspecified it will be set to ShipmentModel.global_start_time .

end_ time

Timestamp

The hard time window end time. If unspecified it will be set to ShipmentModel.global_end_time .

soft_ start_ time

Timestamp

The soft start time of the time window.

soft_ end_ time

Timestamp

The soft end time of the time window.

cost_ per_ hour_ before_ soft_ start_ time

double

A cost per hour added to other costs in the model if the event occurs before soft_start_time, computed as:

   max(0, soft_start_time - t.seconds)
                          * cost_per_hour_before_soft_start_time / 3600,
t being the time of the event.

This cost must be positive, and the field can only be set if soft_start_time has been set.

cost_ per_ hour_ after_ soft_ end_ time

double

A cost per hour added to other costs in the model if the event occurs after soft_end_time , computed as:

   max(0, t.seconds - soft_end_time.seconds)
                    * cost_per_hour_after_soft_end_time / 3600,
t being the time of the event.

This cost must be positive, and the field can only be set if soft_end_time has been set.

TransitionAttributes

Specifies attributes of transitions between two consecutive visits on a route. Several TransitionAttributes may apply to the same transition: in that case, all extra costs add up and the strictest constraint or limit applies (following natural "AND" semantics).

فیلدها
src_ tag

string

Tags defining the set of (src->dst) transitions these attributes apply to.

A source visit or vehicle start matches iff its VisitRequest.tags or Vehicle.start_tags either contains src_tag or does not contain excluded_src_tag (depending on which of these two fields is non-empty).

excluded_ src_ tag

string

See src_tag . Exactly one of src_tag and excluded_src_tag must be non-empty.

dst_ tag

string

A destination visit or vehicle end matches iff its VisitRequest.tags or Vehicle.end_tags either contains dst_tag or does not contain excluded_dst_tag (depending on which of these two fields is non-empty).

excluded_ dst_ tag

string

See dst_tag . Exactly one of dst_tag and excluded_dst_tag must be non-empty.

cost

double

Specifies a cost for performing this transition. This is in the same unit as all other costs in the model and must not be negative. It is applied on top of all other existing costs.

cost_ per_ kilometer

double

Specifies a cost per kilometer applied to the distance traveled while performing this transition. It adds up to any Vehicle.cost_per_kilometer specified on vehicles.

distance_ limit

DistanceLimit

Specifies a limit on the distance traveled while performing this transition.

As of 2021/06, only soft limits are supported.

delay

Duration

Specifies a delay incurred when performing this transition.

This delay always occurs after finishing the source visit and before starting the destination visit.

وسیله نقلیه

Models a vehicle in a shipment problem. Solving a shipment problem will build a route starting from start_location and ending at end_location for this vehicle. A route is a sequence of visits (see ShipmentRoute ).

فیلدها
display_ name

string

The user-defined display name of the vehicle. It can be up to 63 characters long and may use UTF-8 characters.

travel_ mode

TravelMode

The travel mode which affects the roads usable by the vehicle and its speed. See also travel_duration_multiple .

route_ modifiers

RouteModifiers

A set of conditions to satisfy that affect the way routes are calculated for the given vehicle.

start_ location

LatLng

Geographic location where the vehicle starts before picking up any shipments. If not specified, the vehicle starts at its first pickup. If the shipment model has duration and distance matrices, start_location must not be specified.

start_ waypoint

Waypoint

Waypoint representing a geographic location where the vehicle starts before picking up any shipments. If neither start_waypoint nor start_location is specified, the vehicle starts at its first pickup. If the shipment model has duration and distance matrices, start_waypoint must not be specified.

end_ location

LatLng

Geographic location where the vehicle ends after it has completed its last VisitRequest . If not specified the vehicle's ShipmentRoute ends immediately when it completes its last VisitRequest . If the shipment model has duration and distance matrices, end_location must not be specified.

end_ waypoint

Waypoint

Waypoint representing a geographic location where the vehicle ends after it has completed its last VisitRequest . If neither end_waypoint nor end_location is specified, the vehicle's ShipmentRoute ends immediately when it completes its last VisitRequest . If the shipment model has duration and distance matrices, end_waypoint must not be specified.

start_ tags[]

string

Specifies tags attached to the start of the vehicle's route.

Empty or duplicate strings are not allowed.

end_ tags[]

string

Specifies tags attached to the end of the vehicle's route.

Empty or duplicate strings are not allowed.

start_ time_ windows[]

TimeWindow

Time windows during which the vehicle may depart its start location. They must be within the global time limits (see ShipmentModel.global_* fields). If unspecified, there is no limitation besides those global time limits.

Time windows belonging to the same repeated field must be disjoint, ie no time window can overlap with or be adjacent to another, and they must be in chronological order.

cost_per_hour_after_soft_end_time and soft_end_time can only be set if there is a single time window.

end_ time_ windows[]

TimeWindow

Time windows during which the vehicle may arrive at its end location. They must be within the global time limits (see ShipmentModel.global_* fields). If unspecified, there is no limitation besides those global time limits.

Time windows belonging to the same repeated field must be disjoint, ie no time window can overlap with or be adjacent to another, and they must be in chronological order.

cost_per_hour_after_soft_end_time and soft_end_time can only be set if there is a single time window.

unloading_ policy

UnloadingPolicy

Unloading policy enforced on the vehicle.

load_ limits

map<string, LoadLimit >

Capacities of the vehicle (weight, volume, # of pallets for example). The keys in the map are the identifiers of the type of load, consistent with the keys of the Shipment.load_demands field. If a given key is absent from this map, the corresponding capacity is considered to be limitless.

cost_ per_ hour

double

Vehicle costs: all costs add up and must be in the same unit as Shipment.penalty_cost .

Cost per hour of the vehicle route. This cost is applied to the total time taken by the route, and includes travel time, waiting time, and visit time. Using cost_per_hour instead of just cost_per_traveled_hour may result in additional latency.

cost_ per_ traveled_ hour

double

Cost per traveled hour of the vehicle route. This cost is applied only to travel time taken by the route (ie, that reported in ShipmentRoute.transitions ), and excludes waiting time and visit time.

cost_ per_ kilometer

double

Cost per kilometer of the vehicle route. This cost is applied to the distance reported in the ShipmentRoute.transitions and does not apply to any distance implicitly traveled from the arrival_location to the departure_location of a single VisitRequest .

fixed_ cost

double

Fixed cost applied if this vehicle is used to handle a shipment.

used_ if_ route_ is_ empty

bool

This field only applies to vehicles when their route does not serve any shipments. It indicates if the vehicle should be considered as used or not in this case.

If true, the vehicle goes from its start to its end location even if it doesn't serve any shipments, and time and distance costs resulting from its start --> end travel are taken into account.

Otherwise, it doesn't travel from its start to its end location, and no break_rule or delay (from TransitionAttributes ) are scheduled for this vehicle. In this case, the vehicle's ShipmentRoute doesn't contain any information except for the vehicle index and label.

route_ duration_ limit

DurationLimit

Limit applied to the total duration of the vehicle's route. In a given OptimizeToursResponse , the route duration of a vehicle is the difference between its vehicle_end_time and vehicle_start_time .

travel_ duration_ limit

DurationLimit

Limit applied to the travel duration of the vehicle's route. In a given OptimizeToursResponse , the route travel duration is the sum of all its transitions.travel_duration .

route_ distance_ limit

DistanceLimit

Limit applied to the total distance of the vehicle's route. In a given OptimizeToursResponse , the route distance is the sum of all its transitions.travel_distance_meters .

extra_ visit_ duration_ for_ visit_ type

map<string, Duration >

Specifies a map from visit_types strings to durations. The duration is time in addition to VisitRequest.duration to be taken at visits with the specified visit_types . This extra visit duration adds cost if cost_per_hour is specified. Keys (ie visit_types ) cannot be empty strings.

If a visit request has multiple types, a duration will be added for each type in the map.

break_ rule

BreakRule

Describes the break schedule to be enforced on this vehicle. If empty, no breaks will be scheduled for this vehicle.

label

string

Specifies a label for this vehicle. This label is reported in the response as the vehicle_label of the corresponding ShipmentRoute .

ignore

bool

If true, used_if_route_is_empty must be false, and this vehicle will remain unused.

If a shipment is performed by an ignored vehicle in injected_first_solution_routes , it is skipped in the first solution but is free to be performed in the response.

If a shipment is performed by an ignored vehicle in injected_solution_constraint and any related pickup/delivery is constrained to remain on the vehicle (ie, not relaxed to level RELAX_ALL_AFTER_THRESHOLD ), it is skipped in the response. If a shipment has a non-empty allowed_vehicle_indices field and all of the allowed vehicles are ignored, it is skipped in the response.

travel_ duration_ multiple

double

Specifies a multiplicative factor that can be used to increase or decrease travel times of this vehicle. For example, setting this to 2.0 means that this vehicle is slower and has travel times that are twice what they are for standard vehicles. This multiple does not affect visit durations. It does affect cost if cost_per_hour or cost_per_traveled_hour are specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle is standard, and this multiple is considered 1.0.

WARNING: Travel times will be rounded to the nearest second after this multiple is applied but before performing any numerical operations, thus, a small multiple may result in a loss of precision.

See also extra_visit_duration_for_visit_type below.

DurationLimit

A limit defining a maximum duration of the route of a vehicle. It can be either hard or soft.

When a soft limit field is defined, both the soft max threshold and its associated cost must be defined together.

فیلدها
max_ duration

Duration

A hard limit constraining the duration to be at most max_duration.

soft_ max_ duration

Duration

A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit.

If defined, soft_max_duration must be nonnegative. If max_duration is also defined, soft_max_duration must be less than max_duration.

quadratic_ soft_ max_ duration

Duration

A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit.

If defined, quadratic_soft_max_duration must be nonnegative. If max_duration is also defined, quadratic_soft_max_duration must be less than max_duration , and the difference must be no larger than one day:

max_duration - quadratic_soft_max_duration <= 86400 seconds

cost_ per_ hour_ after_ soft_ max

double

Cost per hour incurred if the soft_max_duration threshold is violated. The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows:

  cost_per_hour_after_soft_max * (duration - soft_max_duration)

The cost must be nonnegative.

cost_ per_ square_ hour_ after_ quadratic_ soft_ max

double

Cost per square hour incurred if the quadratic_soft_max_duration threshold is violated.

The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows:

  cost_per_square_hour_after_quadratic_soft_max *
  (duration - quadratic_soft_max_duration)^2

The cost must be nonnegative.

LoadLimit

Defines a load limit applying to a vehicle, eg "this truck may only carry up to 3500 kg". See load_limits .

فیلدها
soft_ max_ load

int64

A soft limit of the load. See cost_per_unit_above_soft_max .

cost_ per_ unit_ above_ soft_ max

double

If the load ever exceeds soft_max_load along this vehicle's route, the following cost penalty applies (only once per vehicle): (load - soft_max_load ) * cost_per_unit_above_soft_max . All costs add up and must be in the same unit as Shipment.penalty_cost .

start_ load_ interval

Interval

The acceptable load interval of the vehicle at the start of the route.

end_ load_ interval

Interval

The acceptable load interval of the vehicle at the end of the route.

max_ load

int64

The maximum acceptable amount of load.

فاصله زمانی

Interval of acceptable load amounts.

فیلدها
min

int64

A minimum acceptable load. Must be ≥ 0. If they're both specified, min must be ≤ max .

max

int64

A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum load is unrestricted by this message. If they're both specified, min must be ≤ max .

TravelMode

Travel modes which can be used by vehicles.

These should be a subset of the Google Maps Platform Routes API travel modes, see: https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteTravelMode

Note: WALKING routes are in beta and might sometimes be missing clear sidewalks or pedestrian paths. You must display this warning to the user for all walking routes that you display in your app.

Enums
TRAVEL_MODE_UNSPECIFIED Unspecified travel mode, equivalent to DRIVING .
DRIVING Travel mode corresponding to driving directions (car, ...).
WALKING Travel mode corresponding to walking directions.

UnloadingPolicy

Policy on how a vehicle can be unloaded. Applies only to shipments having both a pickup and a delivery.

Other shipments are free to occur anywhere on the route independent of unloading_policy .

Enums
UNLOADING_POLICY_UNSPECIFIED Unspecified unloading policy; deliveries must just occur after their corresponding pickups.
LAST_IN_FIRST_OUT Deliveries must occur in reverse order of pickups
FIRST_IN_FIRST_OUT Deliveries must occur in the same order as pickups

نقطه راه

Encapsulates a waypoint. Waypoints mark arrival and departure locations of VisitRequests, and start and end locations of Vehicles.

فیلدها
side_ of_ road

bool

اختیاری. Indicates that the location of this waypoint is meant to have a preference for the vehicle to stop at a particular side of road. When you set this value, the route will pass through the location so that the vehicle can stop at the side of road that the location is biased towards from the center of the road. This option doesn't work for the 'WALKING' travel mode.

Union field location_type . Different ways to represent a location. location_type can be only one of the following:
location

Location

A point specified using geographic coordinates, including an optional heading.

place_ id

string

The POI place ID associated with the waypoint.

When using a place ID to specify arrival or departure location of a VisitRequest, use a place ID that is specific enough to determine a LatLng location for navigation to the place. For example, a place ID representing a building is suitable, but a place ID representing a road is discouraged.