# `Tune.Search.ProgramStrategy`
[🔗](https://github.com/mikehostetler/tune/blob/v0.5.0/lib/tune/search/program_strategy.ex#L1)

An internal program-search algorithm.

An optimizer validates its own configuration, declares which datasets,
model roles, and limits it needs, and compiles a new program from a
normalized `Tune.Search.Program.Context`. It changes task parameters
only. Model configurations, the adapter, and dataset roles are fixed by the
context for the whole run.

# `requirements`

```elixir
@type requirements() :: %{
  :datasets =&gt; [:train | :validation],
  :roles =&gt; [:teacher | :proposal],
  :model_calls? =&gt; boolean(),
  optional(:metric?) =&gt; boolean()
}
```

# `compile`

```elixir
@callback compile(config :: term(), Tune.Program.t(), Tune.Search.Program.Context.t()) ::
  {:ok, Tune.Program.t(), Tune.Search.Program.Context.t()}
  | {:error, term(), Tune.Search.Program.Context.t()}
```

Builds a new program. Returns the program and the final context, or an error
and the final context. The context carries candidates, accounting, and the
stop reason used for the report.

# `init`

```elixir
@callback init(keyword()) :: {:ok, term()} | {:error, Exception.t()}
```

Validates and normalizes optimizer configuration.

# `requirements`

```elixir
@callback requirements(config :: term()) :: requirements()
```

Declares the datasets, roles, and limits the configured algorithm needs.

---

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