DC3: A Learning Method for Optimization with Hard Constraints

Related tags

Deep LearningDC3
Overview

DC3: A learning method for optimization with hard constraints

This repository is by Priya L. Donti, David Rolnick, and J. Zico Kolter and contains the PyTorch source code to reproduce the experiments in our paper "DC3: A learning method for optimization with hard constraints."

If you find this repository helpful in your publications, please consider citing our paper.

@inproceedings{donti2021dc3,
  title={DC3: A learning method for optimization with hard constraints},
  author={Donti, Priya and Rolnick, David and Kolter, J Zico},
  booktitle={International Conference on Learning Representations},
  year={2021}
}

Introduction

Large optimization problems with hard constraints arise in many settings, yet classical solvers are often prohibitively slow, motivating the use of deep networks as cheap "approximate solvers." Unfortunately, naive deep learning approaches typically cannot enforce the hard constraints of such problems, leading to infeasible solutions. In this work, we present Deep Constraint Completion and Correction (DC3), an algorithm to address this challenge. Specifically, this method enforces feasibility via a differentiable procedure, which implicitly completes partial solutions to satisfy equality constraints and unrolls gradient-based corrections to satisfy inequality constraints. We demonstrate the effectiveness of DC3 in both synthetic optimization tasks and the real-world setting of AC optimal power flow, where hard constraints encode the physics of the electrical grid. In both cases, DC3 achieves near-optimal objective values while preserving feasibility.

Dependencies

  • Python 3.x
  • PyTorch >= 1.8
  • numpy/scipy/pandas
  • osqp: State-of-the-art QP solver
  • qpth: Differentiable QP solver for PyTorch
  • ipopt: Interior point solver
  • pypower: Power flow and optimal power flow solvers
  • argparse: Input argument parsing
  • pickle: Object serialization
  • hashlib: Hash functions (used to generate folder names)
  • setproctitle: Set process titles
  • waitGPU (optional): Intelligently set CUDA_VISIBLE_DEVICES

Instructions

Dataset generation

Datasets for the experiments presented in our paper are available in the datasets folder. These datasets can be generated by running the Python script make_dataset.py within each subfolder (simple, nonconvex, and acopf) corresponding to the different problem types we test.

Running experiments

Our method and baselines can be run using the following Python files:

  • method.py: Our method (DC3)
  • baseline_nn.py: Simple deep learning baseline (NN)
  • baseline_eq_nn.py: Supervised deep learning baseline with completion (Eq. NN)
  • baseline_opt.py: Traditional optimizers (Optimizer)

See each file for relevant flags to set the problem type and method parameters. Notably:

  • --probType: Problem setting to test (simple, nonconvex, or acopf57)
  • --simpleVar, --simpleIneq, simpleEq, simpleEx: If the problem setting is simple, the number of decision variables, inequalities, equalities, and datapoints, respectively.
  • --nonconvexVar, --nonconvexIneq, nonconvexEq, nonconvexEx: If the problem setting is nonconvex, the number of decision variables, inequalities, equalities, and datapoints, respectively.

Reproducing paper experiments

You can reproduce the experiments run in our paper (including baselines and ablations) via the bash script run_expers.sh. For instance, the following commands can be used to run these experiments, 8 jobs at a time:

bash run_expers.sh > commands
cat commands | xargs -n1 -P8 -I{} /bin/sh -c "{}"

The script load_results.py can be run to aggregate these results (both while experiments are running, and after they are done). In particular, this script outputs a summary of results across different replicates of the same experiment (results_summary.dict) and information on how many jobs of each type are running or done (exper_status.dict).

Generating tables

Tables can be generated via the Jupyter notebook ResultsViz.ipynb. This notebook expects the dictionary results_summary.dict as input; the version of this dictionary generated while running the experiments in the paper is available in this repository.

Owner
CMU Locus Lab
Zico Kolter's Research Group
CMU Locus Lab
A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch

Introduction This is a Python package available on PyPI for NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pyto

Artit 'Art' Wangperawong 5 Sep 29, 2021
Fast and customizable reconnaissance workflow tool based on simple YAML based DSL.

Fast and customizable reconnaissance workflow tool based on simple YAML based DSL, with support of notifications and distributed workload of that work

Américo Júnior 3 Mar 11, 2022
A Peer-to-peer Platform for Secure, Privacy-preserving, Decentralized Data Science

PyGrid is a peer-to-peer network of data owners and data scientists who can collectively train AI models using PySyft. PyGrid is also the central serv

OpenMined 615 Jan 03, 2023
ShapeGlot: Learning Language for Shape Differentiation

ShapeGlot: Learning Language for Shape Differentiation Created by Panos Achlioptas, Judy Fan, Robert X.D. Hawkins, Noah D. Goodman, Leonidas J. Guibas

Panos 32 Dec 23, 2022
Task Transformer Network for Joint MRI Reconstruction and Super-Resolution (MICCAI 2021)

T2Net Task Transformer Network for Joint MRI Reconstruction and Super-Resolution (MICCAI 2021) [Paper][Code] Dependencies numpy==1.18.5 scikit_image==

64 Nov 23, 2022
This is the official implement of paper "ActionCLIP: A New Paradigm for Action Recognition"

This is an official pytorch implementation of ActionCLIP: A New Paradigm for Video Action Recognition [arXiv] Overview Content Prerequisites Data Prep

268 Jan 09, 2023
Deep High-Resolution Representation Learning for Human Pose Estimation

Deep High-Resolution Representation Learning for Human Pose Estimation (accepted to CVPR2019) News If you are interested in internship or research pos

HRNet 167 Dec 27, 2022
Example for AUAV 2022 with obstacle avoidance.

AUAV 2022 Sample This is a sample PX4 based quadrotor path planning framework based on Ubuntu 20.04 and ROS noetic for the IEEE Autonomous UAS 2022 co

James Goppert 11 Sep 16, 2022
This is Official implementation for "Pose-guided Feature Disentangling for Occluded Person Re-Identification Based on Transformer" in AAAI2022

PFD:Pose-guided Feature Disentangling for Occluded Person Re-identification based on Transformer This repo is the official implementation of "Pose-gui

Tao Wang 93 Dec 18, 2022
Code used for the results in the paper "ClassMix: Segmentation-Based Data Augmentation for Semi-Supervised Learning"

Code used for the results in the paper "ClassMix: Segmentation-Based Data Augmentation for Semi-Supervised Learning" Getting started Prerequisites CUD

70 Dec 02, 2022
This project generates news headlines using a Long Short-Term Memory (LSTM) neural network.

News Headlines Generator bunnysaini/Generate-Headlines Goal This project aims to generate news headlines using a Long Short-Term Memory (LSTM) neural

Bunny Saini 1 Jan 24, 2022
Platform-agnostic AI Framework 🔥

🇬🇧 TensorLayerX is a multi-backend AI framework, which can run on almost all operation systems and AI hardwares, and support hybrid-framework progra

TensorLayer Community 171 Jan 06, 2023
Efficiently computes derivatives of numpy code.

Note: Autograd is still being maintained but is no longer actively developed. The main developers (Dougal Maclaurin, David Duvenaud, Matt Johnson, and

Formerly: Harvard Intelligent Probabilistic Systems Group -- Now at Princeton 6.1k Jan 08, 2023
Does Pretraining for Summarization Reuqire Knowledge Transfer?

Pretraining summarization models using a corpus of nonsense

Approximately Correct Machine Intelligence (ACMI) Lab 12 Dec 19, 2022
Machine Learning Toolkit for Kubernetes

Kubeflow the cloud-native platform for machine learning operations - pipelines, training and deployment. Documentation Please refer to the official do

Kubeflow 12.1k Jan 03, 2023
Multiple style transfer via variational autoencoder

ST-VAE Multiple style transfer via variational autoencoder By Zhi-Song Liu, Vicky Kalogeiton and Marie-Paule Cani This repo only provides simple testi

13 Oct 29, 2022
PyTorch implementation of "Learn to Dance with AIST++: Music Conditioned 3D Dance Generation."

Learn to Dance with AIST++: Music Conditioned 3D Dance Generation. Installation pip install -r requirements.txt Prepare Dataset bash data/scripts/pre

Zj Li 8 Sep 07, 2021
PoseCamera is python based SDK for human pose estimation through RGB webcam.

PoseCamera PoseCamera is python based SDK for human pose estimation through RGB webcam. Install install posecamera package through pip pip install pos

WonderTree 7 Jul 20, 2021
Python wrapper to access the amazon selling partner API

PYTHON-AMAZON-SP-API Amazon Selling-Partner API If you have questions, please join on slack Contributions very welcome! Installation pip install pytho

Michael Primke 330 Jan 06, 2023
This repo is about to create the Streamlit application for given ML model.

HR-Attritiion-using-Streamlit This repo is about to create the Streamlit application for given ML model. Problem Statement: Managing peoples at workpl

Pavan Giri 0 Dec 10, 2021