Features

Stop Mixing

A how-to guide for using stop mixing constraint with vehicle routing.

This feature is configurable via .json input, without the need for code customization and is available for both the Marketplace app and Platform. You can find a list of all available features here.

This how-to guide assumes you already completed the get started with vehicle routing tutorial.

Field nameRequiredData typeSI UnitDefined onExampleConfigurable via defaults
mixing_itemsNomap of string to mix_itemNAstop{"mixing_items": {"hazchem": {"name": "F-A-W-E","quantity": 1}}
  • mix_item

    Field nameRequiredData typeDescriptionExample
    nameYesstringName of the "ingredient" to avoid mixing.{"id": "vegan"}
    quantityYesintQuantity the stop adds / removes of the "ingredient"{"quantity": 1}

In vehicle routing problems, sometimes stops can not be on a vehicle at the same time if they have a conflict. We refer to this as a mixing, or rather no-mixing, constraint. For example, some countries may require that vegan food is never in a vehicle at the same time as meat products. The vehicle can service both vegan and meat products in the route, but they can never be in the vehicle at the same time.

The no mix feature allows you to define mixing items and quantities on stops, and the engine will avoid routes which mix items of different types at the same time on the vehicle.

Here is an example that defines mixing items on stops. A sample output obtained after solving the problem is also shown.

{
  "stops": [
    {
      "id": "Fushimi Inari Taisha",
      "location": { "lon": 135.772695, "lat": 34.967146 },
      "precedes": "Kiyomizu-dera",
      "mixing_items": {
        "hazchem": {
          "name": "F-A-W-E",
          "quantity": 1
        }
      }
    },
    {
      "id": "Kiyomizu-dera",
      "location": { "lon": 135.78506, "lat": 34.994857 },
      "mixing_items": {
        "hazchem": {
          "name": "F-A-W-E",
          "quantity": -1
        }
      }
    },
    {
      "id": "Nijō Castle",
      "location": { "lon": 135.748134, "lat": 35.014239 },
      "precedes": "Kyoto Imperial Palace",
      "mixing_items": {
        "hazchem": {
          "name": "S-P-W-E",
          "quantity": 1
        }
      }
    },
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.762057, "lat": 35.025431 },
      "mixing_items": {
        "hazchem": {
          "name": "S-P-W-E",
          "quantity": -1
        }
      }
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.775682, "lat": 35.002457 },
      "precedes": "Kinkaku-ji",
      "mixing_items": {
        "hazchem": {
          "name": "S-P-W-E",
          "quantity": 1
        }
      }
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.728898, "lat": 35.039705 },
      "mixing_items": {
        "hazchem": {
          "name": "S-P-W-E",
          "quantity": -1
        }
      }
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.672009, "lat": 35.017209 }
    }
  ],
  "vehicles": [
    {
      "id": "v1",
      "speed": 20
    }
  ]
}
Copy

Page last updated