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/benchmarks/maintenance.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,17 @@ The Maintenance problem with resource constraint is a sequential decision-making
7
7
8
8
### Overview
9
9
10
-
In this benchmark, a system consists of $N$ identical components, each of which can degrade over $n$ discrete states. State $1$ means that the component is new, state $n$ means that the component is failed. At each time step, the agent can maintain up to $K$ components.
10
+
In this benchmark, a system consists of ``N`` identical components, each of which can degrade over ``n`` discrete states. State ``1`` means that the component is new, state $n$ means that the component is failed. At each time step, the agent can maintain up to $K$ components.
11
11
12
12
This forms an endogenous multistage stochastic optimization problem, where the agent must plan maintenance actions over the horizon.
13
13
14
14
### Mathematical Formulation
15
15
16
16
The maintenance problem can be formulated as a finite-horizon Markov Decision Process (MDP) with the following components:
17
17
18
-
**State Space**$\mathcal{S}$: At time step $t$, the state $s_t \in [1:n]^N$ is the degradation state for each component.
18
+
**State Space**``\mathcal{S}``: At time step ``t``, the state ``s_t \in [1:n]^N`` is the degradation state for each component.
19
19
20
-
**Action Space**$\mathcal{A}$: The action at time $t$ is the set of components that are maintained at time $t$:
20
+
**Action Space**``\mathcal{A}``: The action at time ``t`` is the set of components that are maintained at time ``t``:
21
21
```math
22
22
a_t \subseteq \{1, 2, \ldots, N\} \text{ such that } |a_t| \leq K
23
23
```
@@ -51,9 +51,9 @@ Here, \(p\) is the degradation probability, \(s_t^i\) is the current state of co
51
51
52
52
The immediate cost at time \(t\) is:
53
53
54
-
$$
54
+
```math
55
55
c(s_t, a_t) = \Big( c_m \cdot |a_t| + c_f \cdot \#\{ i : s_t^i = n \} \Big)
# In the case o fthe Warcraft benchmark, the method has an additional keyword argument to chose the algorithm to use: Dijkstra's algorithm or Bellman-Ford algorithm.
51
52
y =maximizer(θ)
52
53
# As we can see, currently the pipeline predicts random noise as cell weights, and therefore the maximizer returns a straight line path.
53
-
plot_data(b, DataSample(; x, θ, y))
54
+
plot_solution(b, DataSample(; x, θ, y))
54
55
# We can evaluate the current pipeline performance using the optimality gap metric:
Where implemented, benchmarks provide benchmark-specific plotting helpers:
184
-
183
+
Plots is an **optional** dependency, load it with `using Plots` to unlock the plot functions. Not all benchmarks support visualization, call `has_visualization(bench)` to check.
185
184
```julia
186
-
plot_data(bench, sample) # overview of a data sample
187
-
plot_instance(bench, instance) # raw problem instance
188
-
plot_solution(bench, sample, y) # overlay solution on instance
185
+
using Plots
186
+
187
+
bench =Argmax2DBenchmark()
188
+
dataset =generate_dataset(bench, 10)
189
+
sample = dataset[1]
190
+
191
+
has_visualization(bench) # true
192
+
plot_instance(bench, sample) # problem geometry only
193
+
plot_solution(bench, sample) # sample.y overlaid on the instance
194
+
plot_solution(bench, sample, y) # convenience 3-arg form: override y before plotting
195
+
196
+
# Dynamic benchmarks only
197
+
traj =generate_anticipative_solver(bench)(env)
198
+
plot_trajectory(bench, traj) # grid of epoch subplots
199
+
anim =animate_trajectory(bench, traj; fps=2)
200
+
gif(anim, "episode.gif")
189
201
```
202
+
203
+
-`has_visualization(bench)`: returns `true` for benchmarks that implement plot support (if Plots is loaded).
204
+
-`plot_instance(bench, sample; kwargs...)`: renders the problem geometry without any solution.
205
+
-`plot_solution(bench, sample; kwargs...)`: renders `sample.y` overlaid on the instance.
206
+
-`plot_solution(bench, sample, y; kwargs...)`: 3-arg convenience form that overrides `y` before plotting.
207
+
-`plot_trajectory(bench, traj; kwargs...)`: dynamic benchmarks only; produces a grid of per-epoch subplots.
208
+
-`animate_trajectory(bench, traj; kwargs...)`: dynamic benchmarks only, returns a `Plots.Animation` that can be saved with `gif(anim, "file.gif")`.
0 commit comments