loares
Library for optimisation algorithm research built on pymoo. loares provides BxR (best-x-worst recombination) algorithms plus a file-based experiment pipeline for running repeated trials, calculating indicators, and comparing algorithms statistically.
Installation
pip install loares
loares requires Python 3.11 or later.
Quick Start
The following multi-objective ZDT1 experiment follows examples/v2.py. It runs BxR variants and NSGA-II for five seeds, then writes their final-population metrics to metrics.csv.
import inspect
from pathlib import Path
import numpy as np
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.indicators.gd import GD
from pymoo.indicators.hv import HV
from pymoo.indicators.igd import IGD
from pymoo.indicators.spacing import SpacingIndicator
from pymoo.problems.multi import ZDT1
from loares.algorithms.bxr.moo import MO_BMR, MO_BWR
from loares.indicator import indicator_multi_run
from loares.run import parallel_run
runs = 5
pop_size = 100
max_evals = 25_000
problem = ZDT1()
output_dir = Path(inspect.stack()[0].filename).resolve().parent
common = {
"algorithm_kwargs": {"pop_size": pop_size},
"problem_name": "ZDT1",
"problem": problem,
"output_dir": output_dir,
"plot_kwargs": {},
}
algorithms = [
{"algorithm_name": "MO-BMR", "algorithm": MO_BMR(pop_size=pop_size)},
{"algorithm_name": "MO-BWR", "algorithm": MO_BWR(pop_size=pop_size)},
{"algorithm_name": "NSGA-II", "algorithm": NSGA2(pop_size=pop_size)},
]
algorithm_specs = [
{
"solver_kwargs": {"seed": seed, "termination": ("n_eval", max_evals)},
**common,
**algorithm,
}
for seed in range(1, runs + 1)
for algorithm in algorithms
]
parallel_run(algorithm_specs, n_threads=5)
true_front = problem.pareto_front(500)
indicator_specs = [
{"indicator_name": "GD", "indicator": GD(true_front)},
{"indicator_name": "IGD", "indicator": IGD(true_front)},
{"indicator_name": "Spacing", "indicator": SpacingIndicator()},
{"indicator_name": "HV", "indicator": HV(ref_point=[1.1, 1.1])},
]
indicator_multi_run(indicator_specs, algorithm_specs, output_dir)
parallel_run skips specs whose HDF5 result already exists. Pass overwrite=True to run every spec again.
Statistical Analysis
Use the generated metrics.csv to build a seed-by-algorithm comparison for each indicator. The example below analyses hypervolume; use GD, IGD, or Spacing to analyse a different metric.
from loares.statistics import statistical_test_1
stat_specs = [
{
"filter": {
"indicator_name": "HV",
"pop_size": pop_size,
"termination_metric": "n_eval",
"termination_value": max_evals,
"source": "optimum",
},
"pivot": {"index": "seed", "columns": "algorithm_name", "values": "value"},
}
]
statistical_test_1(stat_specs, output_dir / "metrics.csv", output_dir)
Results are written under statistical-test-1/, including Friedman results, average ranks, and Vargha-Delaney A12 matrices.
Algorithms
Preconfigured multi-objective BxR variants are available from loares.algorithms.bxr.moo:
MO_BMR,MO_BWR, andMO_BMWRMO_BMR_Opposition,MO_BWR_Opposition, andMO_BMWR_OppositionMO_BMR_Archive,MO_BWR_Archive, andMO_BMWR_ArchiveMO_BMR_S,MO_BWR_S, andMO_BMWR_S
Single-objective variants SO_BMR, SO_BWR, and SO_BMWR are available from loares.algorithms.bxr.soo. Any compatible pymoo algorithm, such as NSGA2, can be used in an algorithm spec.
Output
Each run creates an HDF5 result, a CSV containing the final optimum, and a PDF scatter plot at:
{output_dir}/{problem_name}/{termination_metric}-{termination_value}/
{algorithm_name}/{pop_size}/seed_{seed:03d}.h5
The HDF5 file stores problem and spec metadata and the X, F, and G arrays for each saved evaluation. indicator_multi_run writes or updates {output_dir}/metrics.csv.
License
See LICENSE.
Metadata
Release files for loares 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loares-2.0.1.tar.gz | 118.9 kB | With provenance | Details for loares-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loares-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for loares-2.0.1-py3-none-any.whl |
Total release size: 149.7 kB
Release files / loares-2.0.1.tar.gz
| Download URL | loares-2.0.1.tar.gz |
|---|---|
| Size | 118.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
870856737e9b3ef237ab55e7585f73bb13a5c68ac0bd43744e82143112e64d87
|
|
BLAKE2b-256 checksum How to use checksums |
4d611226dc67ecb7872618368c224b16099c61c5c3accfe5cfa383b83db33def
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logRelease files / loares-2.0.1-py3-none-any.whl
| Download URL | loares-2.0.1-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
896a99db6bacfa839111b4db5b7dfbe5c4d3e1189c0c1393cdd4067efa00375a
|
|
BLAKE2b-256 checksum How to use checksums |
4b8732370ab63c18f1cd6758cf23bb61ad4318b644f4757640449809edc90ebd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logSecurity for loares 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for loares-2.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.