R/sboa_methods.R

Defines functions plot.sboa print.sboa

Documented in plot.sboa print.sboa

#' Print method for SBOA objects
#'
#' Prints a summary of an SBOA optimization result.
#'
#' @param x An object of class \code{"sboa"}.
#' @param ... Additional arguments, ignored.
#'
#' @return The input object, invisibly.
#' @method print sboa
#' @export
print.sboa <- function(x, ...) {
  cat("Secretary Bird Optimization Algorithm (SBOA)\n")
  cat("Best objective value:", signif(x$value, 6), "\n")
  cat("Dimension:", length(x$par), "\n")
  cat("Number of iterations:", length(x$convergence), "\n")
  invisible(x)
}

#' Plot method for SBOA objects
#'
#' Plots the convergence curve of an SBOA optimization result.
#'
#' @param x An object of class \code{"sboa"}.
#' @param ... Additional graphical arguments passed to \code{graphics::plot()}.
#'
#' @return No return value. Called for its side effect.
#' @method plot sboa
#' @export
plot.sboa <- function(x, ...) {
  graphics::plot(
    x$convergence,
    type = "l",
    xlab = "Iteration",
    ylab = "Best objective value",
    main = "SBOA Convergence Curve",
    ...
  )
}

Try the SBOAtools package in your browser

Any scripts or data that you put into this service are public.

SBOAtools documentation built on May 3, 2026, 9:06 a.m.