API – capacity constraints

This page describes advanced features of OptiFacility related to capacities (pickup and delivery of some products). Before reading this section, ensure you have read about basic features of OptiFacility.

The following json file defines an instance of the problem with capacity constraints. Additions to the basic json file are highlighted:

    "UserID": "demo",
    "RequestID": 12348,
    "Comment": "my first request with capacity constraints",
    "Quality": 2,
    "AgentSpeed": 45.0,
    "AgentWorkTime": 8.0,
    "AgentVisitTime": 1.0,
    "CostAgentWork1h": 70.0,
    "CostAgentTravel1km": 1.0,
    "Products": 3,
    "Facilities": [{"Lat":51.929, "Lon":18.614},
                   {"Lat":52.057, "Lon":19.176, "ChangeInProducts":[0,-7,0]},
                   {"Lat":51.989, "Lon":18.588, "ChangeInProducts":[10,0,0]},
                   {"Lat":51.864, "Lon":18.764, "ChangeInProducts":[-10,0,-15]},
                   {"Lat":51.89,  "Lon":19.098, "ChangeInProducts":[-10,0,0]},
                   {"Lat":52.014, "Lon":18.889, "ChangeInProducts":[0,0,30]}],
    "Agents":[{"Lat":51.768, "Lon":19.094, "CapacityForProducts":40}],
    "Task": "FindRoutesCommutingIncluded"

The highlighted fields are specific to capacity constraints:

  • Products – a declaration of the number of different types of products that should be picked up/delivered.
  • Facilities: ChangeInProducts – an array of integers that reflect the change in agent's product capacity which takes place when a facility is visited. Values in the array can be interpreted as the change in volume used up by products (of course, you can assume for simplicity that one product uses one unit of space). For example, the [-10, 25] array will be interpreted as "visiting this facility takes 10 units of space of product #1, and gives back 25 units of space of product #2".

    The size of the array should match the one defined in "Products". If "ChangeInProducts" is not defined for a facility, it is assumed that the array consists of all zeros.

  • Agents: CapacityForProducts – an integer defining the total capacity of the car/truck of an agent.

A particular physical unit of space or volume is not imposed, but obviously units used in facility "ChangeInProducts" fields should match units used in agent "CapacityForProducts" fields.