f1_1 = function(x) (x[1]**4 - 2*x[1]**2 + x[2]**2 + 1)
f2_1 = function(x) ((x[1] + 0.5)**2 + (x[2]-2)**2)
f3_1 = function(x) ((x[1] + 0.25) ** 4 + 3 * (x[2] - 1) ** 2)
f_2d2d = function(x) c(f1_1(x), f2_1(x))
f_2d3d = function(x) c(f1_1(x), f2_1(x), f3_1(x))
f1_2 = function(x) (x[1]**4 - 2*x[1]**2 + x[2]**2 + 1 + x[3] ** 2)
f2_2 = function(x) ((x[1] + 0.5)**2 + (x[2]-2)**2 + (x[3] - 1) ** 4)
f3_2 = function(x) ((x[1] + 0.25) ** 4 + 3 * (x[2] - 1) ** 2 + (x[3] - 1) ** 2)
f_3d2d = function(x) c(f1_2(x), f2_2(x))
f_3d3d = function(x) c(f1_2(x), f2_2(x), f3_2(x))
#' Multi-Objective Aspar Function
#'
#' @param dimensions [[`numeric`]]\cr
#' Number of dimensions
#' @param n.objectives [[`numeric`]]\cr
#' Number of objectives
#'
#' @return Multi-objective smoof function
#' @export
#'
#' @examples
#'
makeAsparFunction <- function(dimensions = 2, n.objectives = 2) {
if (dimensions == 2 && n.objectives == 2) {
smoof::makeMultiObjectiveFunction(name = "Aspar Function: 2D->2D", id = "aspar_2d2d", description = "", fn = f_2d2d,
par.set = ParamHelpers::makeNumericParamSet(len = 2, lower = c(-2,-1), upper = c(2,3)))
} else if (dimensions == 2 && n.objectives == 3) {
smoof::makeMultiObjectiveFunction(name = "Aspar Function: 2D->3D", id = "aspar_2d3d", description = "", fn = f_2d3d,
par.set = ParamHelpers::makeNumericParamSet(len = 2, lower = c(-2,-1), upper = c(2,3)))
} else if (dimensions == 3 && n.objectives == 2) {
smoof::makeMultiObjectiveFunction(name = "Aspar Function: 3D->2D", id = "aspar_3d2d", description = "", fn = f_3d2d,
par.set = ParamHelpers::makeNumericParamSet(len = 3, lower = c(-2,-1,-2), upper = c(2,3,2)))
} else if (dimensions == 3 && n.objectives == 3) {
smoof::makeMultiObjectiveFunction(name = "Aspar Function: 3D->3D", id = "aspar_3d3d", description = "", fn = f_3d3d,
par.set = ParamHelpers::makeNumericParamSet(len = 3, lower = c(-2,-1,-2), upper = c(2,3,2)))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.