Evaluate

Evaluation is a very important part of the optimization process. It is important to know how to evaluate the quality of
a solution. In this example we will show you how to evaluate a solution.
All evaluation requests require for every Job a initial arrival time and a initial resource. If you don't provide this
information, the evaluation will fail.

Example:

{
  "name": "JOB-1",
  "location": {
    "latitude": 50.54963315022148,
    "longitude": 4.848855475505483
  },
  "initialArrival": "2023-01-13T08:00:00",
  "initialResource": "R-1",
  "duration": 600
}

Our solver will recalculate the necessary travel time. The deviation between the proposed initial arrival and the
recalculated arrival time can be tracked through the "PLANNED_ARRIVAL" constraint by adding a plannedArrival equal to the initialArrival.

In this case we send 5 jobs to be assigned in sequence. When we look at the explanation, we see that total travel time
is 9823 seconds or about 2,5 hours.
There is some deviation from planned arrival time, but this is not a problem. The solver will always try to minimize
travel time. The deviation from planned arrival has no impact on the solve process, just to show the result.

{
  "resources": [
    {
      "name": "R-1",
      "start": {
        "latitude": 50.923554431590595,
        "longitude": 4.890691212789399
      },
      "shifts": [
        {
          "from": "2023-01-13T08:00:00",
          "to": "2023-01-13T18:30:00"
        }
      ]
    }
  ],
  "jobs": [
    {
      "name": "JOB-1",
      "location": {
        "latitude": 50.54963315022148,
        "longitude": 4.848855475505483
      },
      "plannedArrival": "2023-01-13T08:00:00",
      "initialArrival": "2023-01-13T08:00:00",
      "initialResource": "R-1",
      "duration": 600
    },
    {
      "name": "JOB-2",
      "location": {
        "latitude": 50.65910297910443600,
        "longitude": 4.007987934186738
      },
      "plannedArrival": "2023-01-13T08:13:00",
      "initialArrival": "2023-01-13T08:13:00",
      "initialResource": "R-1",
      "duration": 600
    },
    {
      "name": "JOB-3",
      "location": {
        "latitude": 50.65310297910443600,
        "longitude": 4.007987934186738
      },
      "plannedArrival": "2023-01-13T08:14:00",
      "initialArrival": "2023-01-13T08:14:00",
      "initialResource": "R-1",
      "duration": 600
    },
    {
      "name": "JOB-4",
      "location": {
        "latitude": 50.69910297910443600,
        "longitude": 4.017987934186738
      },
      "plannedArrival": "2023-01-13T08:30:00",
      "initialArrival": "2023-01-13T08:30:00",
      "initialResource": "R-1",
      "duration": 600
    },
    {
      "name": "JOB-5",
      "location": {
        "latitude": 50.65310297910443600,
        "longitude": 4.027987934186738
      },
      "plannedArrival": "2023-01-13T08:45:00",
      "initialArrival": "2023-01-13T08:45:00",
      "initialResource": "R-1",
      "duration": 600
    }
  ],
  "options": {
    "maxSuggestions": 3
  }
}
{
  "score": {
    "hardScore": 0,
    "mediumScore": 0,
    "softScore": -10632,
    "feasible": true
  },
  "trips": [
    {
      "visits": [
        {
          "arrival": "2023-01-13T09:02:22",
          "job": "JOB-1",
          "location": "50.54963315022148;4.848855475505483",
          "breakTime": 0
        },
        {
          "arrival": "2023-01-13T10:19:35",
          "job": "JOB-2",
          "location": "50.65910297910444;4.007987934186738",
          "breakTime": 0
        },
        {
          "arrival": "2023-01-13T10:38:07",
          "job": "JOB-3",
          "location": "50.65310297910444;4.007987934186738",
          "breakTime": 0
        },
        {
          "arrival": "2023-01-13T11:03:21",
          "job": "JOB-4",
          "location": "50.69910297910444;4.017987934186738",
          "breakTime": 0
        },
        {
          "arrival": "2023-01-13T11:23:43",
          "job": "JOB-5",
          "location": "50.65310297910444;4.027987934186738",
          "breakTime": 0
        }
      ],
      "resource": "R-1",
      "date": "2023-01-13",
      "departureTime": "2023-01-13T08:00:00",
      "waitTime": 0,
      "travelTime": 9823,
      "workTime": 12823,
      "serviceTime": 3000
    }
  ],
  "totalTravelTimeInSeconds": 9823,
  "totalServiceTimeInSeconds": 3000,
  "workloadFairness": 1,
  "status": "SOLVED"
}
{
  "score": {
    "hardScore": 0,
    "mediumScore": 0,
    "softScore": -10632,
    "feasible": true
  },
  "unresolved": [
    {
      "constraint": "PLANNED_ARRIVAL",
      "score": "-808soft"
    },
    {
      "constraint": "MINIMISE_TRIP_USAGE",
      "score": "-1soft"
    },
    {
      "constraint": "TRAVEL_TIME",
      "score": "-9823soft"
    }
  ]
}