Skip to content

Invalid solution with negative amount #197

@jcoupey

Description

@jcoupey

When using a negative amount, an invalid solution can be reached and chosen for output, hitting an assertion when trying to format the solution:

vroom: ./utils/helpers.h:196: vroom::Solution vroom::utils::format_solution(const vroom::Input&, const RawSolution&): Assertion `amount <= v.capacity' failed.

This happens because during the local search there is no validity check wrt capacity for removing a job from a route. But removing a job can break the capacity restrictions if it holds a negative amount.

The rationale behind capacity values being signed integers is that I was thinking this could be useful to model some pick-up and drop-off situations. I'd like to keep this as is, so the fix would be to add validity checks for capacity to all local search operators upon job removals.

Note : using current master or v1.3.0 with positive values only for capacities is safe from this bug.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions