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

Represents a vehicle type in a VRP.

Vehicle types define the characteristics of vehicles in the fleet,
including capacity, costs, time windows, and depot assignments.

# `t`

```elixir
@type t() :: %ExVrp.VehicleType{
  capacity: [non_neg_integer()],
  end_depot: non_neg_integer(),
  fixed_cost: non_neg_integer(),
  forbidden_windows: [{non_neg_integer(), non_neg_integer()}],
  initial_load: [non_neg_integer()],
  max_distance: non_neg_integer() | :infinity,
  max_overtime: non_neg_integer(),
  max_reloads: non_neg_integer() | :infinity,
  name: String.t(),
  num_available: pos_integer(),
  profile: non_neg_integer(),
  reload_depots: [non_neg_integer()],
  shift_duration: non_neg_integer() | :infinity,
  start_depot: non_neg_integer(),
  start_late: non_neg_integer(),
  tw_early: non_neg_integer(),
  tw_late: non_neg_integer() | :infinity,
  unit_distance_cost: non_neg_integer(),
  unit_duration_cost: non_neg_integer(),
  unit_overtime_cost: non_neg_integer()
}
```

# `new`

```elixir
@spec new(keyword()) :: t()
```

Creates a new vehicle type.

## Required Options

- `:num_available` - Number of vehicles of this type available
- `:capacity` - List of capacity values per dimension

## Optional Options

- `:start_depot` - Index of starting depot (default: `0`)
- `:end_depot` - Index of ending depot (default: `0`)
- `:fixed_cost` - Fixed cost for using this vehicle (default: `0`)
- `:tw_early` - Earliest departure time (default: `0`)
- `:tw_late` - Latest return time (default: `:infinity`)
- `:shift_duration` - Maximum shift duration (default: `:infinity`)
- `:max_distance` - Maximum distance allowed (default: `:infinity`)
- `:unit_distance_cost` - Cost per unit distance (default: `1`)
- `:unit_duration_cost` - Cost per unit time (default: `0`)
- `:profile` - Index of distance/duration matrix to use (default: `0`)
- `:start_late` - Latest allowed start time (default: `0`)
- `:max_overtime` - Maximum overtime allowed (default: `0`)
- `:unit_overtime_cost` - Cost per unit of overtime (default: `0`)
- `:reload_depots` - List of depot indices where vehicle can reload (default: `[]`)
- `:max_reloads` - Maximum number of reloads per route (default: `:infinity`)
- `:initial_load` - Initial load per dimension (default: `[]`)
- `:name` - Vehicle type name (default: `""`)
- `:time_windows` - List of `{start, end}` tuples representing multiple operating
  windows. Automatically converted to `:tw_early`, `:tw_late`, and `:forbidden_windows`.
  Mutually exclusive with `:tw_early`, `:tw_late`, and `:forbidden_windows`.
  Example: `[{0, 500}, {600, 1000}]` becomes `tw_early: 0, tw_late: 1000,
  forbidden_windows: [{500, 600}]`. Overlapping/adjacent windows are merged automatically.
- `:forbidden_windows` - List of `{start, end}` tuples for periods when the vehicle
  cannot service clients (default: `[]`). Each window must be within `[tw_early, tw_late]`.

## Examples

    iex> ExVrp.VehicleType.new(num_available: 3, capacity: [100, 50])
    %ExVrp.VehicleType{num_available: 3, capacity: [100, 50], ...}

---

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