@@ -53,13 +53,9 @@ function generate_optimization_problem(
5353 lbounds = fill(0.0 , length(parameters_fitted)),
5454 ubounds = fill(Inf , length(parameters_fitted)),
5555 scale = fill(:lin, length(parameters_fitted)),
56- progress:: Symbol = :minimal,
5756 kwargs... # other arguments to sim
5857) where {C<: AbstractScenario , P<: Pair }
5958
60- # names of parameters used in fitting and saved in parameters_fitted field of solution
61- parameters_names = first.(parameters_fitted)
62-
6359 selected_scenario_pairs = Pair{Symbol,Scenario}[]
6460 for scenario_pair in scenario_pairs # iterate through scenarios names
6561 if isempty(last(scenario_pair). measurements)
@@ -82,28 +78,9 @@ function generate_optimization_problem(
8278 kwargs...
8379 )
8480
85- # progress info
86- prog = ProgressUnknown(; desc = " Fit counter:" , spinner= false , enabled= progress!= :silent, showspeed= true )
87- count = 0
88- estim_best = Inf
8981 function obj_func(x, hyper_params)
90- count+= 1
91- # try - catch is a tmp solution for NLopt
9282 x_unscaled = unscale_params.(x, scale)
9383 estim_obj = estim_fun(x_unscaled)
94-
95- if ! isnothing(estim_obj) && ! isa(estim_obj, ForwardDiff. Dual) && (estim_obj < estim_best)
96- estim_best = estim_obj
97- end
98-
99- values_to_display = [(:ESTIMATOR_BEST, round(estim_best; digits= 2 ))]
100- if progress == :full && ! (eltype(x_unscaled) <: ForwardDiff.Dual )
101- for i in 1 : length(x)
102- push!(values_to_display, (parameters_names[i], round(x_unscaled[i], sigdigits= 3 )))
103- end
104- end
105-
106- ProgressMeter. update!(prog, count, spinner= " ⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏" ; showvalues = values_to_display)
10784 return estim_obj
10885 end
10986
0 commit comments