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

Represents a group of clients with mutual constraints.

Client groups are used to express constraints like "visit at most one
of these clients" (mutually exclusive) or other grouping requirements.

Groups are created empty and clients are added dynamically via
`Model.add_client/2` with the `group:` option.

## Mutually Exclusive Groups

When `required: false`, the group is automatically marked as mutually
exclusive, meaning at most one client from the group can be visited.
This matches PyVRP's semantics.

## Example

    {model, group} = Model.add_client_group(model, required: false)
    model = Model.add_client(model, x: 1, y: 1, group: group)
    model = Model.add_client(model, x: 2, y: 2, group: group)

# `t`

```elixir
@type t() :: %ExVrp.ClientGroup{
  clients: [non_neg_integer()],
  mutually_exclusive: boolean(),
  name: String.t(),
  required: boolean()
}
```

# `add_client`

```elixir
@spec add_client(t(), non_neg_integer()) :: t()
```

Adds a client index to the group.

This is called internally by `Model.add_client/2` when a group is specified.

# `clear`

```elixir
@spec clear(t()) :: t()
```

Clears all clients from the group.

Used when depots are added after clients, requiring re-indexing.

# `new`

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

Creates a new client group.

Groups start empty - clients are added dynamically via `Model.add_client/2`.

## Options

- `:required` - Whether at least one client must be visited (default: `true`)
- `:mutually_exclusive` - Whether only one client can be visited (default: `not required`)
- `:name` - Group name for identification (default: `""`)

## Examples

    iex> ExVrp.ClientGroup.new(required: false)
    %ExVrp.ClientGroup{clients: [], required: false, mutually_exclusive: true, name: ""}

    iex> ExVrp.ClientGroup.new(required: true, name: "priority")
    %ExVrp.ClientGroup{clients: [], required: true, mutually_exclusive: false, name: "priority"}

---

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