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

Fleet minimisation for VRP instances.

Attempts to reduce the number of vehicles needed to achieve a feasible
solution to the given problem instance, subject to a stopping criterion.

## Warning

This function is currently unable to solve instances with multiple
vehicle types. Support for such a setting may be added in future versions.

# `minimise`

```elixir
@spec minimise(ExVrp.Model.t(), ExVrp.StoppingCriteria.t(), keyword()) ::
  {:ok, ExVrp.VehicleType.t()} | {:error, String.t()}
```

Attempts to reduce the number of vehicles needed to achieve a feasible
solution to the given problem instance.

## Parameters

  * `model` - The VRP model with a given vehicle composition
  * `stop` - Stopping criterion that determines how much effort to spend
  * `opts` - Options:
    * `:seed` - Seed value for RNG (default: 0)

## Returns

Returns `{:ok, vehicle_type}` with the smallest fleet composition that
admits a feasible solution, or `{:error, reason}` if validation fails.

## Raises

Returns an error when the instance contains more than one vehicle type
or when the instance contains optional clients.

## Examples

    {:ok, vehicle_type} = MinimiseFleet.minimise(model, StoppingCriteria.max_iterations(100))

# `minimise!`

```elixir
@spec minimise!(ExVrp.Model.t(), ExVrp.StoppingCriteria.t(), keyword()) ::
  ExVrp.VehicleType.t()
```

Same as `minimise/3` but raises on error.

---

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