-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#58 - added abstract type hierarchy skeleton
- Loading branch information
Showing
20 changed files
with
231 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export Box | ||
|
||
""" | ||
Box{N<:Real} <: PointSymmetric_Polytopic{N} | ||
Abstract type for box-shaped sets. | ||
### Notes | ||
Every concrete `Box` must define the following functions: | ||
- `radius(::Box{N})::Vector{N}` -- return the full-dimensional radius | ||
- `radius(::Box{N}, i::Int)::N` -- return the radius entry in the `i`-th | ||
dimension | ||
```jldoctest | ||
subtypes(Box) | ||
3-element Array{Union{DataType, UnionAll},1}: | ||
LazySets.BallInf | ||
LazySets.Hyperrectangle | ||
LazySets.SingleSet | ||
``` | ||
""" | ||
abstract type Box{N<:Real} <: PointSymmetric_Polytopic{N} end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export HPolygonal | ||
|
||
""" | ||
HPolygonal{N<:Real} <: Polygonal{N} | ||
Abstract type for polygons in H-representation (i.e., constraints). | ||
### Notes | ||
Every concrete `HPolygonal` must define the following functions: | ||
- `TODO()` | ||
```jldoctest | ||
subtypes(HPolygonal) | ||
2-element Array{Union{DataType, UnionAll},1}: | ||
LazySets.HPolygon | ||
LazySets.HPolygonOpt | ||
``` | ||
""" | ||
abstract type HPolygonal{N<:Real} <: Polygonal{N} end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export PointSymmetric | ||
|
||
""" | ||
PointSymmetric{N<:Real} <: LazySet | ||
Abstract type for point symmetric sets. | ||
### Notes | ||
Every concrete `PointSymmetric` must define the following functions: | ||
- `center(::PointSymmetric{N})::Vector{N}` -- return the center point | ||
```jldoctest | ||
subtypes(PointSymmetric) | ||
3-element Array{Union{DataType, UnionAll},1}: | ||
LazySets.Ball2 | ||
LazySets.Ballp | ||
LazySets.PointSymmetric_Polytopic | ||
``` | ||
""" | ||
abstract type PointSymmetric{N<:Real} <: LazySet end | ||
|
||
|
||
""" | ||
dim(S::PointSymmetric)::Int | ||
Return the ambient dimension of a point symmetric, polytopic set. | ||
### Input | ||
- `S` -- set | ||
### Output | ||
The ambient dimension of the set. | ||
""" | ||
@inline function dim(S::PointSymmetric)::Int | ||
return length(center(S)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export PointSymmetric_Polytopic | ||
|
||
""" | ||
PointSymmetric_Polytopic{N<:Real} <: PointSymmetric{N} | ||
Abstract type for point symmetric, polytopic sets. | ||
It combines the `PointSymmetric` and `Polytopic` abstract types. | ||
Such a type combination is necessary as long as Julia does not support | ||
[multiple inheritance](https://github.com/JuliaLang/julia/issues/5). | ||
This type arbitrarily inherits from `PointSymmetric`. | ||
### Notes | ||
Every concrete `PointSymmetric_Polytopic` must define the following functions | ||
from `Polytopic`: | ||
- `vertices_list(::PointSymmetric_Polytopic{N})::Vector{Vector{N}}` -- return a | ||
list of all vertices | ||
```jldoctest | ||
subtypes(PointSymmetric_Polytopic) | ||
3-element Array{Union{DataType, UnionAll},1}: | ||
LazySets.Ball1 | ||
LazySets.Box | ||
LazySets.Zonotope | ||
``` | ||
""" | ||
abstract type PointSymmetric_Polytopic{N<:Real} <: PointSymmetric{N} end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export Polygonal | ||
|
||
""" | ||
Polygonal{N<:Real} <: Polytopic{N} | ||
Abstract type for polygons (i.e., 2D polytopes). | ||
### Notes | ||
Every concrete `Polygonal` must define the following functions: | ||
- `tovrep(::Polygonal{N})::VPolygon{N}` -- transform into V-representation | ||
- `tohrep(::Polygonal{N})::HPolygonal{N}` -- transform into H-representation | ||
```jldoctest | ||
subtypes(Polygonal) | ||
2-element Array{Union{DataType, UnionAll},1}: | ||
LazySets.HPolygonal | ||
LazySets.VPolygon | ||
``` | ||
""" | ||
abstract type Polygonal{N<:Real} <: Polytopic{N} end | ||
|
||
|
||
""" | ||
dim(P::Polygonal)::Int | ||
Return the ambient dimension of a polygon. | ||
### Input | ||
- `P` -- polygon | ||
### Output | ||
The ambient dimension of the polygon, which is 2. | ||
""" | ||
@inline function dim(P::Polygonal)::Int | ||
return 2 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export Polytopic | ||
|
||
""" | ||
Polytopic{N<:Real} <: LazySet | ||
Abstract type for polytopic sets, i.e., sets with finitely many flat facets, or | ||
equivalently, sets defined as an intersection of a finite number of halfspaces, | ||
or equivalently, sets with finitely many vertices. | ||
### Notes | ||
Every concrete `Polytopic` must define the following functions: | ||
- `vertices_list(::Polytopic{N})::Vector{Vector{N}}` -- return a list of all | ||
vertices | ||
```jldoctest | ||
subtypes(Polytopic) | ||
1-element Array{Union{DataType, UnionAll},1}: | ||
LazySets.Polygonal | ||
``` | ||
""" | ||
abstract type Polytopic{N<:Real} <: LazySet end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export SingleSet | ||
|
||
""" | ||
SingleSet{N<:Real} <: Box{N} | ||
Abstract type for sets with a single value. | ||
### Notes | ||
Every concrete `SingleSet` must define the following functions: | ||
- `element(::SingleSet{N})::Vector{N}` -- return the single element | ||
- `element(::SingleSet{N}, i::Int)::N` -- return the single element's entry in | ||
the `i`-th dimension | ||
```jldoctest | ||
subtypes(SingleSet) | ||
2-element Array{Union{DataType, UnionAll},1}: | ||
LazySets.Singleton | ||
LazySets.ZeroSet | ||
``` | ||
""" | ||
abstract type SingleSet{N<:Real} <: Box{N} end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.