Skip to content

Commit

Permalink
Testing Update
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewStuber committed May 29, 2018
1 parent 56d3717 commit e29f16c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 31 deletions.
2 changes: 1 addition & 1 deletion example/SemiInfinite/ImplicitSIP.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace()
#workspace()

using IntervalArithmetic
using EAGO
Expand Down
88 changes: 58 additions & 30 deletions test/SemiInfinite/ImplicitSIP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,47 +50,75 @@ out6a = EAGO.Reform_Imp_HJ(hj,x,yrefa,Pset,ny)

# later if necessary
out5 = EAGO.Reform_Imp_HG(h,g,x,yrefa,Pset,ny,ng,eps_g)
@test out5 == [11.0, -2.0, 9.0, 1.0, -11.0, 2.0, -9.0, -1.0, 8.5, 29.0, 10.5, 34.0]
@test out5 == [11.0, -2.0, 9.0, 1.0, 8.5, 29.0, 10.5, 34.0]

end

#=
# solves example SIP #1 with DAG contractor disabled
@testset "SemiInfinite Explicit RHS" begin

# create the SIP option object for the solver
SIPopt1 = SIP_opts()

# create solver with specified options options for lower level problem
sep1in = EAGO_NLPSolver(LBD_func_relax = "NS-STD-OFF", # use standard McCormick relaxations
LBDsolvertype = "LP", # use an LP problem structure for relaxed problems
UBDsolvertype = "Ipopt", # use NLP solver upper bounds (currently preferred solver)
probe_depth = -1, # disable probing
variable_depth = 1000, # use duality based range reduction to a depth of 1000 (use to high depth recommended)
DAG_depth = -1, # don't use a DAG contractor (I need to update this for implicit SIP)
STD_RR_depth = -1, # don't use standard range reduction (problems get quite large)
verbosity = "None", # specify printing level for global optimization problem
validated = true, # use numerically validated intervals
atol = 1E-7, # absolute tolerance (May need to play with this)
rtol = 1E-5) # relative tolerance (May need to play with this)

# create a solver for the lower/upper problems
sep1lu = EAGO_NLPSolver(LBD_func_relax = "NS-STD-OFF",
LBDsolvertype = "LP",
UBDsolvertype = "Ipopt",
probe_depth = -1,
variable_depth = 1000,
DAG_depth = -1,
STD_RR_depth = 1000,
ImplicitFlag = true,
verbosity = "Normal",
validated = true))
sep1lu.BnBSolver.Verbosity = "None"
sep1in = EAGO_NLPSolver(BD_func_relax = "NS-STD-OFF",
LBDsolvertype = "LP",
probe_depth = -1,
variable_depth = 1000,
DAG_depth = -1,
STD_RR_depth = 1000,
ImplicitFlag = true,
verbosity = "Normal",
validated = true))
sep1in.BnBSolver.Verbosity = "None"
SIPopt1.LLP_Opt = sep1in
SIPopt1.LBP_Opt = sep1lu
SIPopt1.UBP_Opt = sep1lu
f1(x) = (1/3)*x[1]^2 + x[2]^2 + x[1]/2
gSIP1(x,p) = (1.0-(x[1]^2)*(p[1]^2))^2 - x[1]*p[1]^2 - x[2]^2 + x[2]
X1 = [MCInterval(-1000.0,1000.0),MCInterval(-1000.0,1000.0)]
P1 = [MCInterval(0.0,1.0)]
SIPoutput1 = Implicit_SIP_Solve(f1,gSIP1,X1,P1,SIPopt1)
@test isapprox(SIPoutput1.LBD,0.19452787006676814,atol=1E-3)
@test isapprox(SIPoutput1.UBD,0.19452787006676814,atol=1E-3)
STD_RR_depth = -1,
verbosity = "None",
validated = true,
atol = 1E-7,
rtol = 1E-5)

SIPopt1.LLP_Opt = sep1in # Set solver for use in lower level problem
SIPopt1.LBP_Opt = sep1lu # Set solver for use in lower bounding problem
SIPopt1.UBP_Opt = sep1lu # Set solver for use in upper bounding problem

SIPopt1.eps_g0 = 0.9
SIPopt1.tol = 1E-2 # SIP tolerance
SIPopt1.r0 = 2.0 # reduction factor for SIP routine
SIPopt1.kmax = 5 # maximum number of iteration for SIP routine
SIPopt1.inn_tol = 0.0 # tolerance factor usually set to tolerance of inner program

# 1D Example (7.4.1 from thesis)
# solution f = -15.8077 @ y = 2.95275
f(x) = (x[1]-3.5)^4 - 5*(x[1]-3.5)^3 - 2*(x[1]-3.5)^2 + 15*(x[1]-3.5)
function h(x,y,p)
[y[1]-(x[1]-(x[1]^3)/6+(x[1]^5)/120)/sqrt(y[1])-p[1]]
end
=#
function hj(x,y,p)
[1.0+(x[1]-(x[1]^3)/6+(x[1]^5)/120)/(2.0*sqrt(y[1]^3))]
end
gSIP(x,y,p) = y[1] + cos(x[1]-p[1]/90) - p[1]
xBnds = [Interval(0.5,8.0)]
yBnds = [Interval(68.8,149.9)]
pBnds = [Interval(80,120)]
impout1 = Implicit_SIP_Solve(f,h,hj,gSIP,xBnds,yBnds,pBnds,SIPopt1)

# get solution values
UBD = impout1.UBD # upper bound
LBD = impout1.LBD # lower bound
feas = impout1.feas # is problem feasible?

@test isapprox(LBD,-7.898552614446456,atol=1E-3)
@test isapprox(UBD,-7.896382235986764,atol=1E-3)
@test feas == true
end

end

0 comments on commit e29f16c

Please sign in to comment.