#Welded beam function

The welded beam function is defined as: $f(h,l,t) = \sqrt{\frac{a^2 + b^2 + abl}{\sqrt{0.25(l^2+(h+t)^2)}}}$ With: $a = \frac{6000}{\sqrt{2}hl}$ $b = \frac{6000(14 + 0.5l)*\sqrt{0.25(l^2+(h+t)^2)}}{2*[0.707hl(\frac{l^2}{12}+0.25*(h+t)^2)]}$

It has 3 dimension.

using Surrogates
using Plots
using LinearAlgebra
default()

Define the objective function:

function f(x)
    h = x[1]
    l = x[2]
    t = x[3]
    a = 6000/(sqrt(2)*h*l)
    b = (6000*(14+0.5*l)*sqrt(0.25*(l^2+(h+t)^2)))/(2*(0.707*h*l*(l^2/12 + 0.25*(h+t)^2)))
    return (sqrt(a^2+b^2 + l*a*b))/(sqrt(0.25*(l^2+(h+t)^2)))
end
f (generic function with 1 method)
n = 300
d = 3
lb = [0.125,5.0,5.0]
ub = [1.,10.,10.]
x = sample(n,lb,ub,SobolSample())
y = f.(x)
n_test = 1000
x_test = sample(n_test,lb,ub,GoldenSample());
y_true = f.(x_test);
1000-element Array{Float64,1}:
 6740.508578587182
 1197.1253800426875
 1915.2458846101658
 1018.9473831316677
 1454.0347358883528
  953.2664882402732
 1129.132275742336
 4730.110633320883
  997.0526115864634
 3264.33995564987
    ⋮
 3492.135795999712
 2108.5771159104743
 1245.5503962239757
  791.9113295048217
 2123.2975011112035
 4137.832068034221
  841.7984120749601
 2645.0185659210442
  766.4185051799487
my_rad = RadialBasis(x,y,lb,ub)
y_rad = my_rad.(x_test)
mse_rad = norm(y_true - y_rad,2)/n_test
print("MSE Radial: $mse_rad")

my_krig = Kriging(x,y,lb,ub)
y_krig = my_krig.(x_test)
mse_krig = norm(y_true - y_krig,2)/n_test
print("MSE Kriging: $mse_krig")

my_loba = LobacheskySurrogate(x,y,lb,ub)
y_loba = my_loba.(x_test)
mse_rad = norm(y_true - y_loba,2)/n_test
print("MSE Lobachesky: $mse_rad")
MSE Radial: 16.72734733632836MSE Kriging: 13.172782774903606MSE Lobachesky: 6.851538959982479