Skip to content

Instantly share code, notes, and snippets.

@evrenmturan
Last active June 25, 2021 09:31
Show Gist options
  • Save evrenmturan/2ef9d3c0a81ed2707faf657bf8d2908a to your computer and use it in GitHub Desktop.
Save evrenmturan/2ef9d3c0a81ed2707faf657bf8d2908a to your computer and use it in GitHub Desktop.
Example SIP issue - should give an error
# Problem 3 in Watson (1983) Numerical experiments with globally convergent methods for semi-infinite programming problems.
# Expected solution: x=[-0.213258, -1.36212, 1.85306]
f(x) = x[1]^2 + x[2]^2 + x[3]^2
gSIP(x,p) = x[1] + x[2]*exp(x[3]*p[1])+exp(2*p[1])-2*sin(4*p[1])
x_l = Float64[-1000.0, -1000.0,-1000.0]
x_u = Float64[1000.0, 1000.0,1000.0]
p_l = Float64[0.0]
p_u = Float64[1.0]
sip_result = sip_solx=[-0.213258, -1.36212, 1.85306]ve(SIPResRev(), x_l, x_u, p_l, p_u, f, Any[gSIP], abs_tolerance = 1E-3,)
# Running this gives
# SIPResult(2, 1, 3.0e6, 3.0e6, true, [-1000.0, -1000.0, -1000.0], [0.0], 0.5812180042266846)
# rather wrong. I assume the problem is exp(...) = inf , but it's odd to not give an error?
# if I change x_l
x_l = Float64[-2.0, -2.0,-2.0]
# Then I get an error message:
#=
First Solution Found at Node -1
LBD = Inf
UBD = Inf
Solution is :
ERROR: Lower problem did not solve to global optimality.
Termination status = INFEASIBLE. Primal status = INFEASIBILITY_CERTIFICATE
=#
# and changing x_u to a lower number :
x_l = Float64[-1000.0, -1000.0,-1000.0]
x_u = Float64[700.0, 700.0,700.0]
# Algorithm Converged
# SIPResult(3, 1, 5.335113886651887, 5.334687275796237, true, [-0.2132982605385887, -1.3614842086397188, 1.8536392551755527], [0.0], 0.8103337287902832)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment