Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

cmenpy

License: GPL v3 PyPI - Version PyPI - Python Version PyPI - Wheel PyPI - Downloads

Docs Publish Testing Typed

Compute Metaheuristic Engine for Python (cmenpy or /siːmɛnpaɪ/) is an extensible, flexible, and vectorized Python framework for designing and prototyping metaheuristic and population-based optimization algorithms.

It provides the clean abstractions necessary to build custom evolutionary algorithms, swarm intelligence methods, and hybrid heuristics from scratch — with absolute architectural control.

Installation

pip install cmenpy          # runtime: NumPy + Numba only

Requires Python >=3.11.

To develop or build the docs:

git clone https://github.com/ltsim/cmenpy.git
cd cmenpy
uv sync --extra dev        # tests, type checks, linters
uv sync --extra docs       # ... plus the MkDocs toolchain

Quick example

import numpy as np
import cmenpy as cm


@cm.declare(x=cm.Argument[int, (0, 3), 2])
def my_algorithm(args, epoch, ctx):
    pop = cm.PopulationSwarm(ctx.buff)
    pop.compute << ctx.rng.uniform(
        ctx.bounds.low, ctx.bounds.up, (pop.size, ctx.bounds.ndim)
    )
    # ... one epoch of your operator ...


best_fitness, best_x = my_algorithm(x=1).solve(
    lambda x: np.sum(x**2), cm.Bounds([(-1, 1)] * 3), epochs=150, pop_size=15
)

See the Quickstart for both the function (@cm.declare) and class (@cm.template) styles.

Core pillars

  • Vectorized data structures. Population arrays, agent states, and search spaces use a flattened, vectorized layout with no per-individual objects, interfacing natively with NumPy and Numba.
  • Extensible architecture. Custom operators, mutation rules, or entirely new paradigms require overriding only a few decoupled, well-defined methods.
  • Non-monolithic flexibility. No visualization tools, file exporters, or rigid loggers — just the mathematical engine and its structural flow.
  • Research ready. Licensed under the GNU GPLv3. Design, modify, and distribute your algorithms freely; derivative works stay open, keeping the software a public good for research and commercial development.

Documentation

Full guides and the API reference are published at ltsim.github.io/cmenpy.

Guide Covers
Quickstart Solve your first problem in minutes
Models @cm.declare vs @cm.template, the ctx object
Build a custom model Step-by-step tutorial implementing your own optimizer
Numba kernels @cm.precompile, @cm.vectorize, @cm.reduce
Population PopulationSwarm, buffers, selection, ranking
Target functions Objectives, NFE budget, vectorized targets
Examples Runnable algorithms in example/
API reference Full reference for every public symbol, by category
Changelog Release notes

To preview locally: uv sync --extra docs && .venv/bin/mkdocs serve.

Contributing

Contributions are welcome — see CONTRIBUTING.md and the list of contributors.


Developed by LTSIM @ 2026. Licensed under GNU GPLv3.

Metadata

Release files for cmenpy 2026b0

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

Source distribution (sdist)

Source distribution for cmenpy 2026b0
File Size Uploaded Provenance
cmenpy-2026b0.tar.gz 63.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cmenpy 2026b0
File Interpreter ABI Platform
cmenpy-2026b0-py3-none-any.whl Python 3 none any Details

Total release size: 143.7 kB

Release files / cmenpy-2026b0.tar.gz

Download URL cmenpy-2026b0.tar.gz
Size 63.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bcdb935a71ec7f9ce953b8cfc53eb54267385802265e2218a344c54e50f33cd2
BLAKE2b-256 checksum
How to use checksums
ed5e63f2ae6d72f87aba40f6aa70cc23943d24f3dbf59db3f04211da60bf61e9
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 Oct 14, 2026.

Transparency log

Release files / cmenpy-2026b0-py3-none-any.whl

Download URL cmenpy-2026b0-py3-none-any.whl
Size 80.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7273bc5a741e0a9984a2db2f6113c28540938e2cf212a47d6cb43fe79977e077
BLAKE2b-256 checksum
How to use checksums
447eb239a2fe76cbc59a90c2bf85c530b99804f3d75e3ea0c1d2beb37c455f27
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 Oct 14, 2026.

Transparency log

Security for cmenpy 2026b0

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cmenpy-2026b0.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 Oct 14, 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.

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