Introduction: what is XLEMOO?
Note
The reader is assumed to be familiar with the basic concepts of multiobjective optimization.
XLEMOO (Explainable learnable multiobjective optimization) is a Python framework for evolutionary multiobjective optimization enhanced with machine learning. The core idea is to utilize both Darwinian inspired evolutionary algorithms and interpretable machine learning models together to find a population of near-Pareto optimal solutions to a multiobjective optimization problem. This combination of evolutionary algorithms and machine learning gives raise to two modes: a Darwinian mode and a learning mode. These modes have been illustrated in Figure 1.
Figure 1: A Darwinian and learning mode depicted. From [Misitano2023a].
In utilizing interpretable machine learning models, we have the ability to build a rudimentary understanding on what kind of solutions in a population are good and what kind are less good or bad. In practice, this means finding what kind of decision variables are needed to produce near-Pareto optimal solutions. This understanding gives raise to the explainable nature of the XLEMOO approach.
Currently, the Darwinian mode of the XLEMOO approach is a simple indicator-based evolutionary multiobjective optimization method that utilizes a reference point provided by a decision maker to guide the optimization process towards desirable near-Pareto optimal solutions. The evolutionary method in the Darwinian mode employs the crossover, mutation, and selection operators as shown in Figure 1 (left).
For further details and a more in-depth description of the XLEMOO approach, please see
the publication related to the XLEMOO framework [Misitano2023a]. The framework relies on
the interpretable machine learning models implemented in the imodels Python package [Singh2021] and on the
DESDEO framework [Misitano2021] for interactive multiobjective optimization. The approach is based on the
idea of learnable evolutionary models proposed originally in [Michalski2000].
Getting started
In this section, instructions are given to install the XLEMOO framework and verify it is working correctly.
Note
These instructions have been verified to work on a Linux-based operating system. They should apply to other *nix systems as well and Windows.
Tools required to install the framework according to the current documentation are git, Poetry, and Python version 3.9 or 3.10. It is highly advised that users utilize Poetry to install the framework.
Installation
Begin by cloning the XLEMOO repository and changing the working directory to the root of the repository:
$ git clone https://github.com/gialmisi/XLEMOO
$ cd XLEMOO
Next, create a new virtual environment with poetry and switch to it:
$ poetry shell
Then, install the framework with the command:
$ poetry install
or with development dependencies included:
$ poetry install --with dev
The XLEMOO framework should now be installed locally on your machine.
Tests
XLEMOO utilized pytest for unit testing, which is included in the development dependencies. Before continuing, make sure development dependencies are installed:
$ poetry install --with dev
To run the unit tests, run:
$ pytest --reruns 5
Note
The --reruns 5 options is used to ensure that some tests are run multiple times in case of failure. Because
of the heuristic nature of some computations, all tests may not always pass due to some numerical checks.
This is expected.
If everything is working as expected, the tests should all pass with no errors (some warnings are expected).
Next steps
The XLEMOO framework should now be fully functional and the reader is welcome to utilize the framework however they like. Below are a couple of suggestions for next steps from here:
An usage example of the XLEMOO framework is given in Notebooks.
How to use and start modifying the framework is briefly discussed in Basic usage.
Steps to reproduce the numerical experiments in [Misitano2023a] are presented in Reproducibility.
The API documentation provides more documentation on the specific parts of the code found in the framework.
Reproducibility
In this section, the steps required to reproduce the main experimental results in [Misitano2023a] (referred to as the article in this section) will be presented.
Warning
Because of the heuristic nature of the XLEMOO algorithms, the exact same results shown in the article might be impossible to reproduce with 100% accuracy. However, results, especially the statistical ones, should be close to what was originally reported. The data ([Misitano2023b]) referred to at the end of this section is the original data used to produce the heatmap and line plots of the article.
Requirements
snakemake is the main tool utilized to enable the reproducible workflow of the experiments discussed in the article.
Note
The reader is assumed to have an intermediate knowledge of the Python programming language and be familiar with the basic usage of snakemake.
Example
An example is provided in this section to reproduce the data for the vehicle crash worthiness problem. To begin, make sure the development dependencies of the XLMEOO framework have been installed:
$ poetry install --with dev
This ensures the installation of snakemake and other tools needed to run the experiments.
In the Snakefile found at the root of the XLMEOO repository, there are three rules that will be important:
rule all_parameters_experiment: used to run the experiments to produce the raw numerical data;rule all_statistics: utilizes the raw numerical data to compute statistics; andrule all_heatmaps: produces the heatmaps shown in the article.
The above rules will automatically run multiple sub-rules with different parameter configurations.
For the line plots in the article, the file plot_many_per_frequency.py in the XLEMOO/scripts directory has been used.
This script relies on the statistics produced by the all_statistics rule defined in the Snakefile.
The parameters used in the rules defined in the Snakefile are set in the experiments.yaml file at the root
of the XLEMOO project. In the file, make sure under # problem conf the parameters related to the
vehicle crash worthiness problem are uncommented. The parameters for the other two problems should be commented
(multiple clutch brakes and carside impact problem).
To reproduce the raw numerical data and statistical data, run the following command:
$ snakemake --cores 4 all_statistics -k --retries 100
The --cores parameter may be adjusted to match the number of available cores on your machine; the -k
parameter tells snakemake to continue executing the rules even if a previous rule fails; and the --retries 100
parameter tells snakemake to retry failed rules at least 100 times before giving up.
Note
Due to the heuristic nature of the experiments, some rules may fail multiple times. A 100 retries may be not enough. In case some rules do not get executed without error, then rerunning the above command will retry the failed rules at least a 100 times before giving up. Failing to execute some rules is expected behavior.
After the statistical data has been produced successfully (all sub-rules have been executed without errors), the heatmaps may be generated utilizing the command:
$ snakemake --cores 4 all_heatmaps
which will produce the heatmaps shown in the article.
To produce the line plots in the article, the script plot_many_per_frequency.py can be run. In the script,
at the top, make sure the data_dir and problem_name are correctly set.
For an example on how the histograms present in the article have been generated, see this example notebook.
Archived experiment data
The data used to produce the results in the article [Misitano2023a] have also been stored on Zenodo [Misitano2023b]. This includes the raw numerical data and the statistical data.
Basic usage
Note
Before proceeding, it is highly suggested to first read [Misitano2023a] to gain a good understanding of the basic idea of the algorithms implemented in the XLEMOO framework.
The XLEMOO framework can be modified to many different extents. In this section, the basic functionality of the algorithm implemented in the framework is described.
To get started, it is good to first
understand the basic flow of the main algorithm implemented in the LEMOO class,
which is illustrated in Figure 2. The XLEMOO framework makes use of the population
class defined in the desdeo-emo module of the DESDEO framework [Misitano2021].
The documentation of desdeo-emo is available here.
Figure 2: The basic flow of the algorithm implemented in the LEMOO class. \(N^D\) represents how many times a Darwinian mode is executed during a single iteration; \(N^L\) represents how many times a learning mode is executed during a single iteration; and \(N^T\) is the total number of iterations to be executed. From [Misitano2023a].
The LEMOO class takes many parameters, which are documented in the
API documentation. These are:
EAParams: Parameters related to the evolutionary algorithm used in a Darwinian mode.MLParams: Parameters related to the machine learning model used in a learning mode.LEMParams: Generic parameters for the learnable evolutionary method.
Currently, a simple indicator based evolutionary multiobjective optimization algorithm has been implemented in
the XLEMOO framework. If one wishes to change the Darwinian or learning modes in the algorithm,
the methods darwinian_mode and
learning_mode can be modified or overridden.
To run the LEMOO method, either execute the run method, which will
utilize threshold values to determine when to switch between modes, or
the run_iterations method, which will run the LEMOO method for a set number of iterations
in each mode.
To get a solid grasp on how the framework works, it is recommended to check the basic usage example in the Notebooks section. Especially this notebook given an example how an XLMEOO method can be used as an interactive multiobjective optimization method.
Citation
If you utilize the XLEMOO framework in your own work, it would be greatly appreciated if you cited the publication [Misitano2023a].
References
Note
References will be updated when published.
Misitano, G. (2023). Exploring the Explainable Aspects and Performance of a Learnable Evolutionary Multiobjective Optimization Method. ACM Transactions on Evolutionary Learning and Optimization. To be published.
Misitano, G. (2023). XLEMOO numerical experiment data. https://doi.org/10.5281/zenodo.8085637
Misitano, G., Saini, B. S., Afsar, B., Shavazipour, B., & Miettinen, K. (2021). DESDEO: The Modular and Open Source Framework for Interactive Multiobjective Optimization. IEEE Access (Vol. 9, pp. 148277–148295). Institute of Electrical and Electronics Engineers (IEEE). https://doi.org/10.1109/access.2021.3123825
Singh, C., Nasseri, K., Tan, Y., Tang, T., & Yu, B. (2021). imodels: A Python package for fitting interpretable models. Journal of Open Source Software (Vol. 6, Issue 61, p. 3192). The Open Journal. https://doi.org/10.21105/joss.03192
Michalski, R. S. (2000). In Machine Learning (Vol. 38, Issue 1/2, pp. 9–40). Springer Science and Business Media LLC. https://doi.org/10.1023/a:1007677805582