Description
The way that vrplib
parses instances and solutions allows for very general formats, e.g., custom specifications and data sections in instances. Since we do not know what kind of data the user will pass-in, it's impossible to enforce strict data validation and typing. This makes the type of the instance and solutions dictionaries very general: Dict[str] -> Union[float, str, np.ndarray]
is almost the same as Dict[str] -> Any
.
Because there are some conventions among VRPLIB instances (e.g., see CVRP instances like EDGE_WEIGHT_SECTION
), it is possible to use a TypedDict
to type hint these key-value pairs correctly.
This is also a good thing to do on the long-term to define a general VRPLIB standard with protected section names.
Rationale: we parse any VRPLIB formatted instance, but we only validate VRPLIB protected keywords.
This provides flexibility to the user to use vrplib
for their own custom VRP instances, but we can define a standard for common VRP problems.