Learn R Programming

rmoo - R Multi-Objective Optimization

Overview

rmoo is a non-dominated sorting based multi-objective optimization package built upon the ‘GA’ package. It provides a comprehensive, flexible, and modular framework for multi/many-objective optimization. Users have a wide range of configuration options at their disposal, including the representation of real-values, permutations, and binaries.

The algorithms available in rmoo include GA, NSGA-I, NSGA-II, R-NSGA-II, and NSGA-III.

Installation

You can install the stable version on R CRAN:

install.packages("rmoo")

Or you can install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("Evolutionary-Optimization-Laboratory/rmoo")

Usage

All the algorithms implemented in rmoo are called throught rmoo function. It will receive all the necessary parameters for execution. In this simple example, we solve the DTLZ1 problem, using the NSGA-III:

library(rmoo)

DTLZ1 <- function (x, nobj = 3, ...) 
{
    if (is.null(dim(x))) {
        x <- matrix(x, 1)
    }
    n <- ncol(x)
    y <- matrix(x[, 1:(nobj - 1)], nrow(x))
    z <- matrix(x[, nobj:n], nrow(x))
    g <- 100 * (n - nobj + 1 + rowSums((z - 0.5)^2 - cos(20 * 
        pi * (z - 0.5))))
    tmp <- t(apply(y, 1, cumprod))
    tmp <- cbind(t(apply(tmp, 1, rev)), 1)
    tmp2 <- cbind(1, t(apply(1 - y, 1, rev)))
    f <- tmp * tmp2 * 0.5 * (1 + g)
    return(f)
}

ref_points <- generate_reference_points(3,12)

result <- rmoo(fitness = DTLZ1,
               type = "real-valued",
               algorithm = "NSGA-III",
               lower = c(0,0,0),
               upper = c(1,1,1),
               monitor = FALSE,
               summary = FALSE,
               parallel = FALSE,
               nObj = 3,
               reference_dirs = ref_points,
               popSize = 92,
               maxiter = 300)

The rmoo package has a set of S4 method that can help the user to visualize, analysis, and interpret the results.

We are going to show how use the plot method, since depending on the parameter it will display difference plots, e.g. passing “pcp” as parameter for type, the method displays the Parallel Coordinate Plot:

plot(result, type="pcp")

Another example of plot method is when no parameters are passed, the method by default display the scatter plot. It evaluates the result dimensionality and depending on this, it will display 2-D, 3-D or Pairwise Scatter Plot.

#Scatter without optimal points
plot(result)

When displaying the scatter plot, reference points can be passed as parameters of the optimal argument, allowing the results to be compared to them:

#Scatter with optimal points (Using reference points as optimal points)
plot(result, optimal = result@reference_points)

Other plots available in rmoo are heatmap and polar coordinate, both allow the user to view specific solutions.

#Polar Coordinates
plot(result, type="polar", individual = c(1:3))

#Heatmap Plot
plot(result, type="heatmap", individual = c(1:3))

Other methods available in rmoo that may be of interest are getFitness(), getPopulation(), getMetrics(), print(), summary() and others. We do not show the functionality of all these functions since they will be detailed in depth in the future article and vignettes.

Citation

Until the submission of the formal article that introduces rmoo, please cite using:

Benitez F., Pinto-Roa Diego P. (2023). rmoo: Multi-Objective Optimization in R. R package version 0.2.3 https://CRAN.R-project.org/package=rmoo/.

BibTeX entries for LaTeX users:

@Manual{,
    title = {{rmoo}: Multi-Objective Optimization in R},
    author = {Francisco Benitez and Diego P. {Pinto-Roa}},
    year = {2023},
    note = {R package version 0.2.3},
    url = {https://CRAN.R-project.org/package=rmoo/},
}

or

@INPROCEEDINGS{10418638,
    author={Francisco, J. Benítez and Diego, P. Pinto-Roa and Miguel, García-Torres and Parameshachari, B. D.},
    booktitle={2023 IEEE CHILEAN Conference on Electrical, Electronics Engineering, Information and Communication Technologies (CHILECON)}, 
    title={A Hybrid Approach for Many-Objective Feature Selection in Intrusion Detection on Windows Operating Systems}, 
    year={2023},
    volume={},
    number={},
    pages={1-6},
    doi={10.1109/CHILECON60335.2023.10418638/}}

Copy Link

Version

Install

install.packages('rmoo')

Monthly Downloads

352

Version

0.3.2

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Francisco Benitez

Last Published

May 4th, 2026

Functions in rmoo (0.3.2)

nsga1-class

Class 'nsga1'
plot

Methods for Function 'plot' in Package 'rmoo'
progress

Methods for Function 'progress' in Package 'rmoo'
nsga

Non-Dominated Sorting in Genetic Algorithms
print

Methods for Function 'print' in Package 'rmoo'.
nsga3-class

Class 'nsga3'
nsga3

Non-Dominated Sorting in Genetic Algorithms III
rmoo_tourSelection

Tournament Selection
rmoo_lrSelection

Linear Rank Selection
rmooMonitor

Monitor the execution of rmoo
rmooControl

A function for setting or retrieving defaults non-dominated genetic operators
nsga2

Non-Dominated Sorting in Genetic Algorithms II
sharing

Calculation of Dummy Fitness
nsga2-class

Class 'nsga2'
scale_reference_directions

Scale Reference Points
reference_point_multi_layer

Determination of Multi-layer Reference Points
rmoo_huxCrossover

Half Uniform Crossover (HUX)
rmoo_Population

Population initialization in non-dominated genetic algorithms
kroC100

KROC100
numberOrNAOrMatrix-class

Virtual Class 'numberOrNAOrMatrix - Simple Class for subassigment Values'
getFitness

Accessor methods to the fitness for rmoo results
getDummyFitness

Accessor methods to the dummy fitness for NSGA-I results
rnsga2-class

Class 'rnsga2'
rnsga2

Reference Point Based Non-Dominated Sorting in Genetic Algorithms II
rmoo_main

R Multi-Objective Optimization Main Function
startParallel

Start Parallel Backend for rmoo Package
summary

Methods for Function 'summary' in Package 'rmoo'
rmoo-package

rmoo: Multi-Objective Optimization in R
kroB100

KROB100
performance_metrics

Objective Values performance metrics
rmoo_Mutation

Mutation operators in non-dominated genetic algorithms
rmoo_uxMutation

Uniform Mutation
rmoo_uxCrossover

Uniform Crossover
rmooreal_sbxCrossover

Crossover Operators in Non-Dominated Genetic Algorithms
stopParallel

Stop Parallel Backend
update_points

Adaptive normalization of population members
algorithm-class

Virtual Parent Class Algorithm
associate

Association Operation in Non-Dominated Genetic Algorithms III
nsga-class

Virtual Class 'nsga'
non_dominated_fronts

Calculate of Non-Dominated Front
calc_norm_pref_distance

Calculate Normalized Preference Distance Computes the weighted normalized Euclidean distance between a set of fitness vectors and a set of reference points.
generate_reference_points

Determination of Reference Points on a Hyper-Plane
crowding_distance

Calculation of Crowding Distance
getCrowdingDistance

Accessor methods to the crowding distance for NSGA-II results
getMetrics

Accessor methods to the metrics evaluated during execution
getPopulation

Accessor methods to the population for rmoo results
get_fixed_rowsum_integer_matrix

Determine the division points on the hyperplane
kroA100

KROA100
modifiedCrowdingDistance

Calculation of Modified Crowding Distance
niching

Niche-Preservation Operation