Skip to content

Commit 07d473b

Browse files
authored
Merge pull request #724 from control-toolbox/auto-juliaformatter-pr
[AUTO] JuliaFormatter.jl run
2 parents e9f0068 + da1f1dd commit 07d473b

61 files changed

Lines changed: 1877 additions & 1475 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.save/src/modelers.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# To trigger CTDirectExtADNLP and CTDirectExtExa
22
using ADNLPModels: ADNLPModels
33

4-
import ExaModels:
5-
ExaModels #,
4+
import ExaModels: ExaModels #,
65
# ExaModel,
76
# ExaCore,
87
# variable,
@@ -81,4 +80,4 @@ import ExaModels:
8180
# """
8281
# objective(sol::Solution) = CTModels.objective(sol)
8382

84-
# export variable, constraint, objective
83+
# export variable, constraint, objective

.save/src/solve.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,11 @@ function _ensure_no_ambiguous_description_kwargs(method::Tuple, kwargs::NamedTup
424424
owners = Symbol[]
425425

426426
if (k in _SOLVE_INITIAL_GUESS_ALIASES) ||
427-
(k in _SOLVE_DISCRETIZER_ALIASES) ||
428-
(k in _SOLVE_MODELER_ALIASES) ||
429-
(k in _SOLVE_SOLVER_ALIASES) ||
430-
(k in _SOLVE_DISPLAY_ALIASES) ||
431-
(k in _SOLVE_MODELER_OPTIONS_ALIASES)
427+
(k in _SOLVE_DISCRETIZER_ALIASES) ||
428+
(k in _SOLVE_MODELER_ALIASES) ||
429+
(k in _SOLVE_SOLVER_ALIASES) ||
430+
(k in _SOLVE_DISPLAY_ALIASES) ||
431+
(k in _SOLVE_MODELER_OPTIONS_ALIASES)
432432
push!(owners, :solve)
433433
end
434434

@@ -511,9 +511,7 @@ function _solve_from_components_and_description(
511511
)
512512
end
513513

514-
function _solve_explicit_mode(
515-
ocp::CTModels.AbstractModel, parsed::_ParsedTopLevelKwargs
516-
)
514+
function _solve_explicit_mode(ocp::CTModels.AbstractModel, parsed::_ParsedTopLevelKwargs)
517515
# 1. No modeler_options in explicit mode
518516
if parsed.modeler_options !== nothing
519517
msg = "modeler_options is not allowed in explicit mode; pass a modeler instance instead."

.save/test/extras/check_ownership.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ modules = [
1717
(:CTFlows, CTFlows),
1818
(:CTModels, CTModels),
1919
(:CTParser, CTParser),
20-
(:OptimalControl, OptimalControl)
20+
(:OptimalControl, OptimalControl),
2121
]
2222

2323
println("Checking symbol: :$(sym_to_check)")

.save/test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ include(joinpath(@__DIR__, "problems", "goddard.jl"))
4949
@testset verbose = VERBOSE showtiming = SHOWTIMING "Optimal control tests" begin
5050
include(joinpath(@__DIR__, "test_optimalcontrol_solve_api.jl"))
5151
test_optimalcontrol_solve_api()
52-
end
52+
end

.save/test/test_optimalcontrol_solve_api.jl

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ function test_optimalcontrol_solve_api()
104104
# _modeler_options_keys / _solver_options_keys should match options_keys
105105
method_ad_ip = (:collocation, :adnlp, :ipopt)
106106
Test.@test Set(OptimalControl._modeler_options_keys(method_ad_ip)) ==
107-
Set(CTModels.options_keys(OptimalControl.ADNLP))
107+
Set(CTModels.options_keys(OptimalControl.ADNLP))
108108
Test.@test Set(OptimalControl._solver_options_keys(method_ad_ip)) ==
109-
Set(CTModels.options_keys(OptimalControl.Ipopt))
109+
Set(CTModels.options_keys(OptimalControl.Ipopt))
110110

111111
method_exa_mad = (:collocation, :exa, :madnlp)
112112
Test.@test Set(OptimalControl._modeler_options_keys(method_exa_mad)) ==
113-
Set(CTModels.options_keys(OptimalControl.Exa))
113+
Set(CTModels.options_keys(OptimalControl.Exa))
114114
Test.@test Set(OptimalControl._solver_options_keys(method_exa_mad)) ==
115-
Set(CTModels.options_keys(OptimalControl.MadNLP))
115+
Set(CTModels.options_keys(OptimalControl.MadNLP))
116116

117117
# Multiple symbols of the same family in a method should raise an error
118118
Test.@test_throws OptimalControl.IncorrectArgument OptimalControl._get_modeler_symbol((
@@ -147,11 +147,12 @@ function test_optimalcontrol_solve_api()
147147
# Modeler options normalization helper
148148
Test.@test OptimalControl._normalize_modeler_options(nothing) === NamedTuple()
149149
Test.@test OptimalControl._normalize_modeler_options((backend=:manual,)) ==
150-
(backend=:manual,)
150+
(backend=:manual,)
151151
Test.@test OptimalControl._normalize_modeler_options((; backend=:manual)) ==
152-
(backend=:manual,)
152+
(backend=:manual,)
153153

154-
Test.@testset "description ambiguity pre-check (ownerless key)" verbose = VERBOSE showtiming = SHOWTIMING begin
154+
Test.@testset "description ambiguity pre-check (ownerless key)" verbose = VERBOSE showtiming =
155+
SHOWTIMING begin
155156
method = (:collocation, :adnlp, :ipopt)
156157

157158
# foo does not correspond to any tool nor to solve -> error
@@ -189,7 +190,9 @@ function test_optimalcontrol_solve_api()
189190
owners_amb = Symbol[:discretizer, :solver]
190191
err = nothing
191192
try
192-
OptimalControl._route_option_for_description(:foo, 1.0, owners_amb, :description)
193+
OptimalControl._route_option_for_description(
194+
:foo, 1.0, owners_amb, :description
195+
)
193196
catch e
194197
err = e
195198
end
@@ -255,7 +258,8 @@ function test_optimalcontrol_solve_api()
255258
))
256259
end
257260

258-
Test.@testset "description-mode solve/tool disambiguation" verbose = VERBOSE showtiming = SHOWTIMING begin
261+
Test.@testset "description-mode solve/tool disambiguation" verbose = VERBOSE showtiming =
262+
SHOWTIMING begin
259263
init = OCDummyInit([1.0, 2.0])
260264

261265
# 1) Alias i tagged :solve -> used as initial_guess, not kept in other_kwargs
@@ -298,7 +302,8 @@ function test_optimalcontrol_solve_api()
298302
end
299303
end
300304

301-
Test.@testset "explicit-mode solve kwarg aliases" verbose = VERBOSE showtiming = SHOWTIMING begin
305+
Test.@testset "explicit-mode solve kwarg aliases" verbose = VERBOSE showtiming =
306+
SHOWTIMING begin
302307
prob = OCDummyOCP()
303308
init = OCDummyInit([1.0, 2.0])
304309

@@ -390,7 +395,8 @@ function test_optimalcontrol_solve_api()
390395
# Unit test: solve(ocp, init, discretizer, modeler, solver)
391396
# ========================================================================
392397

393-
Test.@testset "solve(ocp, init, discretizer, modeler, solver)" verbose = VERBOSE showtiming = SHOWTIMING begin
398+
Test.@testset "solve(ocp, init, discretizer, modeler, solver)" verbose = VERBOSE showtiming =
399+
SHOWTIMING begin
394400
prob = OCDummyOCP()
395401
init = OCDummyInit([1.0, 2.0])
396402

@@ -558,7 +564,8 @@ function test_optimalcontrol_solve_api()
558564
# OCP level with @init (Ipopt, ADNLP)
559565
# ------------------------------------------------------------------
560566

561-
Test.@testset "OCP level with @init (Ipopt, ADNLP)" verbose = VERBOSE showtiming = SHOWTIMING begin
567+
Test.@testset "OCP level with @init (Ipopt, ADNLP)" verbose = VERBOSE showtiming =
568+
SHOWTIMING begin
562569
init_macro = OptimalControl.@init ocp begin
563570
x := [0.05, 0.1]
564571
u := 0.1
@@ -577,7 +584,8 @@ function test_optimalcontrol_solve_api()
577584
# OCP level: keyword-based API solve(ocp; ...)
578585
# ------------------------------------------------------------------
579586

580-
Test.@testset "OCP level keyword API (Ipopt, ADNLP)" verbose = VERBOSE showtiming = SHOWTIMING begin
587+
Test.@testset "OCP level keyword API (Ipopt, ADNLP)" verbose = VERBOSE showtiming =
588+
SHOWTIMING begin
581589
modeler = OptimalControl.ADNLP(; backend=:manual)
582590
solver = OptimalControl.Ipopt(; ipopt_options...)
583591
sol = solve(
@@ -608,7 +616,8 @@ function test_optimalcontrol_solve_api()
608616
]
609617

610618
for (method_syms, options) in desc_cases
611-
Test.@testset "description = $(method_syms)" verbose = VERBOSE showtiming = SHOWTIMING begin
619+
Test.@testset "description = $(method_syms)" verbose = VERBOSE showtiming =
620+
SHOWTIMING begin
612621
sol = solve(
613622
ocp, method_syms...; initial_guess=init, display=false, options...
614623
)
@@ -628,7 +637,8 @@ function test_optimalcontrol_solve_api()
628637

629638
# modeler_options is allowed in description mode and forwarded to the
630639
# modeler constructor.
631-
Test.@testset "description API with modeler_options" verbose = VERBOSE showtiming = SHOWTIMING begin
640+
Test.@testset "description API with modeler_options" verbose = VERBOSE showtiming =
641+
SHOWTIMING begin
632642
sol = solve(
633643
ocp,
634644
:collocation,
@@ -645,7 +655,8 @@ function test_optimalcontrol_solve_api()
645655

646656
# Tagged options using the (value, tool) convention: discretizer options
647657
# are explicitly routed to the discretizer, and Ipopt options to the solver.
648-
Test.@testset "description API with explicit tool tags" verbose = VERBOSE showtiming = SHOWTIMING begin
658+
Test.@testset "description API with explicit tool tags" verbose = VERBOSE showtiming =
659+
SHOWTIMING begin
649660
sol = solve(
650661
ocp,
651662
:collocation,
@@ -739,7 +750,8 @@ function test_optimalcontrol_solve_api()
739750
# OCP level keyword API (Ipopt, ADNLP)
740751
# ------------------------------------------------------------------
741752

742-
Test.@testset "OCP level keyword API (Ipopt, ADNLP)" verbose = VERBOSE showtiming = SHOWTIMING begin
753+
Test.@testset "OCP level keyword API (Ipopt, ADNLP)" verbose = VERBOSE showtiming =
754+
SHOWTIMING begin
743755
modeler = OptimalControl.ADNLP(; backend=:manual)
744756
solver = OptimalControl.Ipopt(; ipopt_options...)
745757
sol = solve(
@@ -770,7 +782,8 @@ function test_optimalcontrol_solve_api()
770782
]
771783

772784
for (method_syms, options) in desc_cases
773-
Test.@testset "description = $(method_syms)" verbose = VERBOSE showtiming = SHOWTIMING begin
785+
Test.@testset "description = $(method_syms)" verbose = VERBOSE showtiming =
786+
SHOWTIMING begin
774787
sol = solve(
775788
ocp_g,
776789
method_syms...;
@@ -793,4 +806,4 @@ function test_optimalcontrol_solve_api()
793806
end
794807
end
795808
end
796-
end
809+
end

docs/api_reference.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ function generate_api_reference(src_dir::String, ext_dir::String)
2323
EXCLUDE_SYMBOLS = Symbol[:include, :eval]
2424

2525
pages = [
26-
2726
CTBase.automatic_reference_documentation(;
2827
subdirectory="api",
2928
primary_modules=[
@@ -52,7 +51,6 @@ function generate_api_reference(src_dir::String, ext_dir::String)
5251
title_in_menu="Private",
5352
filename="private",
5453
),
55-
5654
]
5755

5856
return pages
@@ -88,4 +86,4 @@ function _cleanup_pages(docs_src::String, pages)
8886
_cleanup_pages(docs_src, val)
8987
end
9088
end
91-
end
89+
end

docs/doc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ Pkg.rm("OptimalControl")
4646

4747
println("✅ Documentation generated successfully!")
4848
println("📖 Documentation available at: $(joinpath(docs_dir, "build", "index.html"))")
49-
println("🗂️ OptimalControl removed from docs/Project.toml")
49+
println("🗂️ OptimalControl removed from docs/Project.toml")

docs/make.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ Draft = false
150150
=#
151151
draft = true # Draft mode: if true, @example blocks in markdown are not executed
152152

153-
154153
# ═══════════════════════════════════════════════════════════════════════════════
155154
# Load extensions
156155
# ═══════════════════════════════════════════════════════════════════════════════
@@ -179,7 +178,7 @@ with_api_reference(src_dir, ext_dir) do api_pages
179178
api_pages_final = copy(api_pages)
180179
pushfirst!(api_pages_final, "Public" => joinpath("api", "public.md"))
181180
push!(api_pages_final, "Subpackages" => joinpath("api", "subpackages.md"))
182-
181+
183182
# build documentation
184183
makedocs(;
185184
draft=draft,
@@ -195,8 +194,7 @@ with_api_reference(src_dir, ext_dir) do api_pages
195194
"assets/custom.css",
196195
],
197196
size_threshold_ignore=[
198-
joinpath("api", "private.md"),
199-
joinpath("api", "public.md"),
197+
joinpath("api", "private.md"), joinpath("api", "public.md")
200198
],
201199
),
202200
pages=[
@@ -226,4 +224,4 @@ with_api_reference(src_dir, ext_dir) do api_pages
226224
end
227225

228226
# ═══════════════════════════════════════════════════════════════════════════════
229-
deploydocs(; repo=repo_url * ".git", devbranch="main")
227+
deploydocs(; repo=repo_url * ".git", devbranch="main")

src/OptimalControl.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ module OptimalControl
5353
using DocStringExtensions
5454
using Reexport
5555

56-
import CommonSolve
56+
using CommonSolve: CommonSolve
5757
@reexport import CommonSolve: solve
58-
import CTBase
59-
import CTModels
60-
import CTDirect
61-
import CTSolvers
58+
using CTBase: CTBase
59+
using CTModels: CTModels
60+
using CTDirect: CTDirect
61+
using CTSolvers: CTSolvers
6262

6363
# Imports
6464
include(joinpath(@__DIR__, "imports", "ctbase.jl"))
@@ -90,4 +90,4 @@ include(joinpath(@__DIR__, "solve", "descriptive.jl"))
9090

9191
export methods # non useful since it is already in Base
9292

93-
end
93+
end

src/helpers/component_checks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ false
3737
See also: [`_complete_components`](@ref), [`solve_explicit`](@ref)
3838
"""
3939
function _has_complete_components(
40-
discretizer::Union{CTDirect.AbstractDiscretizer, Nothing},
41-
modeler::Union{CTSolvers.AbstractNLPModeler, Nothing},
42-
solver::Union{CTSolvers.AbstractNLPSolver, Nothing}
40+
discretizer::Union{CTDirect.AbstractDiscretizer,Nothing},
41+
modeler::Union{CTSolvers.AbstractNLPModeler,Nothing},
42+
solver::Union{CTSolvers.AbstractNLPSolver,Nothing},
4343
)::Bool
4444
return !isnothing(discretizer) && !isnothing(modeler) && !isnothing(solver)
4545
end

0 commit comments

Comments
 (0)