VROOM-Project/vroom-express

capacity pickup and delivery

Closed this issue · 2 comments

We are setting 5 as the capacity but the problem is the system is assigning 5 delivery task and 5 pickup task separately which means 10 task at total. Is there any solution for set capacity regardless of task type(pickup and delivery)?

Input:

{
  "vehicles": [
    {
      "id": 1,
      "start": [
        2.35044,
        48.71764
      ],
      "end": [
        2.35044,
        48.71764
      ],
      "capacity": [
        1
      ]
    },
    {
      "id": 2,
      "start": [
        2.35044,
        48.71764
      ],
      "end": [
        2.35044,
        48.71764
      ],
      "capacity": [
        1
      ]
    }
  ],
  "jobs": [
    {
      "id": 1,
      "service": 300,
      "delivery": [
        1
      ],
      "location": [
        1.98935,
        48.701
      ]
    },
    {
      "id": 2,
      "service": 300,
      "pickup": [
        1
      ],
      "location": [
        1.98935,
        48.701
      ]
    },
    {
      "id": 5,
      "service": 300,
      "delivery": [
        1
      ],
      "location": [
        1.98935,
        48.701
      ]
    },
    {
      "id": 6,
      "service": 300,
      "delivery": [
        1
      ],
      "location": [
        1.98935,
        48.701
      ]
    }
  ]
}

Result:

{
        "success": true,
        "status": 200,
        "data": {
            "code": 0,
            "summary": {
                "cost": 0,
                "unassigned": 1,
                "delivery": [
                    2
                ],
                "amount": [
                    2
                ],
                "pickup": [
                    1
                ],
                "service": 900,
                "duration": 0,
                "waiting_time": 0,
                "priority": 0,
                "computing_times": {
                    "loading": 4,
                    "solving": 1
                }
            },
            "unassigned": [
                {
                    "id": 6,
                    "location": [
                        1.98935,
                        48.701
                    ]
                }
            ],
            "routes": [
                {
                    "vehicle": 1,
                    "cost": 0,
                    "delivery": [
                        1
                    ],
                    "amount": [
                        1
                    ],
                    "pickup": [
                        1
                    ],
                    "service": 600,
                    "duration": 0,
                    "waiting_time": 0,
                    "priority": 0,
                    "steps": [
                        {
                            "type": "start",
                            "location": [
                                2.35044,
                                48.71764
                            ],
                            "load": [
                                1
                            ],
                            "arrival": 0,
                            "duration": 0
                        },
                        {
                            "type": "job",
                            "location": [
                                1.98935,
                                48.701
                            ],
                            "id": 1,
                            "service": 300,
                            "waiting_time": 0,
                            "job": 1,
                            "load": [
                                0
                            ],
                            "arrival": 0,
                            "duration": 0
                        },
                        {
                            "type": "job",
                            "location": [
                                1.98935,
                                48.701
                            ],
                            "id": 2,
                            "service": 300,
                            "waiting_time": 0,
                            "job": 2,
                            "load": [
                                1
                            ],
                            "arrival": 300,
                            "duration": 0
                        },
                        {
                            "type": "end",
                            "location": [
                                2.35044,
                                48.71764
                            ],
                            "load": [
                                1
                            ],
                            "arrival": 600,
                            "duration": 0
                        }
                    ]
                },
                {
                    "vehicle": 2,
                    "cost": 0,
                    "delivery": [
                        1
                    ],
                    "amount": [
                        1
                    ],
                    "pickup": [
                        0
                    ],
                    "service": 300,
                    "duration": 0,
                    "waiting_time": 0,
                    "priority": 0,
                    "steps": [
                        {
                            "type": "start",
                            "location": [
                                2.35044,
                                48.71764
                            ],
                            "load": [
                                1
                            ],
                            "arrival": 0,
                            "duration": 0
                        },
                        {
                            "type": "job",
                            "location": [
                                1.98935,
                                48.701
                            ],
                            "id": 5,
                            "service": 300,
                            "waiting_time": 0,
                            "job": 5,
                            "load": [
                                0
                            ],
                            "arrival": 0,
                            "duration": 0
                        },
                        {
                            "type": "end",
                            "location": [
                                2.35044,
                                48.71764
                            ],
                            "load": [
                                0
                            ],
                            "arrival": 300,
                            "duration": 0
                        }
                    ]
                }
            ]
        }
    }

Setting a max capacity only means that vehicle load at each step won't go over the given value. In your case, alternating deliveries and pickup makes sure the load is always correct at each step (at most equal to the capacity of 1).

In other words, using a capacity restriction to limit the number of tasks only works in a situation with only deliveries (or only pickups).

See this related discussion for a possible hack: VROOM-Project/vroom#358.

The real fix here would be to have a way to pass a max number of task per vehicle in input and use it to restrict some local search moves. You can open a ticket for this in the core repo (not vroom-express) and I'll flag it as a feature request.

thank you, i open issue in core vroom
https://github.com/VROOM-Project/vroom/issues/421