Skip to main content

mmahelpy

mmahelpy is a small, stateful implementation of the Method of Moving Asymptotes (MMA). It solves a separable convex approximation at each call and retains the design and asymptote history for the next outer iteration.

The package is independent of finite-element and topology-optimization libraries. Supply objective and inequality-constraint values and gradients at the current point. Constraints use the convention g(x) <= 0.

Install

pip install mmahelpy

Example

import numpy as np
from mmahelpy import MMA, MMAOptions

optimizer = MMA(MMAOptions(move_limit=0.2))
x = np.array([0.8, 0.8])
lower = np.zeros(2)
upper = np.ones(2)

for _ in range(30):
    # Minimize x[0]**2 + x[1]**2 subject to x[0] + x[1] >= 0.9.
    objective = float(x @ x)
    objective_gradient = 2.0 * x
    constraints = np.array([0.9 - x.sum()])
    constraint_jacobian = np.array([[-1.0, -1.0]])
    result = optimizer.step(
        x,
        objective,
        objective_gradient,
        constraints,
        constraint_jacobian,
        lower,
        upper,
    )
    x = result.x

print(x)

Create one MMA object per optimization run. Its step method returns an MMAResult with the next design, dual multipliers, approximate constraint values, and dual-solver status. Call reset() to reuse the object for a new problem. Multiple inequality constraints are supported.

Development

PYTHONPATH=src pytest

Both the distribution and Python import are named mmahelpy. Scikit-Topt depends on mmahelpy and adapts its public MMA_Config to the generic optimizer for topology optimization. The solver focuses on continuous, differentiable problems with box bounds and inequality constraints.

Release

Update the version in pyproject.toml, create a matching GitHub release such as v0.1.1, and publish it. The workflow runs the test suite on Python 3.10–3.13 before publishing to PyPI with Trusted Publishing. Configure the PyPI trusted publisher for repository kevin-tofu/mmahelpy, workflow workflow.yml, and environment pypi before creating a release.

Metadata

Release files for mmahelpy 0.1.1

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

Source distribution (sdist)

Source distribution for mmahelpy 0.1.1
File Size Uploaded Provenance Actions
mmahelpy-0.1.1.tar.gz 10.6 kB Without provenance Details for mmahelpy-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 20.5 kB

Release files / mmahelpy-0.1.1.tar.gz

Download URL mmahelpy-0.1.1.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e3a2e526ef9e34ddcc0a9720bad0b10195822e0521ae0b91e61812f764643fbc
BLAKE2b-256 checksum
How to use checksums
f740a989e90bb741b4274a2cb145a8214df77a542bc4bce5099ca86b4e5d57f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / mmahelpy-0.1.1-py3-none-any.whl

Download URL mmahelpy-0.1.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbe9f3126e263871d53bb2dde5f76b0661c12ff3654ee1839d115c6996afe443
BLAKE2b-256 checksum
How to use checksums
2167bdd3d79add6b0c38280b95477800ea218acd1d53ff7bc15f8aa9964bef7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for mmahelpy 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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