Skip to content

Commit bf96fab

Browse files
authored
Merge pull request #164 from control-toolbox/auto-juliaformatter-pr
[AUTO] JuliaFormatter.jl run
2 parents 3974c4d + fb1e096 commit bf96fab

17 files changed

Lines changed: 250 additions & 204 deletions

benchmarks/core-midpoint-trapeze.jl

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
function run()
44
results = CTBenchmarks.benchmark(;
5-
solver_models = [
6-
:madnlp => [:exa],
7-
:ipopt => [:exa],
8-
],
9-
disc_methods = [:trapeze, :midpoint],
10-
grid_sizes = [200],
11-
tol = 1e-8,
12-
ipopt_mu_strategy = "adaptive",
13-
print_trace = false,
14-
max_iter = 2000,
15-
max_wall_time = 600.0,
5+
solver_models=[:madnlp => [:exa], :ipopt => [:exa]],
6+
disc_methods=[:trapeze, :midpoint],
7+
grid_sizes=[200],
8+
tol=1e-8,
9+
ipopt_mu_strategy="adaptive",
10+
print_trace=false,
11+
max_iter=2000,
12+
max_wall_time=600.0,
1613
)
1714
println("✅ Benchmark midpoint vs trapeze completed successfully!")
1815
return results

docs/make.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ with_processed_template_problems(
120120
"Developers Guidelines" => [
121121
"Add a New Benchmark" => "add_benchmark.md",
122122
"Add a Custom Profile" => "add_performance_profile.md",
123-
"DocUtils Template System" => joinpath("developers", "docutils_templates.md"),
123+
"DocUtils Template System" =>
124+
joinpath("developers", "docutils_templates.md"),
124125
"Documentation Process" => "documentation_process.md",
125126
],
126127
],

docs/src/assets/benchmarks/core-midpoint-trapeze/core-midpoint-trapeze.jl

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
function run()
44
results = CTBenchmarks.benchmark(;
5-
solver_models = [
6-
:madnlp => [:exa],
7-
:ipopt => [:exa],
8-
],
9-
disc_methods = [:trapeze, :midpoint],
10-
grid_sizes = [200],
11-
tol = 1e-8,
12-
ipopt_mu_strategy = "adaptive",
13-
print_trace = false,
14-
max_iter = 2000,
15-
max_wall_time = 600.0,
5+
solver_models=[:madnlp => [:exa], :ipopt => [:exa]],
6+
disc_methods=[:trapeze, :midpoint],
7+
grid_sizes=[200],
8+
tol=1e-8,
9+
ipopt_mu_strategy="adaptive",
10+
print_trace=false,
11+
max_iter=2000,
12+
max_wall_time=600.0,
1613
)
1714
println("✅ Benchmark midpoint vs trapeze completed successfully!")
1815
return results

docs/src/docutils/CTBenchmarksDocUtils.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ using .DocumenterReference
129129
# Wrapper Functions (no src_dir parameter needed in templates)
130130
# ═══════════════════════════════════════════════════════════════════════════════
131131

132-
133132
# ═══════════════════════════════════════════════════════════════════════════════
134133
# Exports
135134
# ═══════════════════════════════════════════════════════════════════════════════

docs/src/docutils/Core/FigureEngine.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ plt = call_figure_function("_plot_profile_default_cpu", ["core-ubuntu-latest"])
5050
```
5151
"""
5252
function call_figure_function(
53-
function_name::AbstractString,
54-
args::Vector{<:AbstractString},
55-
extra_args::Tuple=()
53+
function_name::AbstractString, args::Vector{<:AbstractString}, extra_args::Tuple=()
5654
)
5755
if !haskey(FIGURE_FUNCTIONS, function_name)
5856
available = join(sort(collect(keys(FIGURE_FUNCTIONS))), ", ")

docs/src/docutils/Core/ProfileEngine.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function plot_profile_from_registry(
3333
name::String,
3434
bench_id::AbstractString,
3535
src_dir::AbstractString;
36-
combos::Union{Nothing,Vector{<:Tuple}}=nothing
36+
combos::Union{Nothing,Vector{<:Tuple}}=nothing,
3737
)
3838
config = CTBenchmarks.get_config(PROFILE_REGISTRY, name)
3939
json_path = joinpath(src_dir, "assets", "benchmarks", bench_id, bench_id * ".json")
@@ -67,7 +67,7 @@ function analyze_profile_from_registry(
6767
name::String,
6868
bench_id::AbstractString,
6969
src_dir::AbstractString;
70-
combos::Union{Nothing,Vector{<:Tuple}}=nothing
70+
combos::Union{Nothing,Vector{<:Tuple}}=nothing,
7171
)
7272
config = CTBenchmarks.get_config(PROFILE_REGISTRY, name)
7373
json_path = joinpath(src_dir, "assets", "benchmarks", bench_id, bench_id * ".json")

docs/src/docutils/Core/TemplateEngine.jl

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,17 @@ function replace_profile_plot_blocks(
404404
plt = plot_profile_from_registry(profile_name, bench_id, SRC_DIR; combos=combos)
405405

406406
# Generate unique basename for the figure
407-
args_str = bench_id * (isnothing(combos) ? "" : "_" * join(["$(m)_$(s)" for (m, s) in combos], "_"))
408-
basename = generate_figure_basename(template_filename, "profile_plot_$(profile_name)", args_str)
407+
args_str =
408+
bench_id * (
409+
if isnothing(combos)
410+
""
411+
else
412+
"_" * join(["$(m)_$(s)" for (m, s) in combos], "_")
413+
end
414+
)
415+
basename = generate_figure_basename(
416+
template_filename, "profile_plot_$(profile_name)", args_str
417+
)
409418

410419
# Create output directory if it doesn't exist
411420
mkpath(figures_output_dir)
@@ -442,7 +451,9 @@ function replace_profile_plot_blocks(
442451

443452
catch e
444453
if DOC_DEBUG[]
445-
@error " ✗ Failed to generate profile plot" exception = (e, catch_backtrace())
454+
@error " ✗ Failed to generate profile plot" exception = (
455+
e, catch_backtrace()
456+
)
446457
else
447458
@error " ✗ Failed to generate profile plot: $(e)"
448459
end
@@ -528,13 +539,17 @@ function replace_profile_analysis_blocks(content::String)
528539
end
529540

530541
try
531-
text_md = analyze_profile_from_registry(profile_name, bench_id, SRC_DIR; combos=combos)
542+
text_md = analyze_profile_from_registry(
543+
profile_name, bench_id, SRC_DIR; combos=combos
544+
)
532545
DOC_DEBUG[] &&
533546
@info " ✓ Replaced PROFILE_ANALYSIS block #$block_count: $profile_name for $bench_id"
534547
return text_md
535548
catch e
536549
if DOC_DEBUG[]
537-
@error " ✗ Failed to generate profile analysis" exception = (e, catch_backtrace())
550+
@error " ✗ Failed to generate profile analysis" exception = (
551+
e, catch_backtrace()
552+
)
538553
else
539554
@error " ✗ Failed to generate profile analysis: $(e)"
540555
end

docs/src/docutils/Core/TextEngine.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ string that will be inlined directly into the generated documentation.
1111

1212
const TEXT_FUNCTIONS = Dict{String,Function}()
1313

14-
1514
"""
1615
register_text_handler!(name::String, func::Function)
1716
@@ -43,9 +42,7 @@ Arguments are passed as: `func(extra_args..., args...)` so that injected
4342
dependencies (like `src_dir`) come first, following the Dependency Inversion Principle.
4443
"""
4544
function call_text_function(
46-
function_name::AbstractString,
47-
args::Vector{<:AbstractString},
48-
extra_args::Tuple=()
45+
function_name::AbstractString, args::Vector{<:AbstractString}, extra_args::Tuple=()
4946
)
5047
if !haskey(TEXT_FUNCTIONS, function_name)
5148
available = join(sort(collect(keys(TEXT_FUNCTIONS))), ", ")

docs/src/docutils/Handlers/DefaultProfiles.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const IS_SUCCESS_WITH_BENCHMARK =
1818
Filter function: accepts rows where success is true and iterations data is available.
1919
"""
2020
const IS_SUCCESS_WITH_ITERATIONS =
21-
row -> row.success == true && hasproperty(row, :iterations) && !ismissing(row.iterations)
21+
row ->
22+
row.success == true && hasproperty(row, :iterations) && !ismissing(row.iterations)
2223

2324
"""
2425
Filter function: accepts all rows (no additional filtering).
@@ -41,17 +42,15 @@ Extracts the `:time` field from the benchmark object and uses "smaller is better
4142
comparison (a <= b). Returns NaN if benchmark data is missing or malformed.
4243
"""
4344
const CPU_TIME_CRITERION = CTBenchmarks.ProfileCriterion{Float64}(
44-
"CPU time",
45-
row -> begin
45+
"CPU time", row -> begin
4646
bench = get(row, :benchmark, nothing)
4747
if bench === nothing || ismissing(bench)
4848
return NaN
4949
end
5050
time_raw = get(bench, "time", nothing)
5151
time_raw === nothing && return NaN
5252
return Float64(time_raw)
53-
end,
54-
(a, b) -> a <= b
53+
end, (a, b) -> a <= b
5554
)
5655

5756
"""
@@ -68,7 +67,7 @@ const ITERATIONS_CRITERION = CTBenchmarks.ProfileCriterion{Float64}(
6867
end
6968
return Float64(row.iterations)
7069
end,
71-
(a, b) -> a <= b
70+
(a, b) -> a <= b,
7271
)
7372

7473
# ───────────────────────────────────────────────────────────────────────────────
@@ -95,7 +94,7 @@ function init_default_profiles!()
9594
CPU_TIME_CRITERION,
9695
IS_SUCCESS_WITH_BENCHMARK,
9796
NO_ADDITIONAL_FILTER,
98-
AGGREGATE_MEAN
97+
AGGREGATE_MEAN,
9998
)
10099
CTBenchmarks.register!(PROFILE_REGISTRY, "default_cpu", cpu_config)
101100

@@ -106,7 +105,7 @@ function init_default_profiles!()
106105
ITERATIONS_CRITERION,
107106
IS_SUCCESS_WITH_ITERATIONS,
108107
NO_ADDITIONAL_FILTER,
109-
AGGREGATE_MEAN
108+
AGGREGATE_MEAN,
110109
)
111110
CTBenchmarks.register!(PROFILE_REGISTRY, "default_iter", iter_config)
112111

@@ -118,9 +117,11 @@ function init_default_profiles!()
118117
CPU_TIME_CRITERION,
119118
IS_SUCCESS_WITH_BENCHMARK,
120119
NO_ADDITIONAL_FILTER,
121-
AGGREGATE_MEAN
120+
AGGREGATE_MEAN,
121+
)
122+
CTBenchmarks.register!(
123+
PROFILE_REGISTRY, "midpoint_trapeze_cpu", midpoint_trapeze_config
122124
)
123-
CTBenchmarks.register!(PROFILE_REGISTRY, "midpoint_trapeze_cpu", midpoint_trapeze_config)
124125

125126
return nothing
126127
end

src/CTBenchmarks.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ include(joinpath(@__DIR__, "plot_solutions.jl"))
6969
include(joinpath(@__DIR__, "performance_profile.jl"))
7070

7171
export run, benchmark, plot_solutions
72-
export analyze_performance_profile, build_profile_from_df, plot_performance_profile, load_benchmark_df
72+
export analyze_performance_profile,
73+
build_profile_from_df, plot_performance_profile, load_benchmark_df
7374
export PerformanceProfileRegistry, PerformanceProfileConfig, ProfileCriterion
7475

75-
end # module
76+
end # module

0 commit comments

Comments
 (0)