Skip to content

Commit 4c1a909

Browse files
committed
85.37% now
1 parent e02f45a commit 4c1a909

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

scripts/autotune_nomad.jl

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ function eval_fct_lfc(x)
101101
count_eval = true
102102
return (success, count_eval, bb_outputs)
103103
end
104+
function eval_fct_ufc(x)
105+
bb_outputs = [simulate_ufc(x)]
106+
success = true
107+
count_eval = true
108+
return (success, count_eval, bb_outputs)
109+
end
104110

105111
function simulate_lfc(x::Vector{Cdouble}; return_lg::Bool = false)
106112
wcs = WCSettings(dt=0.02)
@@ -164,12 +170,25 @@ function autotune(controller::WinchControllerState)
164170
println("Autotuning upper force control...")
165171
# Define the parameters for the autotuning
166172
x0 = [maximum([2e-5, wcs.pf_high]), wcs.if_high] # initial guess for the speed controller gain
167-
x, info = bobyqa(simulate_lfc, x0;
168-
xl = 0.25 .* x0,
169-
xu = 2.0 .* x0,
170-
rhobeg = maximum([2e-5, minimum(x0)/4]),
171-
maxfun = 500
172-
)
173+
# x, info = bobyqa(simulate_lfc, x0;
174+
# xl = 0.25 .* x0,
175+
# xu = 2.0 .* x0,
176+
# rhobeg = maximum([2e-5, minimum(x0)/4]),
177+
# maxfun = 500
178+
# )
179+
pb = NomadProblem(2, # number of inputs of the blackbox
180+
1, # number of outputs of the blackbox
181+
["OBJ"], # type of outputs of the blackbox
182+
eval_fct_ufc;
183+
lower_bound = 0.25 .* x0,
184+
upper_bound = 2.0 .* x0)
185+
try
186+
result = solve(pb, x0)
187+
x = result.x_best_feas
188+
catch e
189+
@error "Autotuning ufc failed: $(e)"
190+
x = x0
191+
end
173192
else
174193
error("Unknown controller state: $controller")
175194
return

0 commit comments

Comments
 (0)