---
title: "ClikaRT::graph::OptimizeOptions"
sidebar_label: "OptimizeOptions"
description: "How ModelGraph::optimize runs."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--struct">struct</span>

**Header:** `ClikaRT/graph/optimize.h`

How [`ModelGraph::optimize`](./ModelGraph.md#optimize) runs.

## Data members

### defaults {#defaults}

<div class="api-signature">

[`DefaultsOptions`](./DefaultsOptions.md) **`defaults`**

</div>

The transforms' choices.

<div class="api-declared">

Declared in `ClikaRT/graph/optimize.h`, line 54

</div>

### max\_num\_iterations {#max_num_iterations}

<div class="api-signature">

`std::int64_t` **`max_num_iterations`** `=` [`kDefaultMaxNumIterations`](./index.md#kDefaultMaxNumIterations)

</div>

The most iterations one run makes, at least 1. A run that reaches the cap still leaves a correct graph; [`OptimizeReport::converged`](./OptimizeReport.md#converged) says whether it stopped on its own.

<div class="api-declared">

Declared in `ClikaRT/graph/optimize.h`, line 58

</div>

### transforms {#transforms}

<div class="api-signature">

`std::optional<std::vector<`[`Transform`](./Transform.md)`>>` **`transforms`**

</div>

The transforms each iteration runs, in order: handles from the factories in [`transforms`](./transforms/index.md) ([transform.h](./Transform.md)), any of them as often as wanted, and transforms you write ([`Transform::from_function`](./Transform.md#from_function)), two different ones never under one name. `std::nullopt` runs the graph's defaults (`ModelGraph::default_transforms(defaults)`). An empty list runs none of them, though the run still cleans the graph up (it drops the nodes nothing reads). The transforms take their settings from [`defaults`](./OptimizeOptions.md#defaults) either way. A list is refused before anything runs when it places a transform ahead of one it must follow, and when it holds a transform that [`defaults`](./OptimizeOptions.md#defaults) switch off for this graph; each refusal names the list entry and what to change.

<div class="api-declared">

Declared in `ClikaRT/graph/optimize.h`, line 70

</div>
