Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to set minimum-maximum load constraint in Google Route Optimization API.

I'm using Google RO API to create clusters. There is a capacity constraint on the clusters and the clusters should not overlap with each other. To do this, I've set the load demand of each shipment to 1 and assigned a fixed maximum load limit to each vehicle. Here the number of vehicles is same as the number of clusters. However, I want to set a minimum load limit for each vehicle (cluster) as well.
 
For example, I have 129 shipments and 3 vehicles/ clusters. I've set the maximum load limit of each vehicle to 43 and as a result I get 3 routes with 43 shipments each. But the routes (or clusters) created are overlapping. Through experimentation, I've found that if I set the maximum load limit to 45 and minimum load limit to 40, I get 3 non-overlapping clusters. (I used NextBillion Clustering API for this experiment)

 

Is there a way to set the minimum and maximum load limit in Google RO API? If not, is there any other way to create non-overlapping clusters within a capacity range?

 

For reference, this is what my overlapping clusters looks like (result from Google RO API, number of points per cluster is 43),

Google Result.png

This is what I want to achieve (number of points per cluster is different),

desired result.png

 Here is what my current request model looks like for Google RO API,

 

 

  {
    "shipments": [
      {
        "pickups": [
          {
            "arrival_location": {
              "latitude": 22.6373426,
              "longitude": 88.221415
            },
            "label": "A03948",
            "tags": ["grp_tag"]
          }
        ],
        "load_demands": { "pallet_count": { "amount": 1 } }
      },
      # Total 129 shipments
    ],
    "vehicles": [
      {
        "label": "Vehicle-0",
        "cost_per_kilometer": 50.0,
        "cost_per_hour": 50.0,
        "load_limits": { "pallet_count": { "max_load": 43 } }
      },
      {
        "label": "Vehicle-1",
        "cost_per_kilometer": 50.0,
        "cost_per_hour": 50.0,
        "load_limits": { "pallet_count": { "max_load": 43 } }
      },
      {
        "label": "Vehicle-2",
        "cost_per_kilometer": 50.0,
        "cost_per_hour": 50.0,
        "load_limits": { "pallet_count": { "max_load": 43 } }
      }
    ],
    "global_duration_cost_per_hour": 50,
    "global_start_time": "datetime.datetime(2025, 1, 7, 7, 0)",
    "global_end_time": "datetime.datetime(2025, 1, 7, 23, 0)",
    "transition_attributes": [
      {
        "excluded_dst_tag": "grp_tag99",
        "excluded_src_tag": "grp_tag99",
        "distance_limit": {
          "soft_max_meters": 200,
          "cost_per_kilometer_below_soft_max": 100,
          "cost_per_kilometer_above_soft_max": 0
        }
      }
    ]
  }
​

 

0 0 37
0 REPLIES 0