Safety-First Optimization · Ethical Constraints · Python 3.10+ · 2026
Version 0.1.2 · Safety-First Optimization Core

MAAT-Core

A minimal Python framework for experimenting with optimization under explicit ethical and safety constraints. Unsafe solutions are not filtered later — they become mathematically dominated by design.

Safety and values are part of the math itself.
v0.1.2current release
Python 3.10+requirement
MITopen-source license
DOI10.5281/zenodo.18489336
What's New

Version 0.1.2 — Better inspection & tracing

Extends the core with four new inspection layers while keeping the existing optimization API fully stable.

New API

core.evaluate(state)

Returns a structured breakdown: field totals, Occam penalty, constraint penalty, feasibility flag, and minimum margin — all in one call.

evaluation = core.evaluate(best_state) # → fields, occam, constraints, feasible, min_margin
New API

Diagnostics.constraints(…)

Typed constraint reports with margin, violation magnitude, penalty, and status — making safety auditable at a glance.

details = Diagnostics.constraints( core.constraints, state, safety_lambda=core.safety_lambda )
New API

core.seek_trace(…)

Records the optimization trace for reflection loops, CSV-ready export, and analysis plots. Use trace_every=5 to control granularity.

traced = core.seek_trace( state_fn, x0=[0.9], bounds=[(0, 1)], trace_every=5 )
Diagnostic

CCI support & demos

Diagnostic Critical Coherence Index without changing the optimizer objective, plus a transition simulation demo and full plotting pipeline.

cci = core.cci_report(state, instability=0.25, production=1.0, coherence=1.0, constraints=1.0 )
Pipeline

Full MAAT-Core data flow

From field definitions to the diagnostic CCI report — every step is inspectable.

Fields
weighted objectives
Constraints
g(state) ≥ 0
seek / seek_trace
L-BFGS-B · annealing
evaluate()
full breakdown
CCI report
stability index
Plain language

What MAAT-Core is

A compact framework for ethical decision-making in optimization. Instead of "optimize first, constrain later", MAAT-Core places Respect constraints directly into the objective using strong penalties and interpretable margin diagnostics.

  • Hard-ish constraints via large safety penalties
  • Constraint margins expose how close you are to violations
  • Local + global search (L-BFGS-B, dual annealing)
  • Reflection loop adapts safety strength from diagnostics
When to use

Best-fit scenarios

MAAT-Core shines when feasibility, transparency, and explicit constraints matter more than raw throughput.

  • Decision support with mandatory safety / fairness / legal bounds
  • Regulated or high-stakes domains (healthcare, policy, finance)
  • Prototyping constraints before moving to larger ML systems

Not ideal for: high-dimensional deep RL loops or real-time systems requiring millisecond decisions.

How it works

Values become weighted fields; safety becomes an inequality constraint. The optimizer searches within the ethically admissible region.

Objective

The MAAT-Core loss

Safety penalty dominates whenever a constraint is violated — unsafe states are never optimal by definition.

L(state) = Σ wᵢ · fᵢ(state) + λ_safety · Σ max(0, −g_j(state))² + λ_occam · complexity(state) g(state) ≥ 0 → SAFE g(state) < 0 → VIOLATION (dominated)
Code example

Minimal usage

Define fields, add a Respect constraint, and call seek.

from maat_core import Field, Constraint, MaatCore H = Field("Harmony", lambda s: s.dissonance, weight=0.9) R = Constraint("Respect", lambda s: 0.6 - s.val) core = MaatCore(fields=[H], constraints=[R], safety_lambda=1e6) result = core.seek(state_fn, x0=[0.5], bounds=[(0, 1)]) report = core.constraint_report(state_fn(result.x[0])) # Respect: margin = 0.0000 (SATISFIED - at boundary)

Five use cases

MAAT-Core is a small experimental toolbox — not a black-box AI, but a transparent optimization thinking engine.

Ethical AI

Model values like Harmony, Risk, Fairness as fields and find solutions that balance them under hard safety rules.

🛡

Safety-first

Define forbidden regions with Respect constraints. Unsafe solutions are mathematically dominated — never returned.

🧭

Decision support

Prototype multi-criteria decisions: policy choices, resource allocation, system tuning, planning under constraints.

🔬

Research

Test ideas: complexity regularization, global vs local optimizer differences, safety penalty strength, feasibility limits.

📚

Teaching

Ideal for optimization theory, AI ethics, explainable decision systems, and interactive notebooks.

Worked examples

Concrete scenarios showing where ethical constraints change the outcome.

Healthcare

Allocation under fairness constraints

Allocate beds across departments under capacity and fairness bounds. MAAT-Core returns an interpretable compromise rather than a single-utility extreme.

# constraints Capacity: Σ beds ≤ 200 Fairness: each dept ≥ 50 Utility: maximize lives saved / bed
Infeasibility

Detecting ethical infeasibility

MAAT-Core reveals when constraints remain violated even as λ_safety grows — a signal the ethical requirement is unsatisfiable in the current search space.

# evaluation output min_margin: -0.1432 (VIOLATION) feasible: False → Structural infeasibility detected. Not "fake compliance" — explicit flag.

Installation guide

Requires Python 3.10+. Clone & install, editable dev mode, or directly from GitHub.

Step-by-step

Clone & install

1
Clone the repository
git clone https://github.com/Chris4081/maat-core.git cd maat-core
2
Create a virtual environment
python3 -m venv .venv source .venv/bin/activate
3
Install
python -m pip install . # normal python -m pip install -e . # editable dev
4
Run a demo
python examples/reflection_demo.py python examples/cci_critical_transition_demo.py
Quick path

Install directly from GitHub

pip install "git+https://github.com/Chris4081/maat-core.git"

No clone needed — installs the latest main branch directly.

Key example scripts

  • examples/healthcare_ethics_demo.py
  • examples/respect_boundary_demo.py
  • examples/reflection_demo.py — CSV trace
  • examples/cci_critical_transition_demo.py
  • examples/occam_demo.py

Reproducibility

python -m pip freeze > requirements-lock.txt

Use deterministic seeds for annealing. Core stays fully offline and dependency-minimal.

Try MAAT-Core in your browser

Interactive demo: safety-first optimization with a hard ethical constraint. Move the sliders and hit Optimize.

9.5
7
10

          

What does this mean?

Natural optimum: Where the system would go without ethical constraints.

Optimized state: Final decision after applying safety constraints.

Objective value: Cost of the final state (lower is better).

Constraint margin: Distance to the safety boundary (≥ 0 means safe).

Distance to ideal: How much ethics "pulls" the solution away from pure utility.

Status: Whether the final state respects all ethical constraints.

Diagnostic

Critical Coherence Index

In MAAT-Core v0.1.2 the CCI is a non-invasive diagnostic report. It does not alter the optimizer objective but identifies whether the system is in a stable, critical, or unstable regime near constraint boundaries.

CCI = destabilizing contributions / stabilizing contributions CCI < 1 → stable CCI ≈ 1 → critical / transitional CCI > 1 → unstable
Usage

CCI in MAAT-Core

Call cci_report after optimization to get a stability snapshot alongside your constraint evaluation.

cci = core.cci_report( best_state, instability = 0.25, production = 1.0 + best_state.cost, coherence = 1.0, constraints = 1.0 + max(0, margin), correction = 1.0, interaction = 1.0, )
< 1stable
≈ 1critical
> 1unstable
read-onlydiagnostic only

Cite MAAT-Core

If you use MAAT-Core in your research, please cite the Zenodo paper.

Paper reference

Krieg, Christof (2026)

Christof Krieg (2026). Respect as a Hard Constraint in Ethical Decision-Making: A Safety-First Optimization Core (MAAT-Core). DOI: 10.5281/zenodo.18489336
BibTeX

Copy & paste

@misc{krieg2026maatcore,
  title  = {Respect as a Hard Constraint in
            Ethical Decision-Making: A
            Safety-First Optimization Core
            (MAAT-Core)},
  author = {Krieg, Christof},
  year   = {2026},
  publisher = {Zenodo},
  doi    = {10.5281/zenodo.18489336},
  url    = {https://doi.org/10.5281/zenodo.18489336}
}

Frequently asked questions

Common questions about the design, scope, and limits of MAAT-Core.

Is this a machine learning library?

No. MAAT-Core is a deterministic optimization framework, not a statistical model. It uses classical numerical optimizers (L-BFGS-B, dual annealing) with explicit ethical constraints.

How is this different from CVXPY or classical optimizers?

MAAT-Core makes ethical and safety constraints first-class mathematical objects with margin diagnostics — not post-hoc filters. Constraint satisfaction is interpretable and auditable at every step.

What does "Respect as a hard constraint" mean?

Constraints are written as margins g(state) ≥ 0. If violated, a strong penalty makes unsafe solutions mathematically dominated. The optimizer never willingly returns a violating result.

What is a "constraint margin"?

A signed distance-to-safety value: positive = safe, zero = at the boundary, negative = violation magnitude. Margins make constraint satisfaction interpretable and auditable.

What happens if constraints are impossible to satisfy?

MAAT-Core reports persistent negative margins and flags structural infeasibility — not a "fake ethical" solution. There is no silent compliance.

Can this scale to neural models?

Yes in principle. Fields can wrap neural nets or any black-box function, while MAAT-Core stays minimal and focused on constraint-first diagnostics.

What is the CCI and does it affect optimization?

The Critical Coherence Index is a diagnostic-only metric. It does not change the optimizer objective but helps identify stable, critical, or unstable regimes near constraint boundaries.

Why L-BFGS-B and dual annealing?

L-BFGS-B is a strong baseline for box-constrained local search; dual annealing provides global exploration. MAAT-Core is optimizer-agnostic — swap engines if needed.

Impressum

Legal

Angaben gemäß § 5 TMG

Christof Krieg
Independent Research / MAAT Project
Wertheim am Main, Deutschland

Dieses Projekt dient der wissenschaftlichen und ethischen Forschung. Es stellt keine rechtliche, medizinische oder finanzielle Beratung dar.