Skip to content

Commit

Permalink
NaiveAbstraction renaming (#341)
Browse files Browse the repository at this point in the history
* NaiveAbstraction -> ClassicalAbstraction

* ClassicalAbstraction -> UniformGridAbstraction
  • Loading branch information
adrienbanse authored Mar 30, 2024
1 parent a33cfe4 commit 993cce6
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 32 deletions.
4 changes: 2 additions & 2 deletions docs/src/examples/solvers/DC-DC converter.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Test #src
# # Example: DC-DC converter solved by [Naive abstraction](https://github.com/dionysos-dev/Dionysos.jl/blob/master/docs/src/manual/manual.md#solvers).
# # Example: DC-DC converter solved by [Uniform grid abstraction](https://github.com/dionysos-dev/Dionysos.jl/blob/master/docs/src/manual/manual.md#solvers).
#
#md # [![Binder](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/generated/DC-DC converter.ipynb)
#md # [![nbviewer](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/generated/DC-DC converter.ipynb)
Expand Down Expand Up @@ -55,7 +55,7 @@ hu = SVector(1)
input_grid = DO.GridFree(u0, hu)

using JuMP
optimizer = MOI.instantiate(AB.NaiveAbstraction.Optimizer)
optimizer = MOI.instantiate(AB.UniformGridAbstraction.Optimizer)
MOI.set(optimizer, MOI.RawOptimizerAttribute("concrete_problem"), concrete_problem)
MOI.set(optimizer, MOI.RawOptimizerAttribute("state_grid"), state_grid)
MOI.set(optimizer, MOI.RawOptimizerAttribute("input_grid"), input_grid)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/examples/solvers/Path planning.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Test #src
# # Example: Path planning problem solved by [Naive abstraction](https://github.com/dionysos-dev/Dionysos.jl/blob/master/docs/src/manual/manual.md#solvers).
# # Example: Path planning problem solved by [Uniform grid abstraction](https://github.com/dionysos-dev/Dionysos.jl/blob/master/docs/src/manual/manual.md#solvers).
#
#md # [![Binder](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/generated/Path planning.ipynb)
#md # [![nbviewer](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/generated/Path planning.ipynb)
Expand Down Expand Up @@ -65,10 +65,10 @@ u0 = SVector(0.0, 0.0);
h = SVector(0.3, 0.3);
input_grid = DO.GridFree(u0, h);

# We now solve the optimal control problem with the `Abstraction.NaiveAbstraction.Optimizer`.
# We now solve the optimal control problem with the `Abstraction.UniformGridAbstraction.Optimizer`.

using JuMP
optimizer = MOI.instantiate(AB.NaiveAbstraction.Optimizer)
optimizer = MOI.instantiate(AB.UniformGridAbstraction.Optimizer)
MOI.set(optimizer, MOI.RawOptimizerAttribute("concrete_problem"), concrete_problem)
MOI.set(optimizer, MOI.RawOptimizerAttribute("state_grid"), state_grid)
MOI.set(optimizer, MOI.RawOptimizerAttribute("input_grid"), input_grid)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/manual/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The following tables summarize the different solvers.

| Type | Full vs partial discretization | Partition vs Cover | Shape | Local controller | Abstraction | System | Reference |
| :--------------- | :---------- | :---------- | :---------- | :---------- | :---------- | :---------- | :---------- |
| [`Naive abstraction`](https://dionysos-dev.github.io/Dionysos.jl/dev/reference/Optim/#Dionysos.Optim.Abstraction.NaiveAbstraction.Optimizer) | Full | Partition | Hyperrectangle | Piece-wise constant | Non-determinisitic | Continuous-time | [`SCOTS: A Tool for the Synthesis of Symbolic Controllers`](https://dl.acm.org/doi/abs/10.1145/2883817.2883834) |
| [`Uniform grid abstraction`](https://dionysos-dev.github.io/Dionysos.jl/dev/reference/Optim/#Dionysos.Optim.Abstraction.UniformGridAbstraction.Optimizer) | Full | Partition | Hyperrectangle | Piece-wise constant | Non-determinisitic | Continuous-time | [`SCOTS: A Tool for the Synthesis of Symbolic Controllers`](https://dl.acm.org/doi/abs/10.1145/2883817.2883834) |
| [`Lazy abstraction`](https://dionysos-dev.github.io/Dionysos.jl/dev/reference/Optim/#Dionysos.Optim.Abstraction.LazyAbstraction.Optimizer) | Partial | Partition | Hyperrectangle | Piece-wise constant | Non-determinisitic | Continuous-time | [`Alternating simulation on hierarchical abstractions`](https://ieeexplore.ieee.org/abstract/document/9683448/?casa_token=AXyECYU9FdwAAAAA:ERfvlbkORIbfGLbDd42d2K5K9SLVOjl-8kRs9pfp7lMa4QZEv0W4VgzlP8FshBlxXQF4ZQrDuzk) |
| [`Hierarchical abstraction`](https://dionysos-dev.github.io/Dionysos.jl/dev/reference/Optim/#Dionysos.Optim.Abstraction.HierarchicalAbstraction.Optimizer) | Partial | Partition | Hyperrectangle | Piece-wise constant | Non-determinisitic | Continuous-time | [`Alternating simulation on hierarchical abstractions`](https://ieeexplore.ieee.org/abstract/document/9683448/?casa_token=AXyECYU9FdwAAAAA:ERfvlbkORIbfGLbDd42d2K5K9SLVOjl-8kRs9pfp7lMa4QZEv0W4VgzlP8FshBlxXQF4ZQrDuzk) |
| [`Ellipsoid abstraction`](https://dionysos-dev.github.io/Dionysos.jl/dev/reference/Optim/#Dionysos.Optim.Abstraction.EllipsoidsAbstraction.Optimizer) | Full | Cover | Ellipsoid | Piece-wise affine | Determinisitic | Discrete-time affine | [`State-feedback Abstractions for Optimal Control of Piecewise-affine Systems`](https://arxiv.org/abs/2204.00315) |
Expand All @@ -65,7 +65,7 @@ The following tables summarize the different solvers.
**Solver interface**

Each solver is defined by a module which must implement the abstract type [`AbstractOptimizer`](https://jump.dev/MathOptInterface.jl/stable/reference/models/#MathOptInterface.AbstractOptimizer) and the [`Optimize!`](https://jump.dev/MathOptInterface.jl/stable/reference/models/#MathOptInterface.optimize!) function.
For example, for the NaiveAbstraction solver, this structure and function are defined as follows
For example, for the UniformGridAbstraction solver, this structure and function are defined as follows

```julia
using JuMP
Expand Down Expand Up @@ -123,7 +123,7 @@ concrete_system = concrete_problem.system;
Choose the solver you wish to use
```julia
using JuMP
optimizer = MOI.instantiate(AB.NaiveAbstraction.Optimizer)
optimizer = MOI.instantiate(AB.UniformGridAbstraction.Optimizer)
```

Define the solver's meta-parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/src/reference/Optim.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This folder contains all the different (abstraction-based or not) solvers that c

## Abstraction-based solvers
```@docs
Dionysos.Optim.Abstraction.NaiveAbstraction.Optimizer
Dionysos.Optim.Abstraction.UniformGridAbstraction.Optimizer
Dionysos.Optim.Abstraction.EllipsoidsAbstraction.Optimizer
Dionysos.Optim.Abstraction.HierarchicalAbstraction.Optimizer
Dionysos.Optim.Abstraction.LazyAbstraction.Optimizer
Expand Down
2 changes: 1 addition & 1 deletion src/optim/abstraction/abstraction.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Abstraction

include("naive_abstraction.jl")
include("uniform_grid_abstraction.jl")
include("lazy_abstraction.jl")
include("hierarchical_abstraction.jl")
include("ellipsoids_abstraction.jl")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export NaiveAbstraction
export UniformGridAbstraction

module NaiveAbstraction
module UniformGridAbstraction

import Dionysos
const DI = Dionysos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ u0 = SVector(0.0, 0.0)
h = SVector(0.3, 0.3)
input_grid = DO.GridFree(u0, h)

# We now solve the optimal control problem with the `Abstraction.NaiveAbstraction.Optimizer`.
# We now solve the optimal control problem with the `Abstraction.UniformGridAbstraction.Optimizer`.

using JuMP
optimizer = MOI.instantiate(AB.NaiveAbstraction.Optimizer)
optimizer = MOI.instantiate(AB.UniformGridAbstraction.Optimizer)
MOI.set(optimizer, MOI.RawOptimizerAttribute("concrete_problem"), concrete_problem)
MOI.set(optimizer, MOI.RawOptimizerAttribute("state_grid"), state_grid)
MOI.set(optimizer, MOI.RawOptimizerAttribute("input_grid"), input_grid)
Expand All @@ -50,7 +50,7 @@ abstract_problem = MOI.get(optimizer, MOI.RawOptimizerAttribute("abstract_proble
abstract_controller = MOI.get(optimizer, MOI.RawOptimizerAttribute("abstract_controller"))
concrete_controller = MOI.get(optimizer, MOI.RawOptimizerAttribute("concrete_controller"))

@testset "NaiveAbstraction reachability" begin
@testset "UniformGridAbstraction reachability" begin
@test length(abstract_controller.data) == 19400 #src
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ hu = SVector(1)
input_grid = DO.GridFree(u0, hu)

using JuMP
optimizer = MOI.instantiate(AB.NaiveAbstraction.Optimizer)
optimizer = MOI.instantiate(AB.UniformGridAbstraction.Optimizer)
MOI.set(optimizer, MOI.RawOptimizerAttribute("concrete_problem"), concrete_problem)
MOI.set(optimizer, MOI.RawOptimizerAttribute("state_grid"), state_grid)
MOI.set(optimizer, MOI.RawOptimizerAttribute("input_grid"), input_grid)
Expand All @@ -38,7 +38,7 @@ MOI.optimize!(optimizer)
abstract_controller = MOI.get(optimizer, MOI.RawOptimizerAttribute("abstract_controller"))
concrete_controller = MOI.get(optimizer, MOI.RawOptimizerAttribute("concrete_controller"))

@testset "NaiveAbstraction safety" begin
@testset "UniformGridAbstraction safety" begin
@test length(abstract_controller.data) == 893803 #src
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sleep(0.1) # used for good printing
println("Started test")

@testset "Controller" begin
contr = AB.NaiveAbstraction.NewControllerList()
contr = AB.UniformGridAbstraction.NewControllerList()

UT.push_new!(contr, (5, 6))
UT.push_new!(contr, (5, 6))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ println("Started test")
push!(targetlist, SY.get_state_by_xpos(symmodel, pos))
end

contr = AB.NaiveAbstraction.NewControllerList()
AB.NaiveAbstraction.compute_controller_reach!(
contr = AB.UniformGridAbstraction.NewControllerList()
AB.UniformGridAbstraction.compute_controller_reach!(
contr,
symmodel.autom,
initlist,
Expand All @@ -85,14 +85,14 @@ println("Started test")
@test length(contr) == 412
if VERSION >= v"1.5"
function f(autom, initlist, targetlist)
contr = AB.NaiveAbstraction.NewControllerList()
contr = AB.UniformGridAbstraction.NewControllerList()
initset, targetset, num_targets_unreachable, current_targets, next_targets =
AB.NaiveAbstraction._data(contr, autom, initlist, targetlist)
AB.UniformGridAbstraction._data(contr, autom, initlist, targetlist)
# Preallocates to make sure `_compute_controller_reach` does not need to allocate
sizehint!(contr.data, 500)
sizehint!(current_targets, 50)
sizehint!(next_targets, 200)
@allocated AB.NaiveAbstraction._compute_controller_reach!(
@allocated AB.UniformGridAbstraction._compute_controller_reach!(
contr,
autom,
initset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ println("Started test")
push!(safelist, SY.get_state_by_xpos(symmodel, pos))
end

contr = AB.NaiveAbstraction.NewControllerList()
AB.NaiveAbstraction.compute_controller_safe!(contr, symmodel.autom, initlist, safelist)
contr = AB.UniformGridAbstraction.NewControllerList()
AB.UniformGridAbstraction.compute_controller_safe!(
contr,
symmodel.autom,
initlist,
safelist,
)
@test length(contr) == 15043

invlist = Int[]
Expand Down
14 changes: 7 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ include("./symbolic/test_ellipsoidal_transitions.jl")

include("./problem/test_problems.jl")

include("./optim/unit_tests_NaiveAbstraction/test_controller.jl")
include("./optim/unit_tests_NaiveAbstraction/test_controllerreach.jl")
include("./optim/unit_tests_NaiveAbstraction/test_controllersafe.jl")
include("./optim/unit_tests_NaiveAbstraction/test_fromcontrolsystemgrowth.jl")
include("./optim/unit_tests_NaiveAbstraction/test_fromcontrolsystemlinearized.jl")
include("./optim/test_NaiveAbstraction_safety.jl")
include("./optim/test_NaiveAbstraction_reachability.jl")
include("./optim/unit_tests_UniformGridAbstraction/test_controller.jl")
include("./optim/unit_tests_UniformGridAbstraction/test_controllerreach.jl")
include("./optim/unit_tests_UniformGridAbstraction/test_controllersafe.jl")
include("./optim/unit_tests_UniformGridAbstraction/test_fromcontrolsystemgrowth.jl")
include("./optim/unit_tests_UniformGridAbstraction/test_fromcontrolsystemlinearized.jl")
include("./optim/test_UniformGridAbstraction_safety.jl")
include("./optim/test_UniformGridAbstraction_reachability.jl")
include("./optim/test_lazy_abstraction.jl")
include("./optim/test_ellipsoids_abstraction.jl")
include("./optim/test_lazy_ellipsoids_abstraction.jl")
Expand Down

2 comments on commit 993cce6

@adrienbanse
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Version 0.1.0 already exists

Please sign in to comment.