mmapy source package
mmapy 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 mmapy 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
The distribution is named mmahelpy because the mmapy name is already
used on PyPI. The installed import remains mmapy. 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.
Metadata
Release files for mmahelpy 0.1.0
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 |
|---|---|---|---|---|
| mmahelpy-0.1.0.tar.gz | 10.2 kB | Without provenance | Details for mmahelpy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mmahelpy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mmahelpy-0.1.0-py3-none-any.whl |
Total release size: 23.4 kB
Release files / mmahelpy-0.1.0.tar.gz
| Download URL | mmahelpy-0.1.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76e601e8cff51e0503702fd8e8e22406174c24eb2f421d89aa9472b9aaf0ed27
|
|
BLAKE2b-256 checksum How to use checksums |
b1bb896027421a2714972f7beb9e6e585df48d57558b68bdb1c1232ab0d6d105
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.12 Linux/6.8.0-138-generic
|
Release files / mmahelpy-0.1.0-py3-none-any.whl
| Download URL | mmahelpy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a10b2197ff8866072bc5985619f74ab705cf0d2dc1fcf4093bdecf96715041c6
|
|
BLAKE2b-256 checksum How to use checksums |
7aaf9afa9b8f24ef8c24a4d5babd9676df59d2ea74fdad3a413927ccfbf7b08b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.12 Linux/6.8.0-138-generic
|
Security for mmahelpy 0.1.0
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.