# `Imp.Optimize.Anything.Result`
[🔗](https://github.com/deepfates/imp/blob/v0.18.1/lib/imp/optimize/anything/result.ex#L1)

Immutable Optimize Anything result projected from the GEPA engine.

The result keeps the complete named candidate population, lineage,
validation scores, Pareto winners, observed budget, and a JSON-safe engine
checkpoint. Binary candidates are wrapped internally and unwrapped only by
`best_candidate/1`; structured candidates remain native maps at every
public result boundary.

# `t`

```elixir
@type t() :: %Imp.Optimize.Anything.Result{
  best_outputs_valset: term(),
  candidate_side_information: term(),
  candidates: term(),
  checkpoint: term(),
  discovery_evaluation_counts: term(),
  full_evaluations: term(),
  history: term(),
  instance_frontier: term(),
  mode: term(),
  objective_frontier: term(),
  objective_scores: term(),
  parents: term(),
  reflection_calls: term(),
  rejected: term(),
  run_dir: term(),
  seed: term(),
  stop_reason: term(),
  string_candidate_key: term(),
  total_metric_calls: term(),
  validation_scores: term(),
  validation_subscores: term()
}
```

# `best_candidate`

```elixir
@spec best_candidate(t()) :: map() | String.t()
```

Returns the best named/structured candidate, or a binary for string-candidate runs.

# `best_index`

```elixir
@spec best_index(t()) :: non_neg_integer()
```

Returns the first candidate with the maximum aggregate validation score.

# `best_refiner_prompt`

```elixir
@spec best_refiner_prompt(t()) :: String.t() | nil
```

Returns the winning co-evolved refiner prompt when present.

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Restores a version-2 Optimize Anything result.

# `from_state`

```elixir
@spec from_state(struct(), keyword()) :: t()
```

Builds an immutable public result from a completed GEPA engine state.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts the result to a JSON-safe schema-versioned map.

Credentials outside the candidates and the checkpoint are redacted with
`Imp.Redaction`.

---

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