Skip to content

Commit a0c2416

Browse files
committed
Fixed formatting
1 parent 124da84 commit a0c2416

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/algorithms/TambyVanderpooten.jl

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@ reformulation is solved using one of the defining points as a starting solution.
2626
struct TambyVanderpooten <: AbstractAlgorithm end
2727

2828
function _update_search_region(
29-
U_N::Dict{Vector{Float64}, Vector{Vector{Vector{Float64}}}},
30-
y::Vector{Float64},
31-
yN::Vector{Float64},
29+
U_N::Dict{Vector{Float64},Vector{Vector{Vector{Float64}}}},
30+
y::Vector{Float64},
31+
yN::Vector{Float64},
3232
)
3333
p = length(y)
3434
bounds_to_remove = Vector{Float64}[]
35-
bounds_to_add = Dict{Vector{Float64}, Vector{Vector{Vector{Float64}}}}()
35+
bounds_to_add = Dict{Vector{Float64},Vector{Vector{Vector{Float64}}}}()
3636
for u in keys(U_N)
3737
if all(y .< u)
3838
push!(bounds_to_remove, u)
3939
for l in 1:p
4040
u_l = _get_child(u, y, l)
41-
N = [k == l ? [y] : [yi for yi in U_N[u][k] if yi[l] < y[l]] for k in 1:p]
41+
N = [
42+
k == l ? [y] : [yi for yi in U_N[u][k] if yi[l] < y[l]]
43+
for k in 1:p
44+
]
4245
if all(!isempty(N[k]) for k in 1:p if k != l && u_l[k] != yN[k])
4346
bounds_to_add[u_l] = N
4447
end
@@ -60,17 +63,20 @@ end
6063

6164
function _get_child(u::Vector{Float64}, y::Vector{Float64}, k::Int)
6265
@assert length(u) == length(y)
63-
return vcat(u[1:k-1], y[k], u[k+1:length(y)])
66+
return vcat(u[1:(k-1)], y[k], u[(k+1):length(y)])
6467
end
6568

6669
function _select_search_zone(
6770
U_N::Dict{Vector{Float64},Vector{Vector{Vector{Float64}}}},
68-
yI::Vector{Float64},
69-
yN::Vector{Float64},
71+
yI::Vector{Float64},
72+
yN::Vector{Float64},
7073
)
7174
upper_bounds = collect(keys(U_N))
7275
p = length(yI)
73-
hvs = [u[k] == yN[k] ? 0. : prod(_project(u, k) .- _project(yI, k)) for k in 1:p, u in upper_bounds]
76+
hvs = [
77+
u[k] == yN[k] ? 0.0 : prod(_project(u, k) .- _project(yI, k)) for
78+
k in 1:p, u in upper_bounds
79+
]
7480
k_star, j_star = argmax(hvs).I
7581
return k_star, upper_bounds[j_star]
7682
end

0 commit comments

Comments
 (0)