Job relations

In this example we will show you how to use job relations. Job relations are defined on jobs. They can be used to
express different links between jobs:

  • SEQUENCE: the jobs need to be visited in the given order
  • DIRECT_SEQUENCE: the jobs need to be visited in the given order, one after the other
  • SAME_TRIP: the jobs need to be visited in the same trip, the sequence does not matter
  • SAME_TIME: the jobs need to be visited at the same time, the assigned resource will obviously be different
  • PICKUP_AND_DELIVERY: the jobs need to be in the same trip and the pickup needs to happen before the dropoff. (special case of job relation)
  • SAME_RESOURE: the jobs need to be visited by the same resource (could be another day)
{
  "resources": [
    {
      "name": "R-1"
    },
    {
      "name": "R-2"
    }
  ],
  "jobs": [
    {
      "name": "JOB-1",
      "duration": 3600
    },
    {
      "name": "JOB-2",
      "duration": 3600
    },
    {
      "name": "JOB-3",
      "duration": 3600
    }
  ],
  "relations": [
    {
      "type": "SEQUENCE",
      "jobs": [
        "JOB-1",
        "JOB-2",
        "JOB-3"
      ]
    }
  ]
}
{
  "resources": [
    {
      "name": "R-1"
    }
  ],
  "jobs": [
    {
      "name": "JOB-1",
      "duration": 3600
    },
    {
      "name": "JOB-2",
      "duration": 3600
    },
    {
      "name": "JOB-3",
      "duration": 3600
    }
  ],
  "relations": [
    {
      "type": "DIRECT_SEQUENCE",
      "jobs": [
        "JOB-5",
        "JOB-6"
      ]
    }
  ]
}
{
  "resources": [
    {
      "name": "R-1"
    }
  ],
  "jobs": [
    {
      "name": "JOB-1",
      "duration": 3600
    },
    {
      "name": "JOB-2",
      "duration": 3600
    },
    {
      "name": "JOB-3",
      "duration": 3600
    }
  ],
  "relations": [
    {
      "type": "SAME_TIME",
      "jobs": [
        "JOB-5",
        "JOB-6"
      ]
    }
  ]
}
{
  "resources": [
    {
      "name": "R-1"
    }
  ],
  "jobs": [
    {
      "name": "JOB-1",
      "duration": 3600
    },
    {
      "name": "JOB-2",
      "duration": 3600
    },
    {
      "name": "JOB-3",
      "duration": 3600
    }
  ],
  "relations": [
    {
      "type": "PICKUP_AND_DELIVERY",
      "jobs": [
        "JOB-9",
        "JOB-10"
      ]
    }
  ]
}