Skip to content

Releases: process-intelligence-research/ENFORCE

v2.0.0

Choose a tag to compare

@giacomolastrucci giacomolastrucci released this 30 Oct 13:54
9f460cc

ENFORCE 2.0.0 is a modular redesign of the package. The projection method and its results are unchanged; the API is new.

Breaking changes. Code written for 1.x needs to be ported. Start from the README quick start and the tutorial notebooks in notebooks/tutorials/.

Highlights

  • Any PyTorch backbone. ENFORCEConstrainedModel wraps any nn.Module; the test suite trains Transformer and GNN backbones through the same Trainer / Evaluator.
  • Modular package. enforce.core (Scaler, Constraint, Constraints), enforce.layers (the ENFORCE projection layer), enforce.losses, enforce.models, enforce.engines (Trainer, Evaluator) and enforce.data, each with its own config.
  • Vectorised constraint blocks. Constraint(fn, size, jac) holds many equations in one block, with an optional analytical Jacobian. Equalities go in c=, inequalities in g=; inequalities can be vectorised too.
  • Faster Jacobians. With many constraints written one per equation, or with inequalities, the Jacobian is about 12-19x faster than in 1.0.4. Vectorised constraints and analytical Jacobians are as fast as before.
  • Simpler behaviour. Supervised or self-supervised mode follows from the loss, adaptive activation is handled inside the layer, prediction works under torch.no_grad(), and Scaler follows the device of its inputs, so models run on GPU without extra steps.

Reproducibility

The paper benchmarks reproduce 1.0.4: loss curves and test predictions are bitwise identical for function fitting, sin_ineq, pooling, extraction column and nonconvex linear; nonconvex nonlinear differs by about 1e-8 (rounding).

Installation

Install the PyTorch build for your hardware first, then:

pip install enforce-nn
pip install "enforce-nn[examples]"   # matplotlib and pandas for the notebooks and benchmark scripts

Also in this release

  • Clearer validation errors (constraint shapes, max_it, empty constraint sets).
  • Documentation: contributing guide, code of conduct, issue and pull request templates, CITATION.cff ("Cite this repository"), and AGENTS.md for coding agents.
  • CI: the README quick start runs as a test, and the built wheel is installed and tested in a clean environment.

Known limitations

Trainer and Evaluator batch by slicing one input tensor: backbones need a batch-first tensor input and flat outputs. DataLoaders, dict inputs and variable-size graph batches are planned.

Contributors

Giacomo Lastrucci, Daniel Schicksnus.

Resolved issues: #20, #24, #26, #27, #28.

Full changelog: v1.0.4...v2.0.0

v1.0.4

Choose a tag to compare

@giacomolastrucci giacomolastrucci released this 26 May 10:30
acb51bb

What's Changed

Full Changelog: v1.0.3...v1.0.4

v1.0.3

Choose a tag to compare

@giacomolastrucci giacomolastrucci released this 29 Apr 14:09
f4d5bea

What's Changed

  • refactor: restructure src/ → enforce/ with core/, data/, engines/ sub… by @giacomolastrucci in #11

Full Changelog: v1.0.2...v1.0.3

v1.0.2

Choose a tag to compare

@giacomolastrucci giacomolastrucci released this 29 Apr 14:08
190d8d5

What's Changed

Full Changelog: v1.0.1...v1.0.2

v1.0.1 - Fix image rendering on PyPI

Choose a tag to compare

@giacomolastrucci giacomolastrucci released this 29 Apr 07:27
464f50d

Fixes broken images in the README (graphical abstract and contributor profile picture) by replacing relative paths with absolute GitHub raw URLs. No code changes.

Initial public release of ENFORCE v1.0.0

Choose a tag to compare

@giacomolastrucci giacomolastrucci released this 29 Apr 07:03

ENFORCE is a hard-constrained neural network framework for nonlinear constrained learning. It combines a neural network backbone with AdaNP (Adaptive-depth Neural Projection), an SQP-inspired Gauss-Newton correction module that drives predictions to feasibility with respect to nonlinear equality and inequality constraints at inference time, no constrained solvers needed during training and inference.

Highlights:

  • Exact feasibility for affine constraints in a single projection step
  • ε-feasibility for general nonlinear constraints with linear convergence
  • Inequality constraints handled via a Fischer-Burmeister reformulation
  • Train with standard unconstrained optimizers (Adam)