# `Jido.Evolve.Evolvable`
[🔗](https://github.com/agentjido/jido_evolve/blob/v1.0.0/lib/jido_evolve/evolvable.ex#L1)

Protocol for making any data structure evolvable.

This protocol defines how entities can be converted to and from
a normalized genome representation for evolutionary operations.

# `entity`

```elixir
@type entity() :: term()
```

# `genome`

```elixir
@type genome() :: term()
```

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `from_genome`

```elixir
@spec from_genome(entity(), genome()) :: entity()
```

Convert a genome back to the original entity type.

The original entity is provided for context and type information.

## Examples

    iex> Jido.Evolve.Evolvable.from_genome("original", ['h', 'i'])
    "hi"

# `similarity`

```elixir
@spec similarity(entity(), entity()) :: float()
```

Calculate similarity between two entities (0.0 = identical, 1.0 = completely different).

This is used for diversity maintenance and convergence detection.

## Examples

    iex> Jido.Evolve.Evolvable.similarity("hello", "hello")
    0.0
    
    iex> Jido.Evolve.Evolvable.similarity("hello", "world")
    1.0

# `to_genome`

```elixir
@spec to_genome(entity()) :: genome()
```

Convert an entity to its genome representation.

The genome should be a structure that can be easily mutated
and crossed over with other genomes of the same type.

## Examples

    iex> Jido.Evolve.Evolvable.to_genome("hello")
    ['h', 'e', 'l', 'l', 'o']

---

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