Created
July 7, 2016 19:41
-
-
Save jiahao/f63a606e1da4f7f4dd63e3472015ce42 to your computer and use it in GitHub Desktop.
A simple interior point method implementation. Ref: http://www.maths.ed.ac.uk/~gondzio/reports/mfCS.pdf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Problem-specific thing | |
dualitygap(x...) = nothing | |
solveeq(x...) = rand() | |
############################ | |
#Simple backtracking line search | |
function linesearch(v, dv, α₀= 1.0, δ = 0.6) | |
α = α₀ | |
while v + α*dv ≤ 0 | |
α *= δ | |
end | |
return α | |
end | |
function myfunc(z, s, σ₁, σ₂, σ₃, α̃, ᾱ) | |
while dualitygap() ≥ ϵ do | |
if k ≠ 1 && (αP ≤ ᾱ || αD ≤ ᾱ ) | |
σ = σ₂ | |
else | |
σ = σ₁ | |
end | |
#Predictor step | |
Δz̄, Δs̄ = solveeq(σ, z, s) | |
αP = linesearch(z, Δz̄) | |
αD = linesearch(s, Δs̄) | |
#Corrector step | |
if (αP ≤ α̃ || αD ≤ α̃ ) | |
Δz̃, Δs̃ = solveeq(σ₃, z, s) | |
Δz = Δz̄ + Δz̃ | |
Δs = Δs̄ + Δs̃ | |
αP = linesearch(z, Δz) | |
αD = linesearch(s, Δs) | |
z = z + αP*Δz | |
s = s + αD*Δs | |
else | |
z = z + αP*Δz̄ | |
s = s + αD*Δs̄ | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment