Skip to content

Commit

Permalink
Merge pull request #26 from libprima/zaikunzhang-patch-1
Browse files Browse the repository at this point in the history
Update runtests.jl to use `maxfun  = 500n` and `rhoend = 1e-6` instead of `maxfun = 200n` and `rhoend = 1e-3`
  • Loading branch information
zaikunzhang authored Apr 2, 2024
2 parents 2714339 + ffaf8fe commit 6bc54d7
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ end

@testset "NEWUOA" begin
println("\nNEWUOA:")
kwds = (rhobeg = 1.0, rhoend = 1e-3, ftarget = -Inf,
maxfun = 200n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
kwds = (rhobeg = 1.0, rhoend = 1e-6, ftarget = -Inf,
maxfun = 500n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
x, info = @inferred PRIMA.newuoa(f, x0; kwds...)
print_1(x, info)
@test issuccess(info)
Expand All @@ -102,34 +102,34 @@ end
@test x1 == x
@test info1 == info
# Solve problem with scaling factors.
kwds = (scale, rhobeg = 1.0/scl, rhoend = 1e-3/scl, ftarget = -Inf,
maxfun = 200n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
kwds = (scale, rhobeg = 1.0/scl, rhoend = 1e-6/scl, ftarget = -Inf,
maxfun = 500n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
x1, info1 = @inferred PRIMA.newuoa(f, x0; kwds...)
@test x1 x
end

@testset "UOBYQA" begin
println("\nUOBYQA:")
kwds = (rhobeg = 1.0, rhoend = 1e-3, ftarget = -Inf,
maxfun = 200n, iprint = PRIMA.MSG_EXIT)
kwds = (rhobeg = 1.0, rhoend = 1e-6, ftarget = -Inf,
maxfun = 500n, iprint = PRIMA.MSG_EXIT)
x, info = @inferred PRIMA.uobyqa(f, x0; kwds...)
print_1(x, info)
@test issuccess(info)
@test x [3,2] atol=2e-2 rtol=0
@test f(x) info.fx
@test x0 == x0_sav
# Solve problem with scaling factors.
kwds = (scale, rhobeg = 1.0/scl, rhoend = 1e-3/scl, ftarget = -Inf,
maxfun = 200n, iprint = PRIMA.MSG_EXIT)
kwds = (scale, rhobeg = 1.0/scl, rhoend = 1e-6/scl, ftarget = -Inf,
maxfun = 500n, iprint = PRIMA.MSG_EXIT)
x1, info1 = @inferred PRIMA.uobyqa(f, x0; kwds...)
@test x1 x
end

@testset "BOBYQA" begin
println("\nBOBYQA:")
kwds = (xl = xl, xu = xu,
rhobeg = 1.0, rhoend = 1e-3, ftarget = -Inf,
maxfun = 200n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
rhobeg = 1.0, rhoend = 1e-6, ftarget = -Inf,
maxfun = 500n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
x, info = @inferred PRIMA.bobyqa(f, x0; kwds...)
print_1(x, info)
@test issuccess(info)
Expand All @@ -142,17 +142,17 @@ end
@test x1 == x
@test info1 == info
# Solve problem with scaling factors.
kwds = (scale, rhobeg = 1.0/scl, rhoend = 1e-3/scl, ftarget = -Inf,
maxfun = 200n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
kwds = (scale, rhobeg = 1.0/scl, rhoend = 1e-6/scl, ftarget = -Inf,
maxfun = 500n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
x1, info1 = @inferred PRIMA.bobyqa(f, x0; kwds...)
@test x1 x
end

@testset "COBYLA" begin
println("\nCOBYLA:")
kwds = (xl = xl, xu = xu, linear_ineq = (A_ineq, b_ineq),
rhobeg = 1.0, rhoend = 1e-3, ftarget = -Inf,
maxfun = 200*n, iprint = PRIMA.MSG_EXIT)
rhobeg = 1.0, rhoend = 1e-6, ftarget = -Inf,
maxfun = 500n, iprint = PRIMA.MSG_EXIT)
# First call with just the number of non-linear inequality constraints.
x, info = @inferred PRIMA.cobyla(f, x0; kwds...,
nonlinear_ineq = c_ineq)
Expand All @@ -174,8 +174,8 @@ end
@test info1 == info
# Solve problem with scaling factors.
kwds = (xl = xl, xu = xu, linear_ineq = (A_ineq, b_ineq),
scale, rhobeg = 1.0/scl, rhoend = 1e-3/scl, ftarget = -Inf,
maxfun = 200n, iprint = PRIMA.MSG_EXIT)
scale, rhobeg = 1.0/scl, rhoend = 1e-6/scl, ftarget = -Inf,
maxfun = 500n, iprint = PRIMA.MSG_EXIT)
x1, info1 = @inferred PRIMA.cobyla(f, x0; kwds...,
nonlinear_ineq = c_ineq)
@test x1 x
Expand All @@ -184,8 +184,8 @@ end
@testset "LINCOA" begin
println("\nLINCOA:")
kwds = (xl = xl, xu = xu, linear_ineq = (A_ineq, b_ineq),
rhobeg = 1.0, rhoend = 1e-3, ftarget = -Inf,
maxfun = 200*n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
rhobeg = 1.0, rhoend = 1e-6, ftarget = -Inf,
maxfun = 500n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
x, info = @inferred PRIMA.lincoa(f, x0; kwds...)
print_2(x, info)
@test issuccess(info)
Expand All @@ -199,8 +199,8 @@ end
@test info1 == info
# Solve problem with scaling factors.
kwds = (xl = xl, xu = xu, linear_ineq = (A_ineq, b_ineq),
scale, rhobeg = 1.0/scl, rhoend = 1e-3/scl, ftarget = -Inf,
maxfun = 200n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
scale, rhobeg = 1.0/scl, rhoend = 1e-6/scl, ftarget = -Inf,
maxfun = 500n, npt = 2n + 1, iprint = PRIMA.MSG_EXIT)
x1, info1 = @inferred PRIMA.lincoa(f, x0; kwds...)
@test x1 x
end
Expand Down

0 comments on commit 6bc54d7

Please sign in to comment.