Skip to main content

loares

Library for Optimisation Algorithm Research

PyPI

loares provides modular, composable optimisation algorithms built on top of pymoo. It includes the BxR (Best-x-worst Recombination) family of algorithms, an experiment runner with multiprocessing support, and automated post-processing with performance metrics and statistical analysis.

Installation

pip install loares

Usage

Running Experiments

import numpy as np
from pymoo.problems.multi import ZDT1
from pymoo.algorithms.moo.nsga2 import NSGA2

from loares.algorithms.bxr.moo import MO_BMR, MO_BWR
from loares.experiments.pymoo_runner import ExperimentRunner, AlgoFactory

problem = ZDT1()
seeds = np.arange(1, 6)

algorithms = [
    AlgoFactory(MO_BMR, pop_size=100),
    AlgoFactory(MO_BWR, pop_size=100),
    AlgoFactory(NSGA2, pop_size=100),  # stock pymoo algorithms work too
]

for factory in algorithms:
    runner = ExperimentRunner(problem, factory, max_evals=25000, test_name="zdt1-test")
    runner.multi_run(seeds, threads=4)

Post-Processing

from loares.experiments.pymoo_process import PostProcess

pp = PostProcess(
    test_dir="zdt1-test/raw_data",
    algo_grps={"BXR": ["MO-BMR", "MO-BWR"], "common": ["NSGA2"]},
    true_front=ZDT1().pareto_front(500),
    gen_rf=False,
    plot_convergence=True,
    plot_pareto=True,
)
pp.run(threads=4)

Post-processing generates:

  • Per-seed final metrics (GD, IGD, HV, Spacing)
  • Mean convergence histories as Parquet files
  • Convergence plots per algorithm group
  • Pareto front plots (2D, 3D, or parallel coordinates)
  • Net summary CSV across all algorithms

Statistical Analysis

from pathlib import Path
from loares.experiments.analysis.stats import run as run_stats

stats_dir = run_stats(Path("zdt1-test/analysis-2026-01-01-12-00-00/100"), alpha=0.05)
# Produces Friedman test results and post-hoc comparisons

Architecture

loares algorithms are built from composable pymoo operators:

  • Recombination: BxR operators (BMR, BWR, BMWR)
  • Pool Selection: Best-worst selection from sorted population
  • Mutation: Random reinitialisation
  • Mods: Local search, opposition-based learning, edge boosting
  • Survival: pymoo's RankAndCrowding (MOO) or FitnessSurvival (SOO)
  • Sub-populations: Adaptive splitting via HV-based policy

Custom algorithm assembly:

from loares.core.composable import ModularAlgorithm, RecombinationVariant
from loares.core.recombination import BMR
from loares.core.pool_selection import BestWorstSelection
from loares.core.mutation import RandomReinit
from loares.core.mods import LocalSearchMod

algo = ModularAlgorithm(
    name="Custom-BMR",
    pop_size=100,
    infill=RecombinationVariant(
        pool_selection=BestWorstSelection(),
        recombination=BMR(),
        mutation=RandomReinit(prob=0.5),
    ),
    mods=[LocalSearchMod()],
)

Output Format

Experiment results are stored as HDF5 files with one file per seed:

test_name/raw_data/{algorithm}/{psize}-{max_evals}/
    seed_001.h5
    seed_002.h5
    ...
    Info.json

Each HDF5 file contains:

  • metadata/ -- problem info, algorithm info, seed
  • function_evals/{n_eval}/ -- X (decision variables), F (objectives), G (constraints) at each snapshot
  • final_dict_json -- final population as JSON attribute

Requirements

Python >= 3.11

License

See LICENSE file for details.

Metadata

Release files for loares 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loares 1.0.4
File Size Uploaded Provenance Actions
loares-1.0.4.tar.gz 128.6 kB With provenance Details for loares-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for loares 1.0.4
File Interpreter ABI Platform Actions
loares-1.0.4-py3-none-any.whl Python 3 none any Details for loares-1.0.4-py3-none-any.whl

Total release size: 170.6 kB

Release files / loares-1.0.4.tar.gz

Download URL loares-1.0.4.tar.gz
Size 128.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1aa04b88689c9694c1315eee1d9ea8cb80fa1c6231b11c9bc565b0367498bff5
BLAKE2b-256 checksum
How to use checksums
a312d2d8888fdc965b23efcf506b60db8c7ba84a22f27e3757a4a0cc8f255261
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 10, 2026.

Transparency log

Release files / loares-1.0.4-py3-none-any.whl

Download URL loares-1.0.4-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab080d0c7e74845b79d67a7d9e515c35e038afcec2060c40284196e3875a7579
BLAKE2b-256 checksum
How to use checksums
fd98297c7be916ccbed7907694d31bcb5cd4c7ebb295df97c71c223ec62e7965
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 10, 2026.

Transparency log

Security for loares 1.0.4

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.

Select from 2 files

Attestation for loares-1.0.4.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 10, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page