@@ -26,19 +26,22 @@ reformulation is solved using one of the defining points as a starting solution.
26
26
struct TambyVanderpooten <: AbstractAlgorithm end
27
27
28
28
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} ,
32
32
)
33
33
p = length (y)
34
34
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}}}}()
36
36
for u in keys (U_N)
37
37
if all (y .< u)
38
38
push! (bounds_to_remove, u)
39
39
for l in 1 : p
40
40
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
+ ]
42
45
if all (! isempty (N[k]) for k in 1 : p if k != l && u_l[k] != yN[k])
43
46
bounds_to_add[u_l] = N
44
47
end
60
63
61
64
function _get_child (u:: Vector{Float64} , y:: Vector{Float64} , k:: Int )
62
65
@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)])
64
67
end
65
68
66
69
function _select_search_zone (
67
70
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} ,
70
73
)
71
74
upper_bounds = collect (keys (U_N))
72
75
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
+ ]
74
80
k_star, j_star = argmax (hvs). I
75
81
return k_star, upper_bounds[j_star]
76
82
end
0 commit comments