Skip to content

Commit 757cc41

Browse files
authored
Merge pull request #53 from SciML/structure-renames
Rename `UnstructuredNeuralLyapunov` and `NonnegativeNeuralLyapunov` to `NoAdditionalStructure` and `NonnegativeStructure`, respectively.
2 parents 9fa2ddd + 993cae7 commit 757cc41

8 files changed

+18
-17
lines changed

docs/src/demos/damped_SHO.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ strategy = QuasiRandomTraining(1000)
5656
discretization = PhysicsInformedNN(chain, strategy; init_params = ps)
5757

5858
# Define neural Lyapunov structure
59-
structure = NonnegativeNeuralLyapunov(
59+
structure = NonnegativeStructure(
6060
dim_output;
6161
δ = 1e-6
6262
)
@@ -179,7 +179,7 @@ To train for exponential stability we use [`ExponentialStability`](@ref), but we
179179
using NeuralLyapunov
180180
181181
# Define neural Lyapunov structure
182-
structure = NonnegativeNeuralLyapunov(
182+
structure = NonnegativeStructure(
183183
dim_output;
184184
δ = 1e-6
185185
)

docs/src/man/structure.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ Three simple neural Lyapunov function structures are provided, but users can alw
44

55
## Pre-defined structures
66

7-
The simplest structure is to train the neural network directly to be the Lyapunov function, which can be accomplished using an [`UnstructuredNeuralLyapunov`](@ref).
7+
The simplest structure is to train the neural network directly to be the Lyapunov function, which can be accomplished using an [`NoAdditionalStructure`](@ref).
88

99
```@docs
10-
UnstructuredNeuralLyapunov
10+
NoAdditionalStructure
1111
```
1212

1313
The condition that the Lyapunov function ``V(x)`` must be minimized uniquely at the fixed point ``x_0`` is often represented as a requirement for ``V(x)`` to be positive away from the fixed point and zero at the fixed point.
1414
Put mathematically, it is sufficient to require ``V(x) > 0 \, \forall x \ne x_0`` and ``V(x_0) = 0``.
1515
We call such functions positive definite (around the fixed point ``x_0``).
1616

17-
Two structures are provided which partially or fully enforce the minimization condition: [`NonnegativeNeuralLyapunov`](@ref), which structurally enforces ``V(x) \ge 0`` everywhere, and [`PositiveSemiDefiniteStructure`](@ref), which additionally enforces ``V(x_0) = 0``.
17+
Two structures are provided which partially or fully enforce the minimization condition: [`NonnegativeStructure`](@ref), which structurally enforces ``V(x) \ge 0`` everywhere, and [`PositiveSemiDefiniteStructure`](@ref), which additionally enforces ``V(x_0) = 0``.
1818

1919
```@docs
20-
NonnegativeNeuralLyapunov
20+
NonnegativeStructure
2121
PositiveSemiDefiniteStructure
2222
```
2323

src/NeuralLyapunov.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ include("policy_search.jl")
3232
include("benchmark_harness.jl")
3333

3434
# Lyapunov function structures
35-
export NeuralLyapunovStructure, UnstructuredNeuralLyapunov, NonnegativeNeuralLyapunov,
35+
export NeuralLyapunovStructure, NoAdditionalStructure, NonnegativeStructure,
3636
PositiveSemiDefiniteStructure, get_numerical_lyapunov_function
3737

3838
# Minimization conditions

src/minimization_conditions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ has been structurally enforced.
130130
131131
Even in this case, it is still possible to check for ``V(x_0) = 0``, for example if `V` is
132132
structured to be positive for ``x ≠ x_0`` but does not guarantee ``V(x_0) = 0`` (such as
133-
[`NonnegativeNeuralLyapunov`](@ref)). `check_fixed_point` defaults to `true`, since in cases
133+
[`NonnegativeStructure`](@ref)). `check_fixed_point` defaults to `true`, since in cases
134134
where ``V(x_0) = 0`` is enforced structurally, the equation will reduce to `0.0 ~ 0.0`,
135135
which gets automatically removed in most cases.
136136
"""

src/structure_specification.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
"""
2-
UnstructuredNeuralLyapunov()
2+
NoAdditionalStructure()
33
44
Create a [`NeuralLyapunovStructure`](@ref) where the Lyapunov function is the neural network
5-
evaluated at the state. This does not structurally enforce any Lyapunov conditions.
5+
evaluated at the state. This does impose any additional structure to enforce any Lyapunov
6+
conditions.
67
78
Corresponds to ``V(x) = ϕ(x)``, where ``ϕ`` is the neural network.
89
910
Dynamics are assumed to be in `f(state, p, t)` form, as in an `ODEFunction`. For
1011
`f(state, input, p, t)`, consider using [`add_policy_search`](@ref).
1112
"""
12-
function UnstructuredNeuralLyapunov()::NeuralLyapunovStructure
13+
function NoAdditionalStructure()::NeuralLyapunovStructure
1314
NeuralLyapunovStructure(
1415
(net, state, fixed_point) -> net(state),
1516
(net, grad_net, f, state, params, t, fixed_point) -> grad_net(state)
@@ -20,7 +21,7 @@ function UnstructuredNeuralLyapunov()::NeuralLyapunovStructure
2021
end
2122

2223
"""
23-
NonnegativeNeuralLyapunov(network_dim; <keyword_arguments>)
24+
NonnegativeStructure(network_dim; <keyword_arguments>)
2425
2526
Create a [`NeuralLyapunovStructure`](@ref) where the Lyapunov function is the L2 norm of the
2627
neural network output plus a constant δ times a function `pos_def`.
@@ -53,7 +54,7 @@ Dynamics are assumed to be in `f(state, p, t)` form, as in an `ODEFunction`. For
5354
5455
See also: [`DontCheckNonnegativity`](@ref)
5556
"""
56-
function NonnegativeNeuralLyapunov(
57+
function NonnegativeStructure(
5758
network_dim::Integer;
5859
δ::Real = 0.0,
5960
pos_def::Function = (state, fixed_point) -> log(1.0 +

test/benchmark.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using Test
4040
strategy = QuasiRandomTraining(1000)
4141

4242
# Define neural Lyapunov structure
43-
structure = NonnegativeNeuralLyapunov(
43+
structure = NonnegativeStructure(
4444
dim_output;
4545
δ = 1e-6
4646
)

test/damped_sho.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ strategy = QuasiRandomTraining(1000)
4141
discretization = PhysicsInformedNN(chain, strategy; init_params = ps)
4242

4343
# Define neural Lyapunov structure
44-
structure = NonnegativeNeuralLyapunov(
44+
structure = NonnegativeStructure(
4545
dim_output;
4646
δ = 5.0
4747
)

test/damped_sho_CUDA.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ strategy = QuasiRandomTraining(2500)
4141
discretization = PhysicsInformedNN(chain, strategy; init_params = ps)
4242

4343
# Define neural Lyapunov structure
44-
structure = UnstructuredNeuralLyapunov()
44+
structure = NoAdditionalStructure()
4545
minimization_condition = StrictlyPositiveDefinite(C = 0.1)
4646

4747
# Define Lyapunov decrease condition
@@ -101,7 +101,7 @@ V̇_samples = V̇_samples_gpu |> cpud
101101

102102
#################################### Tests ####################################
103103

104-
# Network structure should enforce nonegativeness of V
104+
# Network structure should enforce nonnegativeness of V
105105
V0 = (V(fixed_point) |> cpud)[]
106106
V_min, i_min = findmin(V_samples)
107107
state_min = collect(states)[i_min]

0 commit comments

Comments
 (0)