Skip to content
aalbataPublic

About

Browser tool for constrained engineering design with a clonal selection algorithm, and a Python implementation of the 57 CEC 2020 real-world constrained optimization problems checked against the official MATLAB code.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

clonalopt

clonalopt is an open-source tool for constrained engineering design. It searches for the design variables that minimize an objective while every constraint is met, with a clonal selection algorithm, a search method based on the clonal selection principle of the immune system. The tool runs a page in your web browser on your own computer, and nothing is uploaded. A problem can be chosen from the 57 problems of the CEC 2020 real-world constrained optimization suite, typed as formulas in the page, or written as a Python function.

This repository holds the software, the per-run results of its evaluation and the scripts that produce every figure, table and quoted number of the paper that describes it.

Folder or file Content
clonalopt/ The tool (search method, browser interface, examples and tests), the evaluation scripts and the per-run results in clonalopt/evaluation/results
rwcop/ Python implementation of the 57 problems of the suite, checked against the official MATLAB code, with its tests and the outputs of the check
paper/ Scripts that produce the figures, tables and quoted numbers of the paper, with their outputs
reproduce.py Repeats the analysis from the shipped results, reruns a sample of the runs, or repeats the whole study
requirements.txt Versions of the Python packages used for the paper
SHA256SUMS.txt Checksums of the shipped result and data files

Install

clonalopt needs Python 3.10 or newer and NumPy. From the folder of this file:

pip install ./rwcop ./clonalopt

Both packages are installed from this repository; they are not published on PyPI. They were tested on Windows 11 Enterprise with Python 3.12.10 and NumPy 2.5.2.

Start

python -m clonalopt

The page opens at http://127.0.0.1:8765/ and can be reached only from your own computer. Choose a problem and press Run. While the search runs, the page shows the objective, the constraint violation and the convergence curves; the best design and its constraint values are listed when each run finishes. The user guide walks through a first run, both ways of defining your own problem, the Python interface, the meaning of every result and downloaded column, and troubleshooting; clonalopt/README.md gives a shorter overview with the search method and its references.

Data tables of 17 problems

The power system problems RC34 to RC43 and the livestock feed problems RC51 to RC57 use 15 data tables of the official code of the suite. The organizers' repository states no license, so the tables are not part of this repository. The first time one of these problems is evaluated, rwcop downloads the file SOFTWARE.zip (43 KB) from a fixed commit of https://github.com/P-N-Suganthan/2020-RW-Constrained-Optimisation, checks its SHA-256 checksum and keeps the tables in a folder on your computer. Without internet access, obtain SOFTWARE.zip by other means and run python -m rwcop.official_data --from-zip SOFTWARE.zip.

Results with the default settings

The default settings were chosen on 12 development problems, two from each category. Each of the 57 problems then received 25 runs of 100,000 evaluations, and the best design of each run was recorded after 1,000, 10,000 and 100,000 evaluations.

Category Problems Feasible in most runs (1,000 / 10,000 / 100,000) Near the best known value (1,000 / 10,000 / 100,000)
Chemical processes 7 4 / 5 / 6 0 / 0 / 1
Process synthesis and design 7 7 / 7 / 7 5 / 6 / 6
Mechanical design 19 18 / 18 / 18 5 / 9 / 9
Power systems 11 1 / 2 / 8 0 / 1 / 1
Power electronics 6 6 / 6 / 6 0 / 1 / 1
Livestock feed rations 7 2 / 3 / 5 0 / 1 / 3
All problems 57 38 / 41 / 50 10 / 18 / 21
Problems not used for tuning 45 29 / 32 / 39 8 / 14 / 17
  • Problems: number of problems in the category.
  • Feasible in most runs: number of problems on which more than half of the 25 runs ended with a design that meets every constraint.
  • Near the best known value: number of problems whose median run, with runs ordered by the feasibility rules, is feasible and has an objective f with f - f* <= 0.01 max(1, |f*|), where f* is the best known value of the problem.

The results of each problem are in clonalopt/evaluation/results/summary.md and summary.csv; the columns of summary.csv are defined at the top of clonalopt/evaluation/summarize.py. A run of 10,000 evaluations took a median of 0.37 seconds over the 57 problems on a laptop with an Intel Core Ultra 7 155U processor and 15.5 GB of memory under Windows 11 Enterprise, one run at a time.

Reproduce the results

Install the package versions used for the paper and both packages, then run reproduce.py:

pip install -r requirements.txt
pip install ./rwcop ./clonalopt
python reproduce.py
Command What it does Time on the laptop above
python reproduce.py Recomputes the summaries, the selection of the default settings, the figures, the tables and the quoted numbers from the shipped per-run results, runs both test suites, and lists every recomputed file that differs from the shipped copy less than one minute
python reproduce.py --check 20 Reruns 20 shipped evaluation runs and 20 shipped tuning runs, chosen at random, and compares them with the shipped records value for value about one minute
python reproduce.py --full --workers 10 Moves the shipped results to clonalopt/evaluation/results_shipped, reruns the 6,072 tuning runs, the 264 runs without the step-size control, the 1,425 evaluation runs and the timing, compares the new records with the shipped ones, and recomputes everything else about one hour

Run times, and the numbers derived from them, differ between computers, and the bytes of the figures depend on the installed fonts and library versions. On the laptop above, every file recomputed by python reproduce.py was identical to the shipped copy.

Two parts of the study need other software and are not repeated by reproduce.py: the screenshot of the interface (python clonalopt/tools/screenshot.py paper/figures, which needs Microsoft Edge or Google Chrome) and the check of the problem library against the official MATLAB code (rwcop/README.md, which needs MATLAB).

Tests

cd rwcop
python -m pytest
cd ../clonalopt
python -m pytest

The library has 187 tests and the tool 123. The tests of the 17 problems with official data tables are skipped, with the reason, when the tables cannot be downloaded.

License

MIT, see Licence.txt. The official data tables of the suite are not part of this repository and are not covered by this license.

Citation

Citation information is in CITATION.cff.

Contact

Ali Al Bataineh, Higher Colleges of Technology, Abu Dhabi, United Arab Emirates, aalbataineh@hct.ac.ae

About

Browser tool for constrained engineering design with a clonal selection algorithm, and a Python implementation of the 57 CEC 2020 real-world constrained optimization problems checked against the official MATLAB code.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages