How to model this as a function of p(x) in Julia? (easy)


Where i is the number of iterations and g(x) is a vector of 2 inequality constraints.

Hi!, What optimization package are you using?

I am trying to put this equation into a penalty_method function:

function penalty_method(f, x, c, k_max; ρ=1, γ=2) #ρ=1 (initial penalty), γ=2 (penalty modifier)
for k in 1 : k_max
p(x) = sum(c(x).> 0)
# p(x) = sum(max(c(x), 0).^2)
x = covariance_matrix_adaptation(x → f(x)+ ρ*p(x), x, 300; σ = 1.0, m=100, m_elite=50)
if p(x)==0
return x
return x

i’m using NLopt right now, and it have and augmented lagrangian solver with an implementation of a penalty method for constraints on the function, maybe you can check on that

1 Like