Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate instance and solution data #99

Open
leonlan opened this issue May 2, 2023 · 0 comments
Open

Validate instance and solution data #99

leonlan opened this issue May 2, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@leonlan
Copy link
Member

leonlan commented May 2, 2023

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.

@leonlan leonlan changed the title TypedDict for instance and solution Validate instance and solution data May 5, 2023
@leonlan leonlan added the enhancement New feature or request label May 5, 2023
@leonlan leonlan mentioned this issue Mar 1, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant