# `GEPA.Result`
[🔗](https://github.com/nshkrdotcom/gepa_ex/blob/v0.3.0/lib/gepa/result.ex#L1)

Immutable result container for GEPA optimization.

Contains the final optimization state and provides convenient
accessors for analysis.

# `t`

```elixir
@type t() :: %GEPA.Result{
  best_candidate: GEPA.Types.candidate() | term() | nil,
  best_idx: non_neg_integer() | nil,
  best_outputs_valset:
    %{required(GEPA.Types.data_id()) =&gt; [{GEPA.Types.program_idx(), term()}]}
    | nil,
  candidates: [GEPA.Types.candidate()],
  discovery_eval_counts: [non_neg_integer()],
  i: integer(),
  num_full_ds_evals: non_neg_integer(),
  objective_pareto_front: %{required(String.t()) =&gt; float()} | nil,
  parents: [[GEPA.Types.program_idx() | nil]],
  per_objective_best_candidates:
    %{required(String.t()) =&gt; MapSet.t(GEPA.Types.program_idx())} | nil,
  per_val_instance_best_candidates: GEPA.Types.pareto_fronts(),
  total_num_evals: non_neg_integer(),
  val_aggregate_scores: [float()],
  val_aggregate_subscores: [%{required(String.t()) =&gt; float()}] | nil,
  val_subscores: [GEPA.Types.sparse_scores()]
}
```

# `best_candidate`

```elixir
@spec best_candidate(t()) :: GEPA.Types.candidate()
```

Get the best candidate program.

# `best_idx`

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

Get the index of the best candidate by aggregate score.

# `best_score`

```elixir
@spec best_score(t()) :: float()
```

Get the best score achieved.

# `candidate_tree_dot`

```elixir
@spec candidate_tree_dot(t()) :: String.t()
```

Generate Graphviz DOT for this result's candidate lineage.

# `candidate_tree_html`

```elixir
@spec candidate_tree_html(t()) :: String.t()
```

Generate a self-contained HTML visualization for this result's candidate lineage.

# `from_dict`

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

Rebuild a result from `to_dict/1` output.

# `from_state`

```elixir
@spec from_state(GEPA.State.t()) :: t()
```

Create result from final optimization state.

# `to_dict`

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

Convert a result to a plain map suitable for persistence or JSON conversion.

---

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