All Projects → sun-umn → PyGRANSO

sun-umn / PyGRANSO

Licence: AGPL-3.0 license
PyGRANSO: A PyTorch-enabled port of GRANSO with auto-differentiation

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to PyGRANSO

seminars-fivt
Seminars on optimization methods for DIHT MIPT
Stars: ✭ 23 (+21.05%)
Mutual labels:  numerical-optimization
lpsolvers
Linear programming solvers in Python with a unified API
Stars: ✭ 20 (+5.26%)
Mutual labels:  numerical-optimization
MIPT-Opt
A course on Optimization Methods
Stars: ✭ 128 (+573.68%)
Mutual labels:  numerical-optimization
slsqp
Modern Fortran Edition of the SLSQP Optimizer
Stars: ✭ 57 (+200%)
Mutual labels:  numerical-optimization
GurobiLink
Wolfram Language interface to the Gurobi numerical optimization library
Stars: ✭ 16 (-15.79%)
Mutual labels:  numerical-optimization
pdfo
Powell's Derivative-Free Optimization solvers
Stars: ✭ 56 (+194.74%)
Mutual labels:  numerical-optimization
qdldl
A free LDL factorisation routine
Stars: ✭ 54 (+184.21%)
Mutual labels:  numerical-optimization
ProximalOperators.jl
Proximal operators for nonsmooth optimization in Julia
Stars: ✭ 119 (+526.32%)
Mutual labels:  numerical-optimization
HOT
Hierarchical Optimization Time Integration (HOT) for efficient implicit timestepping of the material point method (MPM)
Stars: ✭ 83 (+336.84%)
Mutual labels:  numerical-optimization
Tf Quant Finance
High-performance TensorFlow library for quantitative finance.
Stars: ✭ 2,925 (+15294.74%)
Mutual labels:  numerical-optimization
Ceres Solver
A large scale non-linear optimization library
Stars: ✭ 2,180 (+11373.68%)
Mutual labels:  numerical-optimization
ForBES
Generic and efficient MATLAB solver for nonsmooth optimization problems
Stars: ✭ 19 (+0%)
Mutual labels:  numerical-optimization
osqp
The Operator Splitting QP Solver
Stars: ✭ 929 (+4789.47%)
Mutual labels:  numerical-optimization
dfogn
DFO-GN: Derivative-Free Optimization using Gauss-Newton
Stars: ✭ 20 (+5.26%)
Mutual labels:  numerical-optimization
A- Guide -to Data Sciecne from mathematics
It is a blueprint to data science from the mathematics to algorithms. It is not completed.
Stars: ✭ 25 (+31.58%)
Mutual labels:  numerical-optimization
EiCOS
A C++ Second Order Cone Solver based on Eigen
Stars: ✭ 12 (-36.84%)
Mutual labels:  numerical-optimization
pikaia
Modern Fortran Edition of the Pikaia Genetic Algorithm
Stars: ✭ 29 (+52.63%)
Mutual labels:  numerical-optimization
GALAHAD
A library of modern Fortran modules for nonlinear optimization
Stars: ✭ 60 (+215.79%)
Mutual labels:  numerical-optimization
NCVX
NCVX: A User-Friendly and Scalable Package for Nonconvex Optimization in Machine Learning
Stars: ✭ 19 (+0%)
Mutual labels:  mathematical-software

PyGRANSO

PyGRANSO

PyGRANSO: A PyTorch-enabled port of GRANSO with auto-differentiation

Please check https://ncvx.org for detailed instructions (introduction, installation, settings, examples...).

PyGRANSO is AGPL v3.0 licensed, but it also contains a small portion of GPL code. Please see the LICENSE_INFO folder for more information.

Brief Introduction

Optimizing nonconvex (NCVX) problems, especially nonsmooth and constrained ones, is an essential part of machine learning. However, it can be hard to reliably solve such problems without optimization expertise. Existing general-purpose NCVX optimization packages are powerful but typically cannot handle nonsmoothness. GRANSO is among the first optimization solvers targeting general nonsmooth NCVX problems with nonsmooth constraints, but, as it is implemented in MATLAB and requires the user to provide analytical gradients, GRANSO is often not a convenient choice in machine learning (especially deep learning) applications. To greatly lower the technical barrier, we introduce a new software package called NCVX, whose initial release contains the solver PyGRANSO, a PyTorch-enabled port of GRANSO incorporating auto-differentiation, GPU acceleration, tensor input, and support for new QP solvers. NCVX is built on freely available and widely used open-source frameworks, and as a highlight, can solve general constrained deep learning problems, the first of its kind.

Installation

Installing PyGRANSO is simple. Here is a step-by-step instruction:

  1. Install Python >= 3.9

  2. Get the most recent PyGRANSO package (including examples and requirements file):

     git clone https://github.com/sun-umn/PyGRANSO.git
     cd PyGRANSO
    
  3. Install PyGRANSO solver from PyPI:

    pip install pygranso
    
  4. Install Dependencies from PyPI:

    OS: Linux OR Windows; Compute Platform: CUDA:

     pip install -r requirements.txt -f https://download.pytorch.org/whl/cu111/torch_stable.html
    

    OS: Linux; Compute Platform: CPU:

     pip install -r requirements_linux_cpu.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
    

    OS: Mac OR Windows; Compute Platform: CPU:

     pip install -r requirements_cpu.txt
    
  5. (CUDA) Run test to make sure the dependency installation is correct:

     python test_cuda.py
    

    (CPU) Run test to make sure the dependency installation is correct:

     python test_cpu.py
    
  6. Check the example folder in the source code or example section on the documentation website to get started.

Dependencies

Python-3.9.7

numpy-1.20.3

scipy-1.7.1

pytorch-1.9.0

osqp-0.6.2

Jupyter Notebook-6.4.5

Change Logs

Please check CHANGELOG.md in the main folder.

Notes on Documentation

PyGRANSO is a PyTorch-enabled port of GRANSO with auto-differentiation, and some of its documentation uses MATLAB conventions. In the PyGRANSO source code docstrings, please note that:

  • struct refers to pygransoStruct, which is a simple class that users need to use for specifying their problems and options.
  • Vector and matrix refer to PyTorch tensor with (n,1) and (m,n) dimension, respectively.

Acknowledgements

We would like to thank Frank E. Curtis and Michael L. Overton for their involvement in creating the BFGS-SQP algorithm that is implemented in the software package GRANSO. This work was supported by UMII Seed Grant Program and NSF CMMI 2038403.

Citation

If you publish work that uses or refers to PyGRANSO, please cite the following two papers, which respectively introduced PyGRANSO and GRANSO:

[1] Buyun Liang, Tim Mitchell, and Ju Sun, NCVX: A User-Friendly and Scalable Package for Nonconvex Optimization in Machine Learning, arXiv preprint arXiv:2111.13984 (2021). Available at https://arxiv.org/abs/2111.13984

[2] Frank E. Curtis, Tim Mitchell, and Michael L. Overton, A BFGS-SQP method for nonsmooth, nonconvex, constrained optimization and its evaluation using relative minimization profiles, Optimization Methods and Software, 32(1):148-181, 2017. Available at https://dx.doi.org/10.1080/10556788.2016.1208749

BibTex:

@article{liang2021ncvx,
    title={{NCVX}: {A} User-Friendly and Scalable Package for Nonconvex 
    Optimization in Machine Learning}, 
    author={Buyun Liang, Tim Mitchell, and Ju Sun},
    year={2021},
    eprint={2111.13984},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

@article{curtis2017bfgssqp,
    title={A {BFGS-SQP} method for nonsmooth, nonconvex, constrained optimization and its evaluation using relative minimization profiles},
    author={Frank E. Curtis, Tim Mitchell, and Michael L. Overton},
    journal={Optimization Methods and Software},
    volume={32},
    number={1},
    pages={148--181},
    year={2017},
    publisher={Taylor \& Francis}
}

Contact

For questions or bug reports, please either:

  • raise issues in the PyGRANSO repository (https://github.com/sun-umn/PyGRANSO/) or
  • send an email to:
    • Buyun Liang (liang664 an_at_symbol umn a_dot_symbol edu)
    • Tim Mitchell (tim an_at_symbol timmitchell a_dot_symbol com)
    • Ju Sun (jusun an_at_symbol umn a_dot_symbol edu)

Thanks to other contributors and bug reporters:

Chen Jiang: Tested perceptual attack example (ex6). Tested PyGRANSO on Win10. Debug updatePenaltyParameter function.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].