> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MAP-Elites Optimizer

> Quality-diversity search: bins designs by one or two descriptor constraint scores and keeps the lowest-energy design per cell, returning a diverse panel of elites instead of near-duplicates.

![MAP-Elites Optimizer](https://proto-bio.github.io/proto-assets/images/optimizer/map-elites/hero.png)

This optimizer is open source. Any third-party models, product names, or trademarks referenced are the property of their respective owners, and Proto is not affiliated with them.

***

&#x20;Source

![Proto](https://mintcdn.com/bio-pro/cMLt8hAqaP9M3LKy/assets/logo/logo-light.svg?fit=max\&auto=format\&n=cMLt8hAqaP9M3LKy\&q=85\&s=f5e5dfd1b8f9b9db3a0be0e2eb01f678)

evo-design/proto-language

&#x20;View source

[Open](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/optimizer/map_elites_optimizer.py#L98)

Optimizer contributors[![](https://avatars.githubusercontent.com/u/61667248?v=4\&s=64)adititm](https://github.com/adititm)[![](https://avatars.githubusercontent.com/u/21143637?v=4\&s=64)bviggiano](https://github.com/bviggiano)
MAP-Elites optimizer keeping one lowest-energy elite per descriptor cell.

Results are `num_results` elites spread over the grid by deterministic farthest-point
sampling on cell coordinates, seeded with the best elite and ordered by energy. If the
archive has fewer cells, only the distinct elites are returned (with a warning), as
rejection sampling does; the next stage cycles them to fill its pool. The plateau stop
tracks the best elite's fitness, so new cells filled without a better elite do not
reset `plateau_patience`.

With `constraint_weight_schedules` (fitness constraints only; a descriptor does not count
toward fitness), iteration `t` scores its offspring at the weights scheduled for `t` after
shifting every elite's fitness to those weights from its recorded per-constraint scores, so
each cell compares its elite and a newcomer under one set of weights.

## API Reference

ConfigMAPElitesOptimizerConfig[ Source](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/optimizer/map_elites_optimizer.py#L36)

Configuration for the MAP-Elites optimizer.

**num\_iterations** `integer` *required*

Number of mutate-score-insert iterations.

**descriptor\_constraints** `List[string]` *required*

One or two scoring constraint labels whose scores define the grid; excluded from fitness.

**bins\_per\_descriptor** `integer` (default: 10)

Number of bins per descriptor over the \[0, 1] score range.

**offspring\_per\_iteration** `integer` (default: 16)

Children mutated from randomly chosen elites per iteration.

**num\_results** `integer`

Number of elites (one per cell, spread over the grid) to return. Overrides program count.

**seed** `integer`

Random seed for reproducible optimization, generator, and constraint tool streams.

**tracking\_interval** `integer` (default: 1)

Save history and log progress every N steps. Step 0 and final step always saved.

**track\_proposals** `boolean` (default: False)

Save granular per-proposal results (accept/reject) in history snapshots.

**verbose** `boolean` (default: False)

Emit per-step debug information about proposals, scores, and acceptance through the logger.

**checkpoint\_interval** `integer`

With a checkpoint\_dir, checkpoint the running stage every N iterations. None: stage ends only.

**plateau\_patience** `integer`

Stop after N iterations in a row without improving the best energy (first sets it). None disables.

**plateau\_min\_delta** `number` (default: 0.0)

Minimum decrease of the best energy that counts as improvement for plateau\_patience.

**constraint\_weight\_schedules** `array`

Per-constraint weight schedules that override the constraint's static weight at each step.

## Usage

```python python icon="python" theme={null}
>>> config = MAPElitesOptimizerConfig(num_iterations=50, descriptor_constraints=["gc"], num_results=4)
>>> opt = MAPElitesOptimizer(constructs=[construct], generators=[gen], constraints=[gc, fold], config=config)
>>> opt.run()
```

## Metadata

| Property | Value |
| - | - |
| Key | `map-elites` |
| Class | `MAPElitesOptimizer` |
| Targets Single Segment | `False` |
| Uses GPU | `False` |
| Required Constraint Mode | `discrete` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.