Skip to content

Commit

Permalink
Merge pull request #36 from control-toolbox/30-create-optimalcontrols…
Browse files Browse the repository at this point in the history
…olution

flow from ocp returns an OptimalControlSolution
  • Loading branch information
ocots authored Aug 5, 2024
2 parents bf38b92 + bf00c4c commit 6d5743a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 50 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"

[weakdeps]
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

[extensions]
CTFlowsODE = "OrdinaryDiffEq"
CTFlowsPlots = "Plots"

[compat]
CTBase = "0.11"
Expand Down
41 changes: 0 additions & 41 deletions ext/CTFlowsPlots.jl

This file was deleted.

3 changes: 0 additions & 3 deletions src/CTFlows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ module CTFlows
global default_algorithm = alg
nothing
end
#CTFlows.plot(sol::OptimalControlFlowSolution, args...; kwargs...) = throw(ExtensionError("Please make: julia> using Plots"))
#CTFlows.plot!(p, sol::OptimalControlFlowSolution, args...; kwargs...) = throw(ExtensionError("Please make: julia> using Plots"))

#
include("default.jl")
Expand All @@ -43,7 +41,6 @@ module CTFlows
export Hamiltonian
export HamiltonianLift
export HamiltonianVectorField
#export plot, plot!
export Flow
export *

Expand Down
8 changes: 4 additions & 4 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ end
F.f(args...; jumps=F.jumps, _t_stops_interne=F.tstops, DiffEqRHS=F.rhs!, kwargs...)
end

# call F.f and then, construct a solution which contains all the need information for plotting
# it is a Hamiltonian usage
# call F.f and then, construct an optimal control solution
function (F::OptimalControlFlow)(tspan::Tuple{Time,Time}, x0::State, p0::Costate, v::Variable=__variable(); kwargs...)
ode_sol = F.f(tspan, x0, p0, v; jumps=F.jumps, _t_stops_interne=F.tstops, DiffEqRHS=F.rhs!, kwargs...)
return OptimalControlFlowSolution(ode_sol, F.feedback_control, F.ocp, v)
ode_sol = F.f(tspan, x0, p0, v; jumps=F.jumps, _t_stops_interne=F.tstops, DiffEqRHS=F.rhs!, kwargs...)
flow_sol = OptimalControlFlowSolution(ode_sol, F.feedback_control, F.ocp, v)
return CTFlows.OptimalControlSolution(flow_sol)
end

0 comments on commit 6d5743a

Please sign in to comment.