Reads VRPLIB format instance files.
A VRPLIB file contains a vehicle routing problem instance in a standardized
text format. This module provides functions to parse these files and create
an ExVrp.Model that can be solved.
Rounding Functions
When reading instances, you can specify a rounding function to apply to floating-point values:
:none- No rounding (default):round- Round to nearest integer:trunc- Truncate to integer:dimacs- Scale by 10 and truncate (for DIMACS benchmarks):exact- Scale by 1000 and round (for high precision)
Example
# Read a VRPLIB instance
model = ExVrp.Read.read("instances/E-n22-k4.vrp")
# With rounding
model = ExVrp.Read.read("instances/RC208.vrp", round_func: :round)
Summary
Functions
Reads a VRPLIB format file and returns an ExVrp.Model.
Types
Functions
@spec read( String.t() | Path.t(), keyword() ) :: ExVrp.Model.t()
Reads a VRPLIB format file and returns an ExVrp.Model.
Options
:round_func- Rounding function to apply to values (default::none)
Examples
model = ExVrp.Read.read("instances/OkSmall.txt")
model = ExVrp.Read.read("instances/E-n22-k4.vrp", round_func: :dimacs)