Skip to content

VRP with a single location #291

@senhalil

Description

@senhalil

The following VRP problem with a single location (note that all location indices are 0) but with a 2x2 matrix returns the expected solution with zero cost.

However, if the matrix is replaced by a 1x1 matrix, then vroom tries to connect to OSRM and fail with the following error {"code":3,"error":"Failed to connect to 0.0.0.0:5000"} (since there is no lat/lon, even if the connection succeeds, the query would fail anyway).

I believe the offender is if (_matrix.size() < 2) { check on src/structures/vroom/input/input.cpp:332 inside solve function.

Is the check against 2 is necessary? It seems to me that 1 does the job well.

# input
{
  "vehicles": [
    {
      "id": 0,
      "start_index": 0,
      "end_index": 0
    }
  ],
  "jobs": [
    {
      "id": 0,
      "location_index": 0
    }
  ],
  "matrix": [
    [
      0,
      6232
    ],
    [
      6239,
      0
    ]
  ]
}
# output
{
  "code": 0,
  "summary": {
    "cost": 0,
    "unassigned": 0,
    "service": 0,
    "duration": 0,
    "waiting_time": 0,
    "computing_times": {
      "loading": 0,
      "solving": 0
    }
  },
  "unassigned": [],
  "routes": [
    {
      "vehicle": 0,
      "cost": 0,
      "service": 0,
      "duration": 0,
      "waiting_time": 0,
      "steps": [
        {
          "type": "start",
          "arrival": 0,
          "duration": 0
        },
        {
          "type": "job",
          "job": 0,
          "service": 0,
          "waiting_time": 0,
          "arrival": 0,
          "duration": 0
        },
        {
          "type": "end",
          "arrival": 0,
          "duration": 0
        }
      ]
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions