Pytorch-based framework for solving parametric constrained optimization problems, physics-informed system identification, and parametric model predictive control.
See the code
Neural Modules with Adaptive Nonlinear Constraints and Efficient Regularizations (NeuroMANCER) is an open-source differentiable programming (DP) library for solving parametric constrained optimization problems, physics-informed system identification, and parametric model-based optimal control. NeuroMANCER is written in PyTorch and allows for systematic integration of machine learning with scientific computing for creating end-to-end differentiable models and algorithms embedded with prior knowledge and physics.
Simply run
pip install neuromancer
For manual installation, please refer to Installation Instructions
An extensive set of tutorials can be found in the examples folder and the Tutorials below. Interactive notebook versions of examples are available on Google Colab! Test out NeuroMANCER functionality before cloning the repository and setting up an environment.
The notebooks below introduce the core abstractions of the NeuroMANCER library, in particular, our symbolic programming interface and Node classes.
Part 2: NeuroMANCER syntax tutorial: variables, constraints, and objectives.
Part 3: NeuroMANCER syntax tutorial: modules, Node, and System class.
Quick example for how to solve parametric constrained optimization problem using NeuroMANCER, leveraging our symbolic programming interface, Node and Variable, Blocks, SLiM library, and PenaltyLoss classes.
# Neuromancer syntax example for constrained optimization
import neuromancer as nm
import torch
# define neural architecture
func = nm.modules.blocks.MLP(insize=1, outsize=2,
linear_map=nm.slim.maps['linear'],
nonlin=torch.nn.ReLU, hsizes=[80] * 4)
# wrap neural net into symbolic representation via the Node class: map(p) -> x
map = nm.system.Node(func, ['p'], ['x'], name='map')
# define decision variables
x = nm.constraint.variable("x")[:, [0]]
y = nm.constraint.variable("x")[:, [1]]
# problem parameters sampled in the dataset
p = nm.constraint.variable('p')
# define objective function
f = (1-x)**2 + (y-x**2)**2
obj = f.minimize(weight=1.0)
# define constraints
con_1 = 100.*(x >= y)
con_2 = 100.*(x**2+y**2 <= p**2)
# create penalty method-based loss function
loss = nm.loss.PenaltyLoss(objectives=[obj], constraints=[con_1, con_2])
# construct differentiable constrained optimization problem
problem = nm.problem.Problem(nodes=[map], loss=loss)
NeuroMANCER is built to tackle a variety of domain-specific modeling and control problems using its array of methods. Here we show how to model and control building energy systems, as well as apply load forecasting techniques.
For more in-depth coverage of our methods, please see our general Tutorials section below.
Neuromancer allows you to formulate and solve a broad class of parametric optimization problems, leveraging machine learning to learn the solutions to such problems. More information on Parametric programming
Learning to solve a quadratically-constrained optimization problem.
Learning to solve a set of 2D constrained optimization problems.
Learning to solve a constrained optimization problem with the projected gradient.
Using Cvxpylayers for differentiable projection onto the polytopic feasible set.
Learning to optimize with metric learning for Operator Splitting layers.
Neuromancer enables you to learn control policies for a full spectrum of differentiable white-box, grey-box, and black-box dynamical systems, subject to choice constraints and objective functions. More information on Differential Predictive Control
Neuromancer is up-to-date with state-of-the-art methods. Here we showcase the powerful Kolgomorov-Arnold networks More information on Kolgomorov-Arnold Networks
Neuromancer contains an implementation of function encoders, an algorithm for learning basis functions as neural networks. See Function Encoders: A Principled Approach to Transfer Learning in Hilbert Spaces.
Neuromancer allows one to use machine learning, prior physics, and domain knowledge to construct data-driven models of dynamical systems given the measured observations of the system behavior. More information on System ID via Neural State Space Models and ODEs
Neural Differential Algebraic Equations (DAEs) via operator splitting method
Neuromancer's symbolic programming design is perfectly suited for solving PINNs. More information on PINNs
Neuromancer has been integrated with TorchSDE to handle stochastic dynamical systems. More information on SDEs
We have integrated PyTorch Lightning to streamline code, enable custom training logic, support GPU and multi-GPU setups, and handle large-scale, memory-intensive learning tasks.
The documentation for the library can be found online. There is also an introduction video covering the core features of the library.
For more information, including that for developers, please go to our Developer and User Guide
We welcome contributions and feedback from the open-source community!
Please read the Community Development Guidelines for further information on contributions, discussions, and Issues.
See the Release notes documenting new features.
NeuroMANCER comes with BSD license. See the license for further details.
@article{Neuromancer2023,
title={{NeuroMANCER: Neural Modules with Adaptive Nonlinear Constraints and Efficient Regularizations}},
author={Drgona, Jan and Tuor, Aaron and Koch, James and Shapiro, Madelyn and Jacob, Bruno and Vrabie, Draguna},
Url= {https://github.com/pnnl/neuromancer},
year={2023}
}
Lead developers: Jan Drgona, Aaron Tuor
Notable contributors: Rahul Birmiwal, Bruno Jacob, Reilly Raab, Madelyn Shapiro, James Koch, Seth Briney, Bo Tang, Ethan King, Elliot Skomski, Zhao Chen, Christian Møldrup Legaard, Tyler Ingebrand, Alireza Daneshvar, Cary Faulkner
Scientific advisors: Draguna Vrabie, Panos Stinis
Open-source contributions made by:
Made with contrib.rocks.
This research was partially supported by the Mathematics for Artificial Reasoning in Science (MARS) and Data Model Convergence (DMC) initiatives via the Laboratory Directed Research and Development (LDRD) investments at Pacific Northwest National Laboratory (PNNL), by the U.S. Department of Energy, through the Office of Advanced Scientific Computing Research's “Data-Driven Decision Control for Complex Systems (DnC2S)” project, and through the Energy Efficiency and Renewable Energy, Building Technologies Office under the “Dynamic decarbonization through autonomous physics-centric deep learning and optimization of building operations” and the “Advancing Market-Ready Building Energy Management by Cost-Effective Differentiable Predictive Control” projects. This project was also supported by the U.S. Department of Energy (DOE), Office of Science, Advanced Scientific Computing Research (ASCR) program, under the Uncertainty Quantification for Multifidelity Operator Learning (MOLUcQ) project (Project No. 81739). PNNL is a multi-program national laboratory operated for the U.S. Department of Energy (DOE) by Battelle Memorial Institute under Contract No. DE-AC05-76RL0-1830. This research is also partially supported by the U.S. DOE, Office of Science, ASCR program under the Scientific Discovery through Advanced Computing (SciDAC) Institute “LEADS: LEarning-Accelerated Domain Science”. This research is also partially supported by the Ralph O’Connor Sustainable Energy Institute (ROSEI) at Johns Hopkins University.
32 followers · starred Jun 2024
274 followers · starred Nov 2023
22 followers · starred Dec 2022
Pytorch-based framework for solving parametric constrained optimization problems, physics-informed system identification, and parametric model predictive control.
See the code
Neural Modules with Adaptive Nonlinear Constraints and Efficient Regularizations (NeuroMANCER) is an open-source differentiable programming (DP) library for solving parametric constrained optimization problems, physics-informed system identification, and parametric model-based optimal control. NeuroMANCER is written in PyTorch and allows for systematic integration of machine learning with scientific computing for creating end-to-end differentiable models and algorithms embedded with prior knowledge and physics.
Simply run
pip install neuromancer
For manual installation, please refer to Installation Instructions
An extensive set of tutorials can be found in the examples folder and the Tutorials below. Interactive notebook versions of examples are available on Google Colab! Test out NeuroMANCER functionality before cloning the repository and setting up an environment.
The notebooks below introduce the core abstractions of the NeuroMANCER library, in particular, our symbolic programming interface and Node classes.
Part 2: NeuroMANCER syntax tutorial: variables, constraints, and objectives.
Part 3: NeuroMANCER syntax tutorial: modules, Node, and System class.
Quick example for how to solve parametric constrained optimization problem using NeuroMANCER, leveraging our symbolic programming interface, Node and Variable, Blocks, SLiM library, and PenaltyLoss classes.
# Neuromancer syntax example for constrained optimization
import neuromancer as nm
import torch
# define neural architecture
func = nm.modules.blocks.MLP(insize=1, outsize=2,
linear_map=nm.slim.maps['linear'],
nonlin=torch.nn.ReLU, hsizes=[80] * 4)
# wrap neural net into symbolic representation via the Node class: map(p) -> x
map = nm.system.Node(func, ['p'], ['x'], name='map')
# define decision variables
x = nm.constraint.variable("x")[:, [0]]
y = nm.constraint.variable("x")[:, [1]]
# problem parameters sampled in the dataset
p = nm.constraint.variable('p')
# define objective function
f = (1-x)**2 + (y-x**2)**2
obj = f.minimize(weight=1.0)
# define constraints
con_1 = 100.*(x >= y)
con_2 = 100.*(x**2+y**2 <= p**2)
# create penalty method-based loss function
loss = nm.loss.PenaltyLoss(objectives=[obj], constraints=[con_1, con_2])
# construct differentiable constrained optimization problem
problem = nm.problem.Problem(nodes=[map], loss=loss)
NeuroMANCER is built to tackle a variety of domain-specific modeling and control problems using its array of methods. Here we show how to model and control building energy systems, as well as apply load forecasting techniques.
For more in-depth coverage of our methods, please see our general Tutorials section below.
Neuromancer allows you to formulate and solve a broad class of parametric optimization problems, leveraging machine learning to learn the solutions to such problems. More information on Parametric programming
Learning to solve a quadratically-constrained optimization problem.
Learning to solve a set of 2D constrained optimization problems.
Learning to solve a constrained optimization problem with the projected gradient.
Using Cvxpylayers for differentiable projection onto the polytopic feasible set.
Learning to optimize with metric learning for Operator Splitting layers.
Neuromancer enables you to learn control policies for a full spectrum of differentiable white-box, grey-box, and black-box dynamical systems, subject to choice constraints and objective functions. More information on Differential Predictive Control
Neuromancer is up-to-date with state-of-the-art methods. Here we showcase the powerful Kolgomorov-Arnold networks More information on Kolgomorov-Arnold Networks
Neuromancer contains an implementation of function encoders, an algorithm for learning basis functions as neural networks. See Function Encoders: A Principled Approach to Transfer Learning in Hilbert Spaces.
Neuromancer allows one to use machine learning, prior physics, and domain knowledge to construct data-driven models of dynamical systems given the measured observations of the system behavior. More information on System ID via Neural State Space Models and ODEs
Neural Differential Algebraic Equations (DAEs) via operator splitting method
Neuromancer's symbolic programming design is perfectly suited for solving PINNs. More information on PINNs
Neuromancer has been integrated with TorchSDE to handle stochastic dynamical systems. More information on SDEs
We have integrated PyTorch Lightning to streamline code, enable custom training logic, support GPU and multi-GPU setups, and handle large-scale, memory-intensive learning tasks.
The documentation for the library can be found online. There is also an introduction video covering the core features of the library.
For more information, including that for developers, please go to our Developer and User Guide
We welcome contributions and feedback from the open-source community!
Please read the Community Development Guidelines for further information on contributions, discussions, and Issues.
See the Release notes documenting new features.
NeuroMANCER comes with BSD license. See the license for further details.
@article{Neuromancer2023,
title={{NeuroMANCER: Neural Modules with Adaptive Nonlinear Constraints and Efficient Regularizations}},
author={Drgona, Jan and Tuor, Aaron and Koch, James and Shapiro, Madelyn and Jacob, Bruno and Vrabie, Draguna},
Url= {https://github.com/pnnl/neuromancer},
year={2023}
}
Lead developers: Jan Drgona, Aaron Tuor
Notable contributors: Rahul Birmiwal, Bruno Jacob, Reilly Raab, Madelyn Shapiro, James Koch, Seth Briney, Bo Tang, Ethan King, Elliot Skomski, Zhao Chen, Christian Møldrup Legaard, Tyler Ingebrand, Alireza Daneshvar, Cary Faulkner
Scientific advisors: Draguna Vrabie, Panos Stinis
Open-source contributions made by:
Made with contrib.rocks.
This research was partially supported by the Mathematics for Artificial Reasoning in Science (MARS) and Data Model Convergence (DMC) initiatives via the Laboratory Directed Research and Development (LDRD) investments at Pacific Northwest National Laboratory (PNNL), by the U.S. Department of Energy, through the Office of Advanced Scientific Computing Research's “Data-Driven Decision Control for Complex Systems (DnC2S)” project, and through the Energy Efficiency and Renewable Energy, Building Technologies Office under the “Dynamic decarbonization through autonomous physics-centric deep learning and optimization of building operations” and the “Advancing Market-Ready Building Energy Management by Cost-Effective Differentiable Predictive Control” projects. This project was also supported by the U.S. Department of Energy (DOE), Office of Science, Advanced Scientific Computing Research (ASCR) program, under the Uncertainty Quantification for Multifidelity Operator Learning (MOLUcQ) project (Project No. 81739). PNNL is a multi-program national laboratory operated for the U.S. Department of Energy (DOE) by Battelle Memorial Institute under Contract No. DE-AC05-76RL0-1830. This research is also partially supported by the U.S. DOE, Office of Science, ASCR program under the Scientific Discovery through Advanced Computing (SciDAC) Institute “LEADS: LEarning-Accelerated Domain Science”. This research is also partially supported by the Ralph O’Connor Sustainable Energy Institute (ROSEI) at Johns Hopkins University.
32 followers · starred Jun 2024
274 followers · starred Nov 2023
22 followers · starred Dec 2022