You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/guide/implementing-a-strategy.md
+62-30Lines changed: 62 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
+
# Implementing a Strategy
2
+
1
3
```@meta
2
4
CurrentModule = CTBase
3
5
```
4
6
5
-
# Implementing a Strategy
6
-
7
7
This guide walks you through implementing a complete strategy family using the `AbstractStrategy` contract. We use **Collocation** and **DirectShooting** discretizers as concrete examples.
8
8
9
9
!!! tip "Prerequisites"
@@ -21,7 +21,7 @@ Every strategy implements a **two-level contract** that separates static metadat
21
21
22
22
```text
23
23
Type-Level (no instantiation needed)
24
-
├─ id(::Type{<:S}) → Symbol (routing, registry lookup)
24
+
├─ id(::Type{<:S}) → Symbol (routing, registry lookup)
The `StrategyOptions` object tracks both values and their provenance. You can access options in two ways:
159
156
160
157
**Via the `options` getter:**
161
158
162
-
```@repl strategy
159
+
```@example strategy
163
160
c = Collocation(grid_size = 100)
161
+
```
162
+
163
+
```@example strategy
164
164
Strategies.options(c)
165
165
```
166
166
@@ -238,23 +238,19 @@ nothing # hide
238
238
!!! note "Same option name, different definitions"
239
239
Both `Collocation` and `DirectShooting` define a `:grid_size` option, but with different defaults (250 vs 100) and descriptions. Each strategy has its own independent `OptionDefinition` set.
Copy file name to clipboardExpand all lines: docs/src/guide/options-system.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,7 +179,7 @@ println("Value: ", opt.value)
179
179
println("Source: ", opt.source)
180
180
```
181
181
182
-
## Accessing Option Properties (Getters)
182
+
## Accessing Option Properties
183
183
184
184
Use the getters in `Options` to access `OptionDefinition` and `OptionValue` fields instead of reading struct fields directly. This keeps encapsulation intact and aligns with Strategies overrides.
185
185
@@ -210,7 +210,7 @@ Options.is_default(opt2)
210
210
Options.is_computed(opt2)
211
211
```
212
212
213
-
## StrategyMetadata Overview (Strategies)
213
+
## StrategyMetadata Overview
214
214
215
215
`StrategyMetadata` is a collection of `OptionDefinition` objects that describes all configurable options for a strategy. It is returned by `Strategies.metadata(::Type)`.
0 commit comments