Skip to content

Commit d097fc1

Browse files
committed
Add API reference to docs
1 parent 617324d commit d097fc1

19 files changed

+424
-67
lines changed

docs/make.jl

+13-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,24 @@ DocMeta.setdocmeta!(
1010

1111
makedocs(;
1212
modules = [IntervalMDPAbstractions],
13-
authors = "Frederik Baymler Mathiesen",
13+
authors = "Frederik Baymler Mathiesen <[email protected]> and contributors",
1414
sitename = "IntervalMDPAbstractions.jl",
1515
format = Documenter.HTML(;
16-
canonical = "https://Zinoex.github.io/IntervalMDPAbstractions.jl",
16+
prettyurls = get(ENV, "CI", "false") == "true",
17+
canonical = "https://www.baymler.com/IntervalMDPAbstractions.jl",
1718
edit_link = "main",
1819
assets = String[],
1920
),
20-
pages = ["Home" => "index.md"],
21+
pages = [
22+
"Home" => "index.md"
23+
"Reference" => Any[
24+
"Dynamics" => "reference/dynamics.md",
25+
"Specifications" => "reference/specifications.md",
26+
"Abstractions" => "reference/abstractions.md",
27+
]
28+
],
29+
doctest = true,
30+
checkdocs = :exports
2131
)
2232

2333
deploydocs(; repo = "github.com/Zinoex/IntervalMDPAbstractions.jl", devbranch = "main")

docs/src/index.md

-6
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@ CurrentModule = IntervalMDPAbstractions
66

77
Documentation for [IntervalMDPAbstractions](https://github.com/Zinoex/IntervalMDPAbstractions.jl).
88

9-
```@index
10-
```
11-
12-
```@autodocs
13-
Modules = [IntervalMDPAbstractions]
14-
```

docs/src/reference/abstractions.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Abstractions
2+
To build an abstraction, in addition to the definition of the system dynamics and the specification,
3+
we also need to define select inputs and partition the state space/region of interest.
4+
Since there are multiple options for both, we wrap them as input and state abstractions, such that
5+
the [`abstraction`](@ref) method to build the finite-state abstractions can ignore the details of
6+
the choice of input and state partitioning.
7+
8+
## Input abstractions
9+
```@docs
10+
InputAbstraction
11+
InputGridSplit
12+
InputLinRange
13+
InputDiscrete
14+
inputs
15+
numinputs
16+
```
17+
18+
To define a new input abstraction, introduce a new struct type that inherits from `InputAbstraction` and
19+
implements `inputs` and `numinputs` methods. The `inputs` method should return the set of inputs (set-based, singletons, or discrete)
20+
and the `numinputs` should return the number of inputs in the set.
21+
22+
## State abstractions
23+
24+
```@docs
25+
StateAbstraction
26+
StateUniformGridSplit
27+
regions
28+
numregions
29+
statespace
30+
```
31+
32+
Right now, we only support state abstractions that are based on a uniform grid split of the state space. However, one
33+
can easily imagine a non-uniform grid or a refinement-based partitioning for heterogenous abstractions. To implement such a state abstraction,
34+
define a new struct type that inherits from `StateAbstraction` and implements `regions`, `numregions`, and `statespace` methods.
35+
36+
## Target models
37+
```@docs
38+
IMDPTarget
39+
SparseIMDPTarget
40+
OrthogonalIMDPTarget
41+
SparseOrthogonalIMDPTarget
42+
MixtureIMDPTarget
43+
SparseMixtureIMDPTarget
44+
```
45+
46+
## Constructing finite-state abstractions
47+
```@docs
48+
abstraction
49+
```

docs/src/reference/dynamics.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Dynamics
2+
3+
## General
4+
```@docs
5+
DiscreteTimeStochasticDynamics
6+
dimstate
7+
diminput
8+
System
9+
dynamics
10+
initial
11+
```
12+
13+
## Additive noise systems
14+
```@docs
15+
AdditiveNoiseDynamics
16+
nominal
17+
prepare_nominal
18+
noise
19+
AffineAdditiveNoiseDynamics
20+
NonlinearAdditiveNoiseDynamics
21+
UncertainPWAAdditiveNoiseDynamics
22+
UncertainAffineRegion
23+
```
24+
25+
### Additive noise structures
26+
```@docs
27+
AdditiveNoiseStructure
28+
AdditiveDiagonalGaussianNoise
29+
AdditiveCentralUniformNoise
30+
```
31+
32+
## Abstracted Gaussian processes
33+
```@docs
34+
AbstractedGaussianProcess
35+
AbstractedGaussianProcessRegion
36+
gp_bounds
37+
region
38+
mean_lower
39+
mean_upper
40+
stddev_lower
41+
stddev_upper
42+
```
43+
44+
## Stochastic switched systems
45+
```@docs
46+
StochasticSwitchedDynamics
47+
```

docs/src/reference/specifications.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Specification
2+
3+
```@docs
4+
FiniteTimeRegionReachability
5+
InfiniteTimeRegionReachability
6+
FiniteTimeRegionReachAvoid
7+
InfiniteTimeRegionReachAvoid
8+
FiniteTimeRegionSafety
9+
InfiniteTimeRegionSafety
10+
reach
11+
avoid
12+
dim
13+
```
14+
15+
## Abstraction problem
16+
17+
```@docs
18+
AbstractionProblem
19+
system
20+
specification
21+
```

docs/src/reference/systems.md

-12
This file was deleted.

src/abstractions/abstraction.jl

+41-6
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,20 @@ end
7676
# IMDP target #
7777
###############
7878
"""
79-
abstraction(prob::AbstractionProblem, state_abstraction::StateUniformGridSplit, input_abstraction::InputAbstraction, target_model::AbstractIMDPTarget)
79+
abstraction(prob, state_abstraction::StateUniformGridSplit, input_abstraction, target_model::AbstractIMDPTarget)
8080
81-
Abstract function for creating an abstraction of a system with additive noise with an IMDP as the target model.
81+
Construct an abstraction of a system and a specification under a uniform grid partitioning of the state space with an arbitrary input abstraction
82+
and an IMDP as the target model.
83+
84+
The argument `prob` contains both the system and the specification. The type of the system determines how the transition probability bounds are computed.
85+
The resulting IMDP has `numregions(state_abstraction) + 1` states, where the last state is an absorbing state, representing transitioning to outside
86+
the partitioned region. This absorbing state is implicitly encoded in the ambiguity sets, i.e. not stored and automatically handled by `IntervalMDP.jl`.
87+
88+
The specification is converted based on the `state_abstraction` and `target_model` arguments in addition to whether the specification is pessimistic or optimistic.
89+
To encode the specification, at least one avoid state is required, i.e. the last, absorbing state. As a consequence, (concrete) reachability specifications are
90+
converted to (abstract) reach-avoid specifications with the last state as the avoid state.
91+
92+
Returns `mdp` and `spec` as the abstracted IMDP and the converted specification, respectively.
8293
"""
8394
function abstraction(
8495
prob::AbstractionProblem,
@@ -218,9 +229,21 @@ end
218229
# Orthogonal IMDP target #
219230
##########################
220231
"""
221-
abstraction(prob::AbstractionProblem, state_abstraction::StateUniformGridSplit, input_abstraction::InputAbstraction, target_model::AbstractOrthogonalIMDPTarget)
232+
abstraction(prob, state_abstraction::StateUniformGridSplit, input_abstraction, target_model::AbstractOrthogonalIMDPTarget)
233+
234+
Construct an abstraction of a system and a specification under a uniform grid partitioning of the state space with an arbitrary input abstraction
235+
and an orthogonal IMDP as the target model.
236+
237+
The argument `prob` contains both the system and the specification. The type of the system determines how the *marginal* transition probability bounds are computed.
238+
The resulting *orthogonal* IMDP has `IntervalMDPAbstractions.splits(state_abstraction) .+ 1` states along each axis,
239+
where the last state along each axis is an absorbing state, representing transitioning to outside the partitioned region.
240+
This absorbing state for each axis is implicitly encoded in the ambiguity sets, i.e. not stored and automatically handled by `IntervalMDP.jl`.
222241
223-
Abstract function for creating an abstraction of a system with additive noise with a decoupled IMDP as the target model.
242+
The specification is converted based on the `state_abstraction` and `target_model` arguments in addition to whether the specification is pessimistic or optimistic.
243+
To encode the specification, at least one avoid state is required, i.e. the last, absorbing state. As a consequence, (concrete) reachability specifications are
244+
converted to (abstract) reach-avoid specifications with the last state as the avoid state.
245+
246+
Returns `mdp` and `spec` as the abstracted IMDP and the converted specification, respectively.
224247
"""
225248
function abstraction(
226249
prob::AbstractionProblem,
@@ -411,9 +434,21 @@ end
411434
# Mixture IMDP target #
412435
#######################
413436
"""
414-
abstraction(prob::AbstractionProblem, state_abstraction::StateUniformGridSplit, input_abstraction::InputAbstraction, target_model::AbstractMixtureIMDPTarget)
437+
abstraction(prob, state_abstraction::StateUniformGridSplit, input_abstraction, target_model::AbstractMixtureIMDPTarget)
438+
439+
Construct an abstraction of a system and a specification under a uniform grid partitioning of the state space with an arbitrary input abstraction
440+
and a mixture of orthogonal IMDPs as the target model.
441+
442+
The argument `prob` contains both the system and the specification. The type of the system determines how the *marginal mixture* transition probability bounds are computed.
443+
The resulting *mixture* IMDP has `IntervalMDPAbstractions.splits(state_abstraction) .+ 1` states along each axis,
444+
where the last state along each axis is an absorbing state, representing transitioning to outside the partitioned region.
445+
This absorbing state for each axis is implicitly encoded in the ambiguity sets, i.e. not stored and automatically handled by `IntervalMDP.jl`.
446+
447+
The specification is converted based on the `state_abstraction` and `target_model` arguments in addition to whether the specification is pessimistic or optimistic.
448+
To encode the specification, at least one avoid state is required, i.e. the last, absorbing state. As a consequence, (concrete) reachability specifications are
449+
converted to (abstract) reach-avoid specifications with the last state as the avoid state.
415450
416-
Abstract function for creating an abstraction of a system with a mixture of orthogonal IMDPs as the target model.
451+
Returns `mdp` and `spec` as the abstracted IMDP and the converted specification, respectively.
417452
"""
418453
function abstraction(
419454
prob::AbstractionProblem,

src/abstractions/input_abstraction.jl

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1-
export InputAbstraction, InputGridSplit, InputLinRange, InputRandom, InputDiscrete
1+
export InputAbstraction, InputGridSplit, InputLinRange, InputDiscrete
22
export inputs, numinputs
33

4+
"""
5+
InputAbstraction
6+
7+
Abstract type for input abstractions.
8+
"""
49
abstract type InputAbstraction end
510

11+
"""
12+
inputs(input::InputAbstraction)
13+
14+
Return the set of inputs of a given input abstraction.
15+
"""
16+
function inputs end
17+
18+
"""
19+
numinputs(input::InputAbstraction)
20+
21+
Return the number of inputs, i.e. the size of the set of inputs, of a given input abstraction.
22+
"""
23+
function numinputs end
24+
625
"""
726
InputGridSplit
827

src/abstractions/state_abstraction.jl

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
export StateUniformGridSplit, numregions, statespace
1+
export StateAbstraction, StateUniformGridSplit, regions, numregions, statespace
22

3+
"""
4+
StateAbstraction
5+
6+
Abstract type for state abstractions.
7+
"""
38
abstract type StateAbstraction end
49

510
"""
611
StateUniformGridSplit
712
8-
State abstraction for splitting the state space into a grid.
13+
State abstraction for splitting the state space into a uniform grid.
914
"""
1015
struct StateUniformGridSplit{N,I<:Int,H<:AbstractHyperrectangle} <: StateAbstraction
1116
state_space::H
@@ -19,6 +24,25 @@ function StateUniformGridSplit(state_space::Hyperrectangle, splits::NTuple{N,Int
1924
end
2025

2126
splits(state::StateUniformGridSplit) = state.splits
27+
28+
"""
29+
regions(state::StateUniformGridSplit)
30+
31+
Return the regions of the state abstraction.
32+
"""
2233
regions(state::StateUniformGridSplit) = state.regions
34+
35+
"""
36+
numregions(state::StateUniformGridSplit)
37+
38+
Return the number of regions of the state abstraction.
39+
"""
2340
numregions(state::StateUniformGridSplit) = prod(state.splits)
41+
42+
"""
43+
statespace(state::StateUniformGridSplit)
44+
45+
Return the state space of the state abstraction. This should must be a hyperrectangle
46+
and should be equal to the union of the regions.
47+
"""
2448
statespace(state::StateUniformGridSplit) = state.state_space

src/abstractions/target.jl

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export TargetAbstractionModel
21
export IMDPTarget, SparseIMDPTarget
32
export OrthogonalIMDPTarget, SparseOrthogonalIMDPTarget
43
export MixtureIMDPTarget, SparseMixtureIMDPTarget
@@ -48,13 +47,13 @@ abstract type AbstractOrthogonalIMDPTarget <: TargetAbstractionModel end
4847
OrthogonalIMDPTarget
4948
5049
A target for IMDP abstractions where, for each source state, the transition probabilities
51-
are orthogonally decomposed. One state is appended along each axis to capture the transitions
50+
are orthogonally decomposed [1]. One state is appended along each axis to capture the transitions
5251
to outside the partitioned region.
5352
5453
Benefits compared to `IMDPTarget` include less memory usage, faster computation of the
5554
transition probabilities and value iteration, and tighter uncertainty set (see [1] for a proof).
5655
57-
[1] TODO: Add reference to paper.
56+
[1] Mathiesen, Frederik Baymler, Sofie Haesaert, and Luca Laurenti. "Scalable control synthesis for stochastic systems via structural IMDP abstractions." arXiv preprint arXiv:2411.11803 (2024).
5857
"""
5958
struct OrthogonalIMDPTarget <: AbstractOrthogonalIMDPTarget end
6059

@@ -82,13 +81,13 @@ abstract type AbstractMixtureIMDPTarget <: AbstractOrthogonalIMDPTarget end
8281
MixtureIMDPTarget
8382
8483
A target for IMDP abstractions where, for each source state, the transition probabilities
85-
are Mixturely decomposed. One state is appended along each axis to capture the transitions
84+
are decomposed as a mixture [1]. One state is appended along each axis to capture the transitions
8685
to outside the partitioned region.
8786
88-
Benefits compared to `IMDPTarget` include less memory usage, faster computation of the
89-
transition probabilities and value iteration, and tighter uncertainty set (see [1] for a proof).
87+
Benefits compared to `IMDPTarget` include less memory usage and faster computation of the
88+
transition probabilities and value iteration.
9089
91-
[1] TODO: Add reference to paper.
90+
[1] Mathiesen, Frederik Baymler, Sofie Haesaert, and Luca Laurenti. "Scalable control synthesis for stochastic systems via structural IMDP abstractions." arXiv preprint arXiv:2411.11803 (2024).
9291
"""
9392
struct MixtureIMDPTarget <: AbstractMixtureIMDPTarget end
9493

0 commit comments

Comments
 (0)