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
request
{
  "resources": [
    {
      "name": "R-1"
    },
    {
      "name": "R-2"
    }
  ],
  "jobs": [
    {
      "name": "JOB-1",
      "duration": 3600
    },
    {
      "name": "JOB-2",
      "duration": 3600
    },
    {
      "name": "JOB-3",
      "duration": 3600
    },
    {
      "name": "JOB-4",
      "duration": 3600
    },
    {
      "name": "JOB-5",
      "duration": 3600
    },
    {
      "name": "JOB-6",
      "duration": 3600
    },
    {
      "name": "JOB-7",
      "duration": 3600
    },
    {
      "name": "JOB-8",
      "duration": 3600
    },
    {
      "name": "JOB-9",
      "duration": 3600
    },
    {
      "name": "JOB-10",
      "duration": 3600
    }
  ],
  "relations": [
    {
      "type": "same_trip",
      "jobs": [
        "JOB-1",
        "JOB-2",
        "JOB-3"
      ]
    },
    {
      "type": "sequence",
      "jobs": [
        "JOB-3",
        "JOB-4"
      ]
    },
    {
      "type": "direct_sequence",
      "jobs": [
        "JOB-5",
        "JOB-6"
      ]
    },
    {
      "type": "same_trip",
      "jobs": [
        "JOB-7",
        "JOB-8"
      ],
      "resource": "R-1"
    },
    {
      "type": "same_time",
      "jobs": [
        "JOB-9",
        "JOB-10"
      ]
    }
  ]
}