# `ExVrp.Read`
[🔗](https://github.com/sephianl/ex_vrp/blob/v0.4.2/lib/ex_vrp/read.ex#L1)

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)

# `round_func`

```elixir
@type round_func() ::
  :none | :round | :trunc | :dimacs | :exact | (float() -&gt; integer())
```

# `read`

```elixir
@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)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
