# A limit state function
f <- function(x){ sqrt(sum(x^2)) - sqrt(2)/2 }
# Creation of the data sets
n <- 200
X <- matrix(runif(2*n), nrow = n)
Y <- apply(X, MARGIN = 1, function(w){sign(f(w))})
if (FALSE) {
TEST.Convexity <- testConvexity(X, Y)
if(length(TEST.Convexity) == 2){
Convexity <- TEST.Convexity[[1]]
model.A <- TEST.Convexity[[2]]
}
if(length(TEST.Convexity) == 1){
# The problem is not convex
Convexity <- 0 #the problem is not convex
}
}
Run the code above in your browser using DataLab