jaya {Jaya} | R Documentation |
Jaya Algorithm for Single-Objective Optimization
Description
Implements the Jaya optimization algorithm for single-objective optimization. The algorithm minimizes or maximizes the given objective function over specified bounds.
Usage
jaya(
fun = NULL,
lower,
upper,
popSize = 50,
maxiter,
n_var,
seed = NULL,
suggestions = data.frame(),
opt = "minimize",
objectives = NULL,
constraints = list(),
early_stopping = FALSE,
tolerance = 1e-06,
patience = 10,
adaptive_pop = FALSE,
min_popSize = 20,
max_popSize = 100,
parallel = FALSE,
cores = NULL
)
Arguments
fun |
Objective function to be minimized or maximized (single-objective). |
lower |
Vector of lower bounds for the decision variables. |
upper |
Vector of upper bounds for the decision variables. |
popSize |
Size of the population for the optimization process. |
maxiter |
Maximum number of iterations. |
n_var |
Number of decision variables. |
seed |
Optional random seed for reproducibility. |
suggestions |
Optional data frame of initial population suggestions. |
opt |
Specify whether to "minimize" or "maximize" the objective function. |
objectives |
(optional) A list of functions for multi-objective optimization. |
constraints |
(optional) A list of constraints as functions returning <= 0 for feasibility. |
early_stopping |
Logical. If TRUE, stops optimization early based on tolerance and patience. |
tolerance |
Numeric. Tolerance for early stopping. |
patience |
Integer. Number of iterations to wait for improvement before stopping early. |
adaptive_pop |
Logical. If TRUE, enables adaptive population size adjustment. |
min_popSize |
Integer. Minimum population size for adaptive adjustment. |
max_popSize |
Integer. Maximum population size for adaptive adjustment. |
parallel |
Logical. If TRUE, enables parallel computation for evaluating population. |
cores |
Integer. Number of cores to use for parallel computation. Defaults to all available cores minus one. |
Value
A list containing the following: - 'Best': The best solution found (variable values and objective function value). - 'Iterations': Best objective function values at each iteration.
Examples
# Example: Single-objective optimization
sphere_function <- function(x) sum(x^2)
result <- jaya(
fun = sphere_function,
lower = rep(-5, 3),
upper = rep(5, 3),
popSize = 20,
maxiter = 50,
n_var = 3,
opt = "minimize"
)
print(summary(result))
plot(result)