-
-
Save evrenmturan/7f7d6cf718cc6636c2d12ccb5eb2f777 to your computer and use it in GitHub Desktop.
SIP is reported solved but there is constraint violation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EAGO, Plots,Ipopt, JuMP | |
const Maxi = 1.4 | |
function gsip_1(x,w) | |
denom = ((w[1]^2 + 1) * (10^-6 *w[1]^2 + 1)) | |
gsip= 1/( | |
w[1]* sqrt(w[1]^2+1)* | |
sqrt( | |
((x[3]*w[1]-x[2]/w[1])*( | |
- (1.001 *w[1] * sin(w[1]))/(denom) | |
- (0.001*w[1]^2*cos(w[1]))/(denom) | |
+ (cos(w[1]))/(denom) ) | |
+ | |
x[1]*( | |
(0.001*w[1]^2*sin(w[1]))/denom | |
- sin(w[1])/denom | |
-(1.001)*w[1]*cos(w[1])/denom | |
) | |
)^2 | |
+ | |
( | |
-(x[3]*w[1]-x[2]/w[1])*( | |
(0.001 *w[1]^2 * sin(w[1]))/(denom) | |
- sin(w[1])/denom | |
-(1.001)*w[1]*cos(w[1])/denom | |
) | |
+ x[1]*( | |
-(0.001*w[1]^2*cos(w[1]))/denom | |
+ cos(w[1])/denom | |
-(1.001)*w[1]*sin(w[1])/denom | |
) | |
+1 )^2 | |
)) | |
return gsip - x[4] | |
end | |
function gsip_2(x,w) | |
denom = ((w[1]^2 + 1) * (10^-6 *w[1]^2 + 1)) | |
gsip= 1/( | |
sqrt( | |
((x[3]*w[1]-x[2]/w[1])*( | |
- (1.001 *w[1] * sin(w[1]))/(denom) | |
- (0.001*w[1]^2*cos(w[1]))/(denom) | |
+ (cos(w[1]))/(denom) ) | |
+ | |
x[1]*( | |
(0.001*w[1]^2*sin(w[1]))/denom | |
- sin(w[1])/denom | |
-(1.001)*w[1]*cos(w[1])/denom | |
) | |
)^2 | |
+ | |
( | |
-(x[3]*w[1]-x[2]/w[1])*( | |
(0.001 *w[1]^2 * sin(w[1]))/(denom) | |
- sin(w[1])/denom | |
-(1.001)*w[1]*cos(w[1])/denom | |
) | |
+ x[1]*( | |
-(0.001*w[1]^2*cos(w[1]))/denom | |
+ cos(w[1])/denom | |
-(1.001)*w[1]*sin(w[1])/denom | |
) | |
+1 )^2 | |
)) | |
return gsip - Maxi | |
end | |
f(x) = x[4] | |
p_l = Float64[0.01] | |
p_u = Float64[20.0] | |
x_l = Float64[0.01, 1e-2, 1e-2, 0.01] | |
x_u = Float64[1.0, 1.0, 1., 10.] | |
sip_result = sip_solve(SIPHybrid(), x_l, x_u, p_l, p_u, f, Any[gsip_1,gsip_2], abs_tolerance = 1E-5) | |
# Algorithm Converged | |
# SIPResult(1, 1, 1.0878223933552882, 1.0878152321594068, true, [1.0, 0.9777539375595354, 0.27747732688369253, 1.0878223933552882], [0.0], 18.401670217514038) | |
# can see that there is a violatoin. | |
x=sip_result.xsol | |
w_list = exp10.(collect(log10(p_l[1]):0.01:log10(p_u[1]))); | |
gsip1=ones(length(w_list)); | |
gsip2=ones(length(w_list)); | |
for i =1:length(w_list) | |
gsip2[i] = gsip_2(x,[w_list[i]]) | |
gsip1[i]= gsip_1(x,[w_list[i]]) | |
end | |
p1=plot(log10.(w_list),(gsip2)) | |
plot!(log10.(w_list),(ones(length(Ms))*0.0),colour="red",width = 2) | |
p2=plot(log10.(w_list),gsip1) | |
plot(p1,p2,layout=(2,1)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment