fza fzt vc lc Ra
1 0.50 0.10 40 emulsion 1.915556
2 1.25 0.10 40 emulsion 3.515556
3 0.50 0.20 40 emulsion 1.065556
4 1.25 0.20 40 emulsion 1.965556
5 0.50 0.15 20 emulsion 1.765556
6 1.25 0.15 20 emulsion 3.265556
MRR optimization subject to roughness constraint learning 2
Loading libraries, defining experimental design, and getting measurement results.
The same as done previously.
SVR radial model
<-
normalized_rec recipe(Ra ~ ., data = plan_train) %>%
step_normalize(fza,fzt,vc) %>%
step_dummy(all_nominal_predictors())
<-
svm_r_spec svm_rbf(cost = 3.17, rbf_sigma = 0.0774) %>%
set_engine("kernlab") %>%
set_mode("regression")
<-
svm_wflow workflow() %>%
add_model(svm_r_spec) %>%
add_recipe(normalized_rec)
<- fit(svm_wflow, data = plan_train) svm_final_fit
augment(svm_final_fit, new_data = plan_test) %>%
rsq(truth = Ra, estimate = .pred)
# A tibble: 1 × 3
.metric .estimator .estimate
<chr> <chr> <dbl>
1 rsq standard 0.894
augment(svm_final_fit, new_data = plan_test) %>%
rmse(truth = Ra, estimate = .pred)
# A tibble: 1 × 3
.metric .estimator .estimate
<chr> <chr> <dbl>
1 rmse standard 0.300
<- svm_final_fit %>%
svm_fit extract_fit_parsnip()
svm_fit
parsnip model object
Support Vector Machine object of class "ksvm"
SV type: eps-svr (regression)
parameter : epsilon = 0.1 cost C = 3.17
Gaussian Radial Basis kernel function.
Hyperparameter : sigma = 0.0774
Number of Support Vectors : 23
Objective Function Value : -19.2442
Training error : 0.169076
Optimization of material removal rate with Ra contraint learning
First MRR function is defined.
<- function(x){
MRR
<- 2
z <- 25
Db <- 14
Dt <- Db-Dt
Dh
<- 250*z*(Db^3/(Dh*Dt))*x[3]*((x[1]*10^-3)/x[2])*sqrt((x[1]*10^-3)^2 + (x[2]*Dh/Db)^2)
f1
return(f1)
}
Writing Cubist constraint. Change lc ("emulsion"
or "mql"
) as desired.
<- function(x) {
g1 <- predict(svm_final_fit, new_data = data.frame(fza = x[1],
g1 fzt = x[2],
vc = x[3],
lc = "emulsion")) - (2 - 0.4441)
return(g1)
}
Testing objective function and constraint.
<- c(0.875, 0.15, 40)
x_test MRR(x_test)
[1] 781.3187
g1(x_test)
.pred
1 0.4580388
Fitness function considering Objective function and penalty term regarding constraint.
<- function(x)
fitness
{ <- MRR(x)
f <- sqrt(.Machine$double.xmax) # penalty term
pen <- max(g1(x),0)*pen # penalisation for 1st inequality constraint
penalty1 - penalty1 # fitness function value
f }
Defining algorithims to the optimization.
<- c("ALO", "DA", "GWO", "MFO", "WOA")
ALGOS
# c("ABC", "ALO", "BA", "BHO", "CLONALG", "CS", "CSO", "DA", "DE", "FFA", "GA", "GBS", "GOA", "GWO", "HS", "KH", "MFO", "PSO", "SCA", "SFL", "WOA")
# Convergiram:
# "ABC", "ALO", "DA", "DE", "GWO", "MFO", "PSO", "WOA"
# Tempo satisfatorio entre os que convergiram:
# "ALO", "DA", "GWO", "MFO", "WOA"
Optimization.
result_meta
$result
var1 var2 var3
ALO 0.9102454 0.2 60
DA 0.9102454 0.2 60
GWO 0.9100841 0.2 60
MFO 0.9102454 0.2 60
WOA 0.9102452 0.2 60
$optimumValue
optimum_value
ALO 1219.144
DA 1219.144
GWO 1218.928
MFO 1219.144
WOA 1219.144
$timeElapsed
user system elapsed
ALO 59.65 1.53 61.80
DA 55.92 1.42 57.70
GWO 58.91 1.77 61.05
MFO 57.36 1.81 59.63
WOA 59.11 1.47 61.14