Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/problem and src/optim organization improvements #229

Merged
merged 6 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/src/examples/DC-DC converter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const ST = DI.System
const SY = DI.Symbolic
const CO = DI.Control
const OP = DI.Optim
const AB = OP.Abstraction

# ### Definition of the system
# we can import the module containing the DCDC problem like this
Expand All @@ -65,7 +66,7 @@ hu = SVector(1)
input_grid = DO.GridFree(u0, hu)

using JuMP
optimizer = MOI.instantiate(OP.Abstraction.Optimizer)
optimizer = MOI.instantiate(AB.SCOTSAbstraction.Optimizer)
MOI.set(optimizer, MOI.RawOptimizerAttribute("problem"), problem)
MOI.set(optimizer, MOI.RawOptimizerAttribute("state_grid"), state_grid)
MOI.set(optimizer, MOI.RawOptimizerAttribute("input_grid"), input_grid)
Expand Down
21 changes: 11 additions & 10 deletions docs/src/examples/Path planning.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ using StaticArrays, Plots
using Dionysos
const DI = Dionysos
const DO = DI.Domain
const OP = DI.Optim
const CO = DI.Control
const UT = DI.Utils
const OP = DI.Optim
const AB = OP.Abstraction

# And the file defining the hybrid system for this problem
include(joinpath(dirname(dirname(pathof(Dionysos))), "problems", "PathPlanning.jl"))
Expand All @@ -73,10 +74,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.Optimizer`.
# We now solve the optimal control problem with the `Abstraction.SCOTSAbstraction.Optimizer`.

using JuMP
optimizer = MOI.instantiate(OP.Abstraction.Optimizer)
optimizer = MOI.instantiate(AB.SCOTSAbstraction.Optimizer)
MOI.set(optimizer, MOI.RawOptimizerAttribute("problem"), problem)
MOI.set(optimizer, MOI.RawOptimizerAttribute("state_grid"), state_grid)
MOI.set(optimizer, MOI.RawOptimizerAttribute("input_grid"), input_grid)
Expand Down Expand Up @@ -105,18 +106,18 @@ fig = plot(aspect_ratio=:equal);
##We display the concrete domain
plot!(problem.system.X, color=:yellow, opacity=0.5);

##We display the abstract domain
abstract_system = OP.Abstraction.get_abstract_system(optimizer)
plot!(abstract_system.Xdom, color=:blue, opacity=0.5);
# We display the abstract domain
abstract_system = AB.SCOTSAbstraction.get_abstract_system(optimizer)
plot!(abstract_system.Xdom, color=:blue, opacity=0.5)

##We display the concrete specifications
plot!(problem.initial_set, color=:green, opacity=0.2);
plot!(problem.target_set; dims=[1,2], color=:red, opacity=0.2);

##We display the abstract specifications
abstract_problem = OP.Abstraction.get_abstract_problem(optimizer)
plot!(abstract_problem.initial_set, color=:green);
plot!(abstract_problem.target_set, color=:red);
# We display the abstract specifications
abstract_problem = AB.SCOTSAbstraction.get_abstract_problem(optimizer)
plot!(abstract_problem.initial_set, color=:green)
plot!(abstract_problem.target_set, color=:red)

##We display the concrete trajectory
plot!(fig, UT.DrawTrajectory(x_traj), ms=0.5)
Expand Down
8 changes: 5 additions & 3 deletions docs/src/examples/State-feedback Abstraction PWA System.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const SY = DI.Symbolic
const CO = DI.Control
const PR = DI.Problem
const OP = DI.Optim
const AB = OP.Abstraction

# Let us now define the state space $X$ within which we are searching for a optimal solution.
max_x = 2 # bound on |X|_∞
Expand All @@ -97,13 +98,14 @@ X_origin = SVector(0.0, 0.0);
X_step = SVector(1.0/n_step, 1.0/n_step);
P = (1/n_x)*diagm((X_step./2).^(-2))

state_grid = DO.GridEllipsoidalRectangular(X_origin, X_step, P, rectX)
state_grid = DO.Grid
soidalRectangular(X_origin, X_step, P, rectX)
Copy link
Collaborator

Choose a reason for hiding this comment

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

the error is here


# At this point, we instantiate the optimizer provided in Dionysos that creates ellipsoidal-based
# abstractions `OptimizerEllipsoids`
# abstractions `EllipsoidsAbstraction.Optimizer`

using JuMP
optimizer = MOI.instantiate(OP.Abstraction.OptimizerEllipsoids) #
optimizer = MOI.instantiate(AB.EllipsoidsAbstraction.Optimizer) #

MOI.set(optimizer, MOI.RawOptimizerAttribute("problem"), problem)
MOI.set(optimizer, MOI.RawOptimizerAttribute("state_grid"), state_grid)
Expand Down
Loading