بار تقاضاها و محدودیت ها

The loadDemands property is defined under ShipmentModel.shipments.Shipment and the loadLimits property under ShipmentModel.vehicles.Vehicle.

Load demands and limits are a type of constraint you can use to manage capacity . This constraint specifies a shipment's required capacity and a vehicle's maximum capacity , which lets you optimize route assignments based on these constraints.

Load demands and limits can support objectives like:

  • از بارگیری بیش از حد وسایل نقلیه جلوگیری شود.
  • Monitor how vehicle loads change as shipments are picked up and delivered.
  • اولویت را به جفت کردن وسایل نقلیه سنگین با محموله‌های سنگین بدهید.

تقاضاها و محدودیت‌های بار در این ویژگی‌ها مشخص شده‌اند:

  • loadDemands specifies the capacity amount a particular shipment requires.
  • loadLimits specifies the maximum capacity for a given vehicle .

ساختار

همانطور که در نمودار نشان داده شده است، تقاضاها و محدودیت‌های بار به شرح زیر ساختار یافته‌اند:

چک لیست ضروریات

چک لیست زیر دانش ضروری را شرح می‌دهد که از اشتباهات احتمالی مرتبط با بارگذاری جلوگیری می‌کند. این لیست می‌تواند به شما در اعتبارسنجی درخواست و عیب‌یابی پاسختان کمک کند.

خواص

This section describes properties for load demands and limits, which are the following:

  • نوع بار: یک ویژگی مشترک بین تقاضاها و محدودیت‌های بار.
  • Load and LoadLimit : Unique properties present in load demands and load limits respectively.

نوع بار

A load type is a string key that you apply equally to shipments and vehicles. A single load type applies to a shipment's load demand as well as a vehicle's load limit.

Load types use the Protocol Buffers map type syntax . When naming a load type, use identifiers describing the type of the load and its unit. For example: weightKg , volume_gallons , palletcount , or frequencyDaily .

Load و LoadLimit

The Load and LoadLimit objects contain specific properties to define capacity requirements for shipments and vehicles, the following table describes these properties:

شیء والدین ملک نوع ملک توضیحات ملک
Load loadDemands amount رشته (با فرمت int64) Defines the shipment's capacity requirement in the specified type.
LoadLimit loadLimits maxLoad رشته (با فرمت int64) حداکثر ظرفیت بار خودرو را در نوع مشخص شده تعریف می‌کند.

مثال‌ها

این بخش شامل سه نوع مثال است:

  • نمونه‌های کد که ساختار ویژگی‌های تقاضا و محدودیت‌های بار را نشان می‌دهند.
  • An example scenario that shows one way to use load demands and limits in an API request.
  • A request example that includes the values set in the example scenario.

نمونه‌های کد

مثال زیر ساختار یک درخواست بارگذاری را نشان می‌دهد که در آن می‌توانید نوع loadDemands را به عنوان یک رشته و ویژگی amount را به عنوان یک رشته با فرمت int64 تنظیم کنید:

{
  "model": {
    "shipments": [ ...
      {
        "loadDemands": {
          "MATCHING_LOAD_TYPE": {
            "amount": "YOUR_LOAD_AMOUNT"
          }
        }
      }
    ],
    "vehicles": [ ...
    ]
  }
}

مثال زیر ساده‌ترین ساختار یک محدودیت بار را نشان می‌دهد، که در آن می‌توانید نوع loadLimits را به عنوان یک رشته و ویژگی maxLoad را به عنوان یک رشته با فرمت int64 تنظیم کنید:

{
  "model": {
    "shipments": [ ...
    ],
    "vehicles": [ ...
      {
        "loadLimits": {
          "MATCHING_LOAD_TYPE": {
            "maxLoad": "YOUR_MAX_LOAD"
          }
        }
      }
    ]
  }
}

سناریوی مثال

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

Each shipment represents one stop where you pick up a certain number of dogs. In this example, each shipment has a different pickup location, which is the home of the dogs you take care of, and all shipments have the same delivery location, the building of your doggy daycare.

برای این مثال، مقادیر ویژگی در درخواست شما به شرح زیر است:

والدین ملک نوع ارزش سناریو
loadDemands نوع بار رشته dogUnit نوع بار برای محموله را تعریف می‌کند. در این مثال dogUnit استفاده شده است که در آن هر dogUnit نشان دهنده یک سگ است.
loadDemands amount شماره اولین محموله: 1
محموله دوم: 3
مقدار نوع بار تعریف شده را مشخص می‌کند. در این مثال، شما دو محموله تعریف می‌کنید، در محموله اول یک سگ و در محموله دوم ۳ سگ را تحویل می‌گیرید.
loadLimits نوع بار رشته dogUnit نوع محدودیت بار اعمال شده بر وسیله نقلیه را تعریف می‌کند. برای اینکه محدودیت مربوطه اعمال شود ، باید با نوع بار محموله مطابقت داشته باشد.
loadLimits maxLoad شماره 6 Specifies the maximum quantity of the load type the vehicle can carry. In this example, you have only one vehicle with a maximum capacity of 6 dogUnit , where each dogUnit represents one dog crate.

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

The vehicle begins the route with 6 empty spaces representing the load limits of the vehicle. The first shipment demands space for one dog, the second shipment demands space for three dogs. The end state of the vehicle is having 4 of the 6 spaces now occupied, with two empty spaces remaining.

در این مثال، تقاضای بار هر محموله و محدودیت‌های بار وسیله نقلیه اثرات زیر را دارند:

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

  • داشتن محدودیت بار ۶ dogUnit در وسیله نقلیه همچنین به این معنی است که شما فقط می‌توانید دو سگ دیگر را در این وسیله نقلیه خاص حمل کنید.

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

Remember there's no set of predefined types . In this example, you could change the load type from dog units to weight units to limit the weight of the dogs, or change it to linear measurements to limit their width or height. This flexibility lets you tailor load demands and limits to your specific needs.

مثال درخواست

مثال زیر ساختار یک درخواست اولیه optimizeTours را نشان می‌دهد که شامل مقادیر سناریوی مثال است:

{
  "model": {
    "shipments": [
      {
        "pickups": [
          {
            "arrivalLocation": {
              "latitude": 37.8024,
              "longitude": -122.4058
            }
          }
        ],
        "deliveries": [
          {
            "arrivalLocation": {
              "latitude": 37.759773,
              "longitude": -122.427063
            }
          }
        ],
        "label": "One bernese mountain dog",
        "loadDemands": {
          "dogUnit": {
            "amount": "1"
          }
        }
      },
      {
        "pickups": [
          {
            "arrivalLocation": {
              "latitude": 37.7359,
              "longitude": -122.5011
            }
          }
        ],
        "deliveries": [
          {
            "arrivalLocation": {
              "latitude": 37.759773,
              "longitude": -122.427063
            }
          }
        ],
        "label": "Three chihuahuas",
        "loadDemands": {
          "dogUnit": {
            "amount": "3"
          }
        }
      }
    ],
    "vehicles": [
      {
        "startLocation": {
          "latitude": 37.759773,
          "longitude": -122.427063
        },
        "endLocation": {
          "latitude": 37.759773,
          "longitude": -122.427063
        },
        "loadLimits": {
          "dogUnit": {
            "maxLoad": "6"
          }
        },
        "costPerKilometer": 1.0
      }
    ]
  }
}

Remember that, unlike the case of this example, a shipment can have multiple load demands, and a vehicle can have multiple load limits, allowing you to provide complex constraints to take into consideration when optimizing your fleet's routes.

محدودیت‌های بار نرم

You can set load limits as soft constraints by adding softMaxLoad and costPerUnitAboveSoftMax on a vehicle's loadLimits . This allows the optimizer to exceed the vehicle's maximum load at a cost, prioritizing route completion over strict adherence to the load limit.

You can use maxLoad and softMaxLoad together to set both a hard and a soft load limit. In this case, softMaxLoad sets the load that can be exceeded, and maxLoad sets a hard limit that can't be exceeded. When both are used, maxLoad must be larger than softMaxLoad .

خواص

جدول زیر ویژگی‌های قید نرم برای تقاضاها و محدودیت‌های بار را شرح می‌دهد.

والدین نام ملک نوع ملک توضیحات ملک
loadLimits softMaxLoad رشته (با فرمت int64) حداکثر بار ترجیحی برای یک وسیله نقلیه. اگر بار وسیله نقلیه از این مقدار بیشتر شود، هزینه‌ای ایجاد می‌شود.
loadLimits costPerUnitAboveSoftMax شماره هزینه هر واحد بار بالاتر از softMaxLoad . این فیلد هنگام استفاده از softMaxLoad الزامی است. برای کسب اطلاعات بیشتر در مورد هزینه‌ها، به مفهوم کلیدی مدل هزینه مراجعه کنید.

نمونه کد

مثال زیر ساختار ویژگی‌های قید نرم loadLimits را نشان می‌دهد:

{
   "loadLimits": {
        "LOAD_TYPE": {
          "softMaxLoad": "LOAD_AMOUNT",
          "costPerUnitAboveSoftMax": COST_PER_UNIT
        }
      }
}