Skip to content

Commit

Permalink
fix in compatibility test
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbb-upb committed Sep 12, 2024
1 parent 305de6b commit d4080fd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
21 changes: 16 additions & 5 deletions src/criticality_routine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function criticality_routine!(
χ = step_vals.crit_ref[]
θ = cached_theta(vals)
stop_code = nothing
break_because_incompatible = false
if θ < eps_theta &&< eps_crit && Δ > crit_M * χ )
@logmsg log_level "$(pad_str)ITERATION $(it_index): CRITICALITY ROUTINE (θ = )."
## init
Expand Down Expand Up @@ -55,6 +56,7 @@ function criticality_routine!(
if !compatibility_test(step_vals.n, algo_opts, Δj)
# make sure we have compatible steps after exiting the loop
universal_copy!(step_vals, crit_cache.step_vals)
break_because_incompatible = true

break
end
Expand Down Expand Up @@ -84,11 +86,20 @@ function criticality_routine!(
@ignoraise finalize_step_vals!(
step_cache, step_vals, Δ, mop, mod, scaler, lin_cons, scaled_cons, vals, mod_vals; log_level) indent
end
@logmsg log_level """
$(pad_str) Finished after $j criticality loop(s),
$(pad_str) Δ=$_Δ <= Mχ=$(crit_M * χ), now Δ=,
$(pad_str) Criticality χ=$(step_vals.crit_ref[]), $(χ),
$(pad_str) ‖d‖₂=$(LA.norm(step_vals.d)), ‖s‖₂=$(LA.norm(step_vals.s))."""
@logmsg log_level """\n
$(pad_str) Finished after $j criticality loop(s),\
$(if break_because_incompatible
"\n$(pad_str) normal step would be incompatible,"
else
""
end)
$(pad_str) Values:
$(pad_str) _Δ = $_Δ
$(pad_str) Mξ = $(crit_M * χ)
$(pad_str) χ = $(step_vals.crit_ref[]),
$(pad_str) ‖d‖₂ = $(LA.norm(step_vals.d)),
$(pad_str) ‖s‖₂ = $(LA.norm(step_vals.s)),
$(pad_str) Δ = $(Δ)"""
end
if isa(stop_code, AbstractStoppingCriterion)
return stop_code
Expand Down
17 changes: 9 additions & 8 deletions src/trial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ function _test_trial_point!(

if is_f_step
iteration_classification = IT_F_STEP

else
# constraint violation significant compared to predicted decrease
iteration_classification = IT_THETA_STEP
end
if !isnan(rho)
if rho >= nu_accept
if rho >= nu_success
rho_classification = RHO_SUCCESS
Expand All @@ -117,9 +123,6 @@ function _test_trial_point!(
else
rho_classification = RHO_FAIL
end
else
# constraint violation significant compared to predicted decrease
iteration_classification = IT_THETA_STEP
end
end
return iteration_classification, rho, rho_classification
Expand Down Expand Up @@ -243,8 +246,8 @@ function _update_radius(
nu_accept, nu_success
)
radius_update = nothing
if iteration_classification == IT_F_STEP ||
iteration_classification == IT_THETA_STEP
if iteration_classification == IT_F_STEP
#iteration_classification == IT_THETA_STEP
if rho_classification == RHO_ACCEPT
gamma_factor = gamma_shrink
if nu_success > nu_accept
Expand All @@ -261,12 +264,10 @@ function _update_radius(
delta_new = delta
radius_update = RADIUS_GROW_FAIL
end
end
#=
end
elseif iteration_classification == IT_THETA_STEP
delta_new = delta
radius_update = RADIUS_NO_CHANGE
=#
end

if isnothing(radius_update)
Expand Down
3 changes: 1 addition & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ function log_stop_code(crit, log_level)
@logmsg log_level stop_message(crit)
end


function compatibility_test_rhs(c_delta, c_mu, mu, Δ)
return c_delta * min(Δ, c_mu + Δ^(1+mu))
return c_delta * min(Δ, c_mu * Δ^(1+mu))
end

function compatibility_test(n, c_delta, c_mu, mu, Δ)
Expand Down

0 comments on commit d4080fd

Please sign in to comment.