You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/auglag/auglag.jl
+27-11Lines changed: 27 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,15 @@ end
17
17
18
18
- Draft version.
19
19
- Solve a constrained problem with an augmented Lagrangian method, whose subproblem is solved by `NOMAD.jl`.
20
+
- Derivative-free version of Andreani et al.'s 2007 AUGLAG, as proposed by Diniz-Ehrhardt et al. in 2011.
20
21
21
22
# Arguments
22
23
- `bb::Blackbox`: the blackbox to be optimized. Should take `x::Vector{Float64}` as an input and return an output of the form `Tuple{Float64,Vector{Float64},Vector{Float64}}` where the first number is the objective value and the vectors of inequality and equality constraints, in this order.
24
+
25
+
# TODOS
26
+
- Handle the types of problems (equalities, inequalities, unconstrained) in a cleaner way.
23
27
"""
24
-
function dfauglag(bb::Blackbox, x0::Vector{Float64}; λ0::Union{Nothing,Vector{Float64}}=nothing, μ0::Union{Nothing,Vector{Float64}}=nothing, γ::Float64=0.5, MAX_ITERS::Int=100)
28
+
function dfauglag(bb::Blackbox, x0::Vector{Float64}; λ0::Union{Nothing,Vector{Float64}}=nothing, μ0::Union{Nothing,Vector{Float64}}=nothing, γ::Float64=1.5, τ::Float64=0.75, MAX_ITERS::Int=100)
25
29
# Dimension, number of equalities and inequalities.
26
30
n, m, p = get_dim(bb), nb_eqs(bb), nb_ineqs(bb)
27
31
@@ -46,7 +50,8 @@ function dfauglag(bb::Blackbox, x0::Vector{Float64}; λ0::Union{Nothing,Vector{F
46
50
# Outer iterations of the augmented Lagrangian method.
47
51
k =0
48
52
x = x0
49
-
options = NOMAD.NomadOptions(max_bb_eval=10)
53
+
options = NOMAD.NomadOptions(max_bb_eval=50)
54
+
previous_gap =0.0
50
55
while k < MAX_ITERS
51
56
# 1. Solve the augmented Lagrangian subproblem with a DFO method, here MADS.
52
57
L(y) = auglag_bb_wrapper(bb, y; ρ, λ, μ)
@@ -55,19 +60,30 @@ function dfauglag(bb::Blackbox, x0::Vector{Float64}; λ0::Union{Nothing,Vector{F
55
60
x = result.x_best_feas
56
61
57
62
# 2. Estimate new Lagrange multipliers.
58
-
h = [eval_eq(bb, i, x) for i in1:p]
59
-
λ = λ .+ (ρ * h)
60
-
g = [eval_ineq(bb, i, x) for i in1:m]
61
-
V = max.(g, -1/ ρ * μ)
62
-
μ = max.(zeros(p), μ .+ (ρ * g))
63
+
if nb_eqs(bb) >0
64
+
h = [eval_eq(bb, i, x) for i in1:m]
65
+
λ = λ .+ (ρ * h)
66
+
end
67
+
if nb_ineqs(bb) >0
68
+
g = [eval_ineq(bb, i, x) for i in1:p]
69
+
V = max.(g, -1/ ρ * μ)
70
+
μ = max.(zeros(p), μ .+ (ρ * g))
71
+
end
63
72
64
73
# 3. Update the penalty parameter.
65
-
if k >0
66
-
if max(maximum(h), maximum(V)) > τ * max(maximum(hprev), maximum(Vprev)) #TODO: save h and V from previous iteration every time.
67
-
ρ *= γ
68
-
end
74
+
# This rule uses a criterion that measures a combination of feasibility and dual-complementarity.
0 commit comments