Skip to content

Commit

Permalink
Modify some asserts that were causing trouble for non-convex domains
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Apr 5, 2014
1 parent b1c1ff1 commit 156d4b4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/linesearch/hz_linesearch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ function secant2!{T}(df::Union(DifferentiableFunction,
b = lsr.alpha[ib]
dphia = lsr.slope[ia]
dphib = lsr.slope[ib]
@assert dphia < 0
@assert dphib >= 0
@assert dphia < 0 && isfinite(dphia)
@assert dphib >= 0 && isfinite(dphib)
c = secant(a, b, dphia, dphib)
if detailed_trace & SECANT2 > 0
println("secant2: a = ", a, ", b = ", b, ", c = ", c)
Expand All @@ -434,7 +434,6 @@ function secant2!{T}(df::Union(DifferentiableFunction,
phic, dphic, f_up, g_up = linefunc!(df, x, s, c, xtmp, g, true, constraints)
f_calls += f_up
g_calls += g_up
@assert isfinite(phic)
push!(lsr, c, phic, dphic)
ic = length(lsr)
if satisfies_wolfe(c, phic, dphic, phi0, dphi0, philim, delta, sigma)
Expand Down Expand Up @@ -564,7 +563,12 @@ function bisect!{T}(df::Union(DifferentiableFunction,
# Debugging (HZ, conditions shown following U3)
@assert lsr.slope[ia] < 0
@assert lsr.value[ia] <= philim
@assert lsr.slope[ib] < 0 # otherwise we wouldn't be here
# if !(lsr.slope[ib] < 0)
# @show a, b
# @show lsr.value[ia], lsr.value[ib]
# @show lsr.slope[ia], lsr.slope[ib]
# end
# @assert lsr.slope[ib] < 0 # otherwise we wouldn't be here
@assert lsr.value[ib] > philim
@assert b > a
while b - a > eps(b)
Expand All @@ -575,7 +579,6 @@ function bisect!{T}(df::Union(DifferentiableFunction,
phid, gphi, f_up, g_up = linefunc!(df, x, s, d, xtmp, g, true, constraints)
f_calls += f_up
g_calls += g_up
@assert isfinite(phid)
push!(lsr, d, phid, gphi)
id = length(lsr)
if gphi >= 0
Expand Down

0 comments on commit 156d4b4

Please sign in to comment.