Skip to content

Commit 3e5ceb0

Browse files
authored
fix MadNLP if bound_relax_factor=0 (#449)
1 parent 5d75154 commit 3e5ceb0

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/IPM/kernels.jl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,17 @@ function finish_aug_solve!(kkt::AbstractKKTSystem, d::AbstractKKTVector)
204204
end
205205

206206
function set_initial_bounds!(xl::AbstractVector{T}, xu::AbstractVector{T}, tol) where T
207-
map!(
208-
x->x - max(one(T), abs(x)) .* tol,
209-
xl, xl
210-
)
211-
map!(
212-
x->x + max(one(T), abs(x)) .* tol,
213-
xu, xu
214-
)
207+
# If `tol` is set to zero, keep the bounds unchanged.
208+
if tol > zero(T)
209+
map!(
210+
x->x - max(one(T), abs(x)) .* tol,
211+
xl, xl
212+
)
213+
map!(
214+
x->x + max(one(T), abs(x)) .* tol,
215+
xu, xu
216+
)
217+
end
215218
end
216219

217220
function set_initial_rhs!(solver::AbstractMadNLPSolver{T}, kkt::AbstractKKTSystem) where T

test/madnlp_test.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,12 @@ end
216216
)
217217
@test result.status == MadNLP.SOLVE_SUCCEEDED
218218
end
219+
220+
@testset "Issue #430" begin
221+
# Test MadNLP is working with bound_relax_factor=0
222+
nlp = MadNLPTests.HS15Model()
223+
solver = MadNLPSolver(nlp; bound_relax_factor=0.0)
224+
stats = MadNLP.solve!(solver)
225+
@test stats.status == MadNLP.SOLVE_SUCCEEDED
226+
end
227+

0 commit comments

Comments
 (0)