Skip to main content

DesignOptPy workspace

This directory contains DesignOptPy, a Python implementation of point optimization and Solution Space Optimization (SSO). DesignOptPy selects design variables that meet requirements. Point optimization searches for one best design. Solution space optimization searches for a region of acceptable designs. Start with the example navigation guide for guided tutorials, mathematical examples, and physical applications.

The tests check each behavior against expectations that follow from the mathematics.

Solve and check a design

An objective receives a sample-major array: one design per row and one variable per column. It returns one scalar objective value per row.

import numpy as np
from designoptpy.point import Bounds, OptimizationProblem, solve

problem = OptimizationProblem(
    objective=lambda x: np.sum((x - [1.0, -2.0]) ** 2, axis=1),
    initial_design=np.array([[0.0, 0.0]]),
    bounds=Bounds([-3.0, -3.0], [3.0, 3.0]),
)
result = solve(problem, "scipy-minimize")
if not result.success:
    raise RuntimeError(f"{result.status}: {result.message}")
np.testing.assert_allclose(result.point, [1.0, -2.0], atol=1e-3)
assert result.objective_value < 1e-6
print(np.round(result.point, 3))  # [ 1. -2.]

The objective is a sum of squares, so its analytic minimum is zero at [1, -2]. Comparing the result with this known answer is a stronger check than checking termination alone. For constrained problems, also evaluate the final physical residuals. A budget-limited or infeasible outcome needs inspection before the design is used.

A stochastic search depends on random sampling. An integer seed passed as rng makes the search reproducible:

from designoptpy.point import DifferentialEvolutionOptions

result = solve(
    problem,
    "differential-evolution",
    options=DifferentialEvolutionOptions(rng=7, population_size=30, max_iterations=100),
)
assert result.objective_value < 1e-4  # Exact floating-point output varies.

Choose a component guide for the task:

Task Read
One smooth design with bounds and c(x) <= 0 constraints Point optimization, then the scipy-minimize adapter.
One design with a nonsmooth or multimodal objective Point optimization: pattern search or seeded differential evolution.
A region of designs meeting inclusive response limits Solution space optimization and the bounded starting recipes.
An expensive evaluator Surrogate models and active learning.
Interactive inspection of a design box Box X-Ray application.
Truss responses for requirements Truss analysis.
Shared evaluation, geometry, and numerics Core.

Distributions

The repository is a uv workspace with independently installable distributions. A workspace manages related Python projects together. uv installs and runs the selected dependency environment. A distribution is an installable project. Its import namespace is the prefix that loads its Python modules. The umbrella designoptpy installs the whole family. An extra is an optional dependency group that a user selects at install time.

Distribution Import namespace Responsibility
designoptpy No code of its own Umbrella installing the complete family and all extras
designoptpy-core designoptpy.core Shared input/result rules, numerics, geometry, plotting, and input and output (I/O)
designoptpy-point designoptpy.point Point optimization
designoptpy-surrogate designoptpy.surrogate Surrogate models and active learning
designoptpy-sso designoptpy.sso Solution spaces, product families, and reusable X-Ray engine
designoptpy-truss designoptpy.truss Truss analysis and models
designoptpy-xray designoptpy.xray Interactive X-Ray application and console command

X-Ray is an interactive view of a box of designs. Each panel projects sampled requirement results onto two design variables.

Each component owns its source, tests, metadata, README, changelog, wheel, and source archive. A wheel is an installable Python distribution archive. Components and the umbrella can have separate versions and releases. The umbrella wheel contains metadata only.

examples/ is a development member. tooling/ supports development and is not published as library modules.

Installation and availability

Use a CPython version that the requires-python metadata of the selected distribution accepts. CPython is the standard Python implementation. Every distribution accepts Python 3.12 to 3.14. This checkout defines the intended package names. The release owner must verify publication and registry ownership. A package index stores distributions for installation. After the packages are published to your index, run:

python -m pip install designoptpy        # all components, X-Ray, workbook, color, and symbolic extras
python -m pip install designoptpy-point  # point optimization and its dependencies only

For source development, run from designoptpy:

uv sync --locked --all-packages --group dev
# Or select one component and its runtime dependencies:
uv sync --locked --package designoptpy-point --no-dev

To install the complete source family with pip before publication, pass all local projects together. Pip does not resolve uv workspace sources.

python -m pip install . ./packages/designoptpy-core ./packages/designoptpy-point ./packages/designoptpy-surrogate ./packages/designoptpy-sso ./packages/designoptpy-truss ./apps/designoptpy-xray

For point optimization alone, pass ./packages/designoptpy-core and ./packages/designoptpy-point together.

Extras and requirements:

  • Core offers the optional extras io, colors, and all.
  • Point offers the optional extras symbolic and all. symbolic adds SymPy for exact symbolic coefficient extraction.
  • The umbrella installs core and point with all of their extras, so it declares no extras of its own.
  • Only the surrogate component requires scikit-learn.
  • Every component that uses SciPy requires scipy>=1.12,<2.
  • Every component and the X-Ray application require matplotlib>=3.11,<4. Older Matplotlib cannot draw a three-dimensional polygon collection, such as a surface, with facecolor="none".

Read a version with importlib.metadata.version("designoptpy-point") or version("designoptpy"). The namespace follows Python Enhancement Proposal (PEP) 420 and has no designoptpy/__init__.py. Separate wheels can therefore contribute designoptpy.* packages without sharing source files.

Python API conventions

  • Design collections have shape (n_samples, n_dimensions).
  • Python indices are zero-based: the first index is 0.
  • Stochastic entry points take one random-generator argument named rng. Their results can vary with random sampling. The argument is a numpy.random.Generator, a nonnegative integer seed, or None. numpy.random.default_rng converts it. A Generator is used directly. An integer seed creates a new seeded generator. None draws fresh operating-system entropy.
  • Operators and strategy callbacks receive the generator of the running method. Examples are genetic-algorithm operators and candidate samplers. They also name it rng, but they require a Generator.
  • Four defaults use a fixed seed instead of fresh entropy, so default fits and reported metrics are reproducible:
    • designoptpy.surrogate.validation.cross_validate has rng=None, and its fold partition then uses CROSS_VALIDATION_PARTITION_SEED.
    • designoptpy.surrogate.classification.train_svm_classifier has rng=None, and its hyperparameter search then uses SVM_HYPERPARAMETER_SEED.
    • CascadeForwardSurrogate.rng and GaussianProcessSurrogate.rng default to the seed 0.
  • The Monte Carlo estimate_measure of planar and corner SSO regions takes an integer seed instead. The sample count and the seed also identify its cached estimate.
  • Shared array aliases (FloatArray, BoolArray, IntArray) and coercion helpers live in designoptpy.core.arrays; integer arrays use numpy.int64. An alias gives an array type a reusable name. Coercion converts accepted inputs to the required array type.
  • Public APIs use typed dataclasses and protocols. A dataclass stores named settings or result fields. A protocol specifies required methods and attributes without requiring inheritance from one class. This interface-based compatibility is structural typing.
  • Missing or unprocessed data remains None; it is not converted to zero.
  • Names follow Python conventions, including the solver names of designoptpy.point.solve.
  • Choice names follow one rule, the choice-name rule of designoptpy.core.choices. A choice option takes one name from a fixed set: a solver, a sampler, a metric, a plot style, a file format, and so on. A user-supplied name matches a valid name when both are equal after this normalization: the ASCII letters A to Z become a to z, and _ reads as -. No other character changes: spaces are not trimmed, no character is removed, and letters outside ASCII keep their case. So "Two_Point" names "two-point", but " two-point" and "twopoint" name nothing. The parsed value is the canonical name, the spelling of the library. Records, logs, result files, repr text, and error messages show the canonical name, and an error for an unknown name lists the canonical names. Two valid names of one set never have the same normalized text; a check rejects such a set. The rule makes every case and separator spelling of one name select the same choice, in DesignOptPy and in DesignOptRs. SciPy distance names match the SciPy names, aliases, and test_ forms under the rule and reach SciPy in its spelling. Column and field names in data files and workbooks, option keys, file paths, and free-text labels are not choice names. Their readers keep their own rules.
  • Plotting functions return Matplotlib figures, axes, or artists and do not change global figure defaults.

Terms of the result contract:

  • A mapping returns responses.
  • An evaluator compares those responses with requirements.
  • Result records keep contextual metadata fields. Nested payloads use descriptive names such as response_metadata and evaluation_metadata.
  • A good design meets all performance requirements.
  • A physically feasible design meets all physical feasibility requirements.
  • A valid design is good and physically feasible.
  • A model rejection, represented by +inf, means that the model gave no usable response.
  • A projection legend says "good design" when no physical feasibility requirement exists. Otherwise, it says "valid design" for the accepted category.

SSO keeps the count of requested designs. Optional evaluation metadata keeps composite evaluation costs. These include compensation evaluation counts and multifidelity uncertainty flags. Pass save_evaluation_metadata=True when later inspection needs these per-design records.

Each component README states its method, options, result signals, and supported numeric domain. The core README states the shared evaluator and mapping result contract.

from designoptpy.core.geometry import Box
from designoptpy.point import Bounds, OptimizationProblem, solve
from designoptpy.sso import BoxSsoOptions, optimize_box

Stability labels

Each public item of the five library distributions has one of three labels: Stable, Not yet in DesignOptRs, or Python only. The label tells whether DesignOptRs, the Rust implementation in the designoptrs folder of the repository, shares the behavior. It also tells a caller what to expect when the item changes, and what replaces the item in DesignOptRs.

  • Stable: DesignOptRs has a counterpart, and DesignOptRs tests check the agreement. A counterpart is a public item of a DesignOptRs library component with the same behavior under the shared names: the option names and values, the result field names, and the status values. The library components are the native numerical crates. The interfaces to other languages and the native lesson programs do not count. The tests compare with reference vectors, which are recorded DesignOptPy inputs and outputs, or check invariants for random behavior. Stable does not promise that the interface never changes. It promises that DesignOptPy and DesignOptRs change it together, with changelog entries in both. A caller can use the counterpart in DesignOptRs with the same names and the same behavior.
  • Not yet in DesignOptRs: DesignOptRs has no counterpart, or the counterpart is incomplete: an option, a field, or a value is missing. The contract can change in DesignOptPy alone until a promotion gives the item a complete counterpart. A caller finds no complete counterpart in DesignOptRs yet. All quality rules still apply: correct mathematics, truthful result signals, documentation, and behavior tests. The label does not mean that the item is unfinished. It does not say whether DesignOptRs will take over the item.
  • Python only: the item is an adapter that wraps SciPy, scikit-learn, or SymPy, and a caller selects or passes it. An adapter converts the inputs and results between a third-party library and the DesignOptPy interface. DesignOptRs fills the role of the adapter with a native algorithm, so the adapter gets no counterpart. The marker names that native algorithm. A caller uses it in DesignOptRs instead of the adapter. The results of the two implementations can differ, because the algorithms differ. The contract can change in DesignOptPy alone, for example when the wrapped library changes. All quality rules still apply.

Theory: DesignOptPy is the reference implementation for learning, research, and experimentation. DesignOptRs is the stable, fast implementation, and it takes over confirmed DesignOptPy behavior. A shared behavior must change in both implementations at the same time, so a stable item changes only in a coordinated change. An item that is not yet in DesignOptRs has no such tie, so its contract can follow new research results in DesignOptPy first. The selected adapters get no counterpart by policy: they give DesignOptPy callers the methods of SciPy, scikit-learn, and SymPy, and DesignOptRs does not call Python libraries. DesignOptRs fills the same roles with native algorithms, with their own names and options.

Where the label appears:

  • An unmarked public item is stable, except for the names that the scope below places outside the labels. Only the items labeled Not yet in DesignOptRs or Python only carry a marker.
  • The docstring of a marked item has a paragraph directly after its summary line, so help() shows it. The paragraph starts with one of three texts:
    • Not yet in DesignOptRs: this contract can change in DesignOptPy alone.
    • Not yet in DesignOptRs: the DesignOptRs counterpart is incomplete (<what is missing>). This contract can change in DesignOptPy alone.
    • Python only: this adapter wraps <SciPy, scikit-learn, or SymPy>. DesignOptRs fills this role with its native <algorithm> and has no counterpart. A marker that covers several adapters uses the plural: "these adapters wrap" and "these roles".
  • A module docstring marker covers every public name of the module. A class marker covers its members. A marker at the start of a parameter, attribute, or result field description covers that entry. A sentence in a parameter description can label individual option values.
  • In a component README, the first paragraph of the section that documents a marked item starts with the same text. When the section also documents stable items, the paragraph that introduces the marked item starts with it. A table row ends its description with "Not yet in DesignOptRs." or "Python only.". A heading never carries the label, so links stay valid after a promotion.
  • Search the docstrings and READMEs for Not yet in DesignOptRs: and Python only: to find every marked item. No README keeps a list of them.

Scope:

  • Labels apply to the public API of designoptpy-core, designoptpy-point, designoptpy-surrogate, designoptpy-sso, and designoptpy-truss.
  • The example, tutorial, and research programs in examples/, the X-Ray application, the workspace tooling, and private names (names that start with an underscore) carry no label. They hold no importable contract that DesignOptRs mirrors.
  • Host-language infrastructure names are outside the labels, so they carry no marker. This group holds the NumPy array aliases and coercion helpers, the validation predicates, the record base classes, the typing Protocols, the exception classes, ConsoleLogging, the clock and format helpers, and the Matplotlib figure, style, and color helpers. These names adapt the algorithms to Python, and they carry no behavior that DesignOptRs mirrors. Each implementation provides these services in the idiom of its own language.
  • A third-party adapter that a caller selects or passes is Python only when DesignOptRs fills its role with a native algorithm. Examples are the SciPy point solvers and SklearnRegressorSurrogate. An adapter whose role DesignOptRs does not fill is Not yet in DesignOptRs. A default inner optimizer or a scikit-learn learner factory is outside the labels when DesignOptRs fills the same role with a native algorithm. Its docstring names that native algorithm. The results of the two implementations can differ, because the algorithms differ.
  • The DesignOptRs documentation carries no label.

Module map

This table names the module that owns each responsibility.

Responsibility Module
Bottom-up mappings and design evaluation designoptpy.core.mapping, designoptpy.core.evaluation, designoptpy.sso.evaluation
Sampling, region distances, and input validation designoptpy.core.sampling, designoptpy.core.regions, designoptpy.core.validation
Convex hulls, boxes, and ellipsoids designoptpy.core.geometry
Numerical differentiation, integration, and signal filtering designoptpy.core.numdiff, designoptpy.core.integrate, designoptpy.core.signal
Classification metrics designoptpy.core.metrics
Colors and figure handling designoptpy.core.plotting
Run logging and spreadsheet parsing designoptpy.core.io
Point optimization and linear-quadratic coefficient extraction designoptpy.point
Surrogate models, active learning, and classifier plots designoptpy.surrogate
Solution spaces and batch studies designoptpy.sso
Product-family design designoptpy.sso.family
X-Ray engine and workbook reader designoptpy.sso.xray
X-Ray interactive window designoptpy.xray
Truss analysis designoptpy.truss

Matplotlib supplies the plotting primitives, including arrows. Results keep the normalized solver data in typed records.

Internal boundaries

The distributions follow domain boundaries:

  • designoptpy.core owns shared protocols and foundations.
  • designoptpy.point, designoptpy.surrogate, designoptpy.sso, and designoptpy.truss may depend on core but not on one another.
  • No library module imports the X-Ray application.
  • The application may use SSO and core, but not the unrelated point, surrogate, or truss modules.

These rules are executable contracts in pyproject.toml. The local static quality checks verify them with import-linter. Users can install one component or use the umbrella for the complete family.

Executable inputs and untrusted files

Optimization, sampling, mapping, and X-Ray evaluator callbacks run ordinary Python code. They have the permissions of the current process. A callback is a supplied function that an operation calls. The X-Ray option --evaluator MODULE:ATTRIBUTE imports and runs that module. Use callbacks, evaluator modules, and saved model files only from sources that you trust.

The safe input contract covers data that the readers parse without running supplied code. This data is workbooks, comma-separated values (CSV) tables, and spreadsheet literals. Pickle and joblib files can run code while they load. Loading them, arbitrary Python modules, or untrusted model files is outside this contract. The core README states the limits that the readers apply to untrusted files. These limits do not sandbox code. A sandbox restricts the access of code to the computer.

Development and releases

The workspace runs all quality assurance (QA) checks locally. It uses no hosted continuous integration (CI) service. Before review, run both commands from designoptpy against the same source:

uv run python run_local_quality_checks.py
uv run python run_all_tests.py --fail-on-skips

Each run keeps its reports in a new .artifacts/YYYY-MM-DD-HH-MM-SS_<lane>/ folder. CONTRIBUTING.md explains component ownership, test rules, stability labels, local checks, security checks, and the release process.

DesignOptPy is licensed under the MIT OR Apache-2.0 license. Each library and the application identify MIT OR Apache-2.0 in their own LICENSE-MIT, LICENSE-APACHE, and project metadata. examples/ identifies MIT OR Apache-2.0 in its LICENSE-MIT, LICENSE-APACHE, and project metadata. The examples include the quadrotor catalogue data in examples/application_examples/data/quadrotor_catalogues/. Consult the license files shipped with the component or artifact that you use.

Metadata

Release files for designoptpy 0.1.0

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

Source distribution (sdist)

Source distribution for designoptpy 0.1.0
File Size Uploaded Provenance Actions
designoptpy-0.1.0.tar.gz 60.9 kB Without provenance Details for designoptpy-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 75.3 kB

Release files / designoptpy-0.1.0.tar.gz

Download URL designoptpy-0.1.0.tar.gz
Size 60.9 kB
Tags Source
SHA-256 checksum
How to use checksums
634a3d846ed8666fbc7b56229609d985145be36240ff5340f303cdbbdbc6096b
BLAKE2b-256 checksum
How to use checksums
047769eca659776de1ffcd17fd164d99751ce212da053208d9d4bfcc38db7443
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.17

Release files / designoptpy-0.1.0-py3-none-any.whl

Download URL designoptpy-0.1.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3076e7945f402b18b209e79be662500874df2bd4da57eb13957ab22e860206cc
BLAKE2b-256 checksum
How to use checksums
2a3f60b999b554205d366848e7ae8988a1e299fd34280e60996253ca074168bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.17

Security for designoptpy 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.

Release history Release notifications | RSS feed

This release

0.1.0 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