Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated API for v1.0.0 #81

Closed
wants to merge 241 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
241 commits
Select commit Hold shift + click to select a range
131d4cc
120 lines for black
juan43ramirez Feb 12, 2023
b6c7e07
fix typo in setup.cfg flake
juan43ramirez Feb 12, 2023
dc4e30d
Fix isort line length
juan43ramirez Feb 12, 2023
07e307d
ConstraintGroup and multipliers
juan43ramirez Feb 12, 2023
17127e2
Rename attribute `positive` -> `enforce_positive` in multipliers
gallego-posada Feb 13, 2023
5f207c1
Extra sanity checks for constraints
gallego-posada Feb 13, 2023
d5c664d
Implement new `CMPState`
gallego-posada Feb 13, 2023
f73e4b9
Join CMPState and ConstrainedMinimizationProblem
gallego-posada Feb 17, 2023
0ffde5b
Update Formulation class
gallego-posada Feb 17, 2023
a03f8dc
Remove StateLogger
gallego-posada Feb 17, 2023
6587d7d
Remove Formulation class from constraints module
gallego-posada Feb 17, 2023
4e6c05e
Enable more general dual restarts
gallego-posada Feb 17, 2023
c3a2a7f
Update main `__init__`
gallego-posada Feb 17, 2023
548ea1b
Create simple example for 2D CMP using new classes
gallego-posada Feb 17, 2023
36365e3
Handle restart on feasible within the multipliers
gallego-posada Feb 17, 2023
5a4768e
Improve docs for multipliers
gallego-posada Feb 17, 2023
a416ddc
Fix typo
gallego-posada Feb 17, 2023
c2e4e8a
Enable state_dicts for multipliers and formulations
gallego-posada Feb 17, 2023
bd975b4
fix pre-commit and isort issue. https://github.com/PyCQA/isort/issues…
juan43ramirez Feb 19, 2023
f61a537
drop partial_optimizer and partial_scheduler
juan43ramirez Feb 19, 2023
282c7fb
add TODO in multipliers
juan43ramirez Feb 19, 2023
78de33f
ignore_primal and ignore_dual in backward
juan43ramirez Feb 19, 2023
6153c0d
(WIP) optimizers
juan43ramirez Feb 20, 2023
99dee1b
fix circular import
juan43ramirez Feb 20, 2023
da67683
optim in cooper __init__
juan43ramirez Feb 20, 2023
c39ae85
Fix inplace muktiplier positivity
juan43ramirez Feb 20, 2023
2102b22
fix bug in loading of multipliers
juan43ramirez Feb 20, 2023
0e6b237
test multipliers
juan43ramirez Feb 20, 2023
6852ddf
Toy2dCMP in test utils
juan43ramirez Feb 21, 2023
27652d2
test unconstrained
juan43ramirez Feb 21, 2023
c646add
Fix typo in logical check
gallego-posada Feb 24, 2023
a983e28
primal and dual backward helpers in cmp
juan43ramirez Feb 24, 2023
14cea15
zero grad of const_opt always on primal and dual
juan43ramirez Feb 24, 2023
da2e096
.params() for ConstantMult, restart changes
juan43ramirez Feb 24, 2023
42c4497
TODO
juan43ramirez Feb 24, 2023
b629fda
Adjust simultaneous optimizer
juan43ramirez Feb 24, 2023
d9d4dd0
test placeholders
juan43ramirez Feb 24, 2023
d1840bd
Improve docs for CMP and CMPState
gallego-posada Feb 24, 2023
d2c4df5
Refactor `pos_step` -> `post_step_`
gallego-posada Feb 24, 2023
6acd10a
Enhanced docs for multipliers
gallego-posada Feb 24, 2023
36cf319
Enable `None` loss in `populate_lagrangian`
gallego-posada Mar 18, 2023
26d5eb1
Enable custom (dual) restart value for Multipliers
gallego-posada Mar 18, 2023
85761fa
Extract sanity checks from multiplier init
gallego-posada Mar 18, 2023
371a6fe
Standalone sanity checks for ConstrainedOptimizer
gallego-posada Mar 18, 2023
5ce13f4
Update base ConstrainedOptimizer
gallego-posada Mar 18, 2023
d44980f
Align SimultaneousConstrainedOptimizer with base ConstrainedOptimizer…
gallego-posada Mar 18, 2023
13edeb5
Fix logic typo
gallego-posada Mar 19, 2023
2f49b43
Extract `CooperOptimizerState` to separate module
gallego-posada Mar 19, 2023
974bd9d
Improve docstrings and type hints
gallego-posada Mar 19, 2023
1b77677
Ensure sequence pattern in utils
gallego-posada Mar 20, 2023
a833ac2
Add reusable OneOrSequence type hint
gallego-posada Mar 20, 2023
ecc03ca
Update utils for tests
gallego-posada Mar 20, 2023
65c985d
Update type hints
gallego-posada Mar 20, 2023
4096259
Extract utils from `constrained_optimizers` to `optim`
gallego-posada Mar 20, 2023
dd91012
Update optim utils
gallego-posada Mar 20, 2023
d187773
Enforce Sequence pattern for optimizer args
gallego-posada Mar 20, 2023
54f86a1
Update module `__init__`s
gallego-posada Mar 20, 2023
4390ff6
Improve toy 2dim CMP
gallego-posada Mar 20, 2023
009f38f
Update basic CMP test
gallego-posada Mar 20, 2023
9881a7b
Adjust code style
gallego-posada Mar 20, 2023
84691ac
Add frozen random generator for tests
gallego-posada Mar 20, 2023
acacc10
Update tests for multipliers
gallego-posada Mar 20, 2023
eab0be8
Add more param initializations for 2D CMP
gallego-posada Mar 20, 2023
e454fdb
Update test for simple pipeline (no explicit CMP class)
gallego-posada Mar 20, 2023
bfe918c
Add common fixtures for toy 2d CMP
gallego-posada Mar 20, 2023
d17523d
Make use of common fixtures in 2d CMP tests
gallego-posada Mar 20, 2023
d97e0af
Consistent style for docstrings
gallego-posada Mar 20, 2023
c3c47d1
Add TODOs for documentation
gallego-posada Mar 20, 2023
dac1e4a
Black
gallego-posada Mar 23, 2023
8cd74f5
Add utils for Cooper tests
gallego-posada Mar 23, 2023
0b1429a
Update basic CMP tests
gallego-posada Mar 23, 2023
5fc18d0
Add test utils and fixtures
gallego-posada Mar 23, 2023
7b993ff
Remove outdated test
gallego-posada Mar 23, 2023
910f1a5
Unconstrained test now handled in test_cmp
gallego-posada Mar 23, 2023
803b924
Update basic CMP test with new fixtures
gallego-posada Mar 23, 2023
0fa9da2
Purge _primal and _dual_lagrangian after backward
gallego-posada Mar 23, 2023
a84e174
Implement compute_violations in Toy2dCMP
gallego-posada Mar 23, 2023
b43dd2b
Fix module import structure
gallego-posada Mar 23, 2023
1e55c86
More general builder of cooper_optimizer for tests
gallego-posada Mar 23, 2023
9cd22e0
Update primal optimizer builder
gallego-posada Mar 23, 2023
0481f84
Implement alternating optimizer
gallego-posada Mar 23, 2023
abd20fe
Reduce code duplication -- move `dual_step` to `ConstraintOptimizer`
gallego-posada Mar 23, 2023
e73e058
Improve `CooperOptimizerState` docstring
gallego-posada Mar 23, 2023
71499f9
Improve docstring for `CooperOptimizerState`
gallego-posada Mar 23, 2023
3c3cc40
More flexible builder for primal optimizers
gallego-posada Mar 23, 2023
bcaef16
Clean up alternating test
gallego-posada Mar 23, 2023
083dcd6
Add test for alternating updates with surrogate constraints
gallego-posada Mar 23, 2023
7382f41
Rename alternating + surrogate test
gallego-posada Mar 23, 2023
745d406
Untested ExtrapolationConstrainedOptimizer
juan43ramirez Mar 29, 2023
38c6916
Add TODO - augmented Lagrangian not fully integrated yet
gallego-posada Mar 29, 2023
414ea78
Improve check readability
gallego-posada Mar 29, 2023
90337b8
Add utility `observed_constraints_iterator`
gallego-posada Mar 29, 2023
e0a5deb
Use observed constraints iterator
gallego-posada Mar 29, 2023
3ed5d24
Enable `skip_??_contribution` in `ConstraintState`
gallego-posada Mar 29, 2023
8b093ad
Add docstring for `ConstraintState`
gallego-posada Mar 30, 2023
2478a4f
Raise error for augmented Lagrangian while untested
gallego-posada Mar 30, 2023
c37cd37
Enable skip primal/dual contributions in `populate_lagrangian`
gallego-posada Mar 30, 2023
91a817f
Consistent use of `OneOrSequence` type hint
gallego-posada Apr 3, 2023
dc72dd0
Extract multiplier construction from `ConstraintGroup`
gallego-posada Apr 3, 2023
e6a10b2
Untested ExtrapolationConstrainedOptimizer
juan43ramirez Apr 3, 2023
29d67af
Untested UnconstrainedExtrapolationOptimizer
juan43ramirez Apr 3, 2023
248f30a
refactor ExtrapolationUnconstrainedOptimizer
juan43ramirez Apr 3, 2023
2a41370
create_optimizer_from_kwargs
juan43ramirez Apr 3, 2023
d70f152
test_extrapolation
juan43ramirez Apr 3, 2023
9bb8cc0
fix typo in multiplier init
juan43ramirez Apr 4, 2023
165a768
modularize miltiplier tests
juan43ramirez Apr 4, 2023
3edf83b
Re-implement tutorials using new Cooper API (#72)
daoterog Apr 19, 2023
6098f5f
Update plot_max_entropy tutorial
juan43ramirez Apr 21, 2023
65aafdb
Purge Extrapolation Unconstrained
juan43ramirez Apr 22, 2023
3906129
tutorials isort, black
juan43ramirez Apr 22, 2023
5c2d408
lagrangian_struct from populate_lagrangian
juan43ramirez Apr 22, 2023
1c23aef
LagrangianStore dataclass
juan43ramirez Apr 22, 2023
63d7c04
enable extrapolation in dual_step
juan43ramirez Apr 22, 2023
54e43d8
Implement roll method
juan43ramirez Apr 22, 2023
bad9416
Update Toy2dCMP
gallego-posada Apr 22, 2023
f355c02
Enable purging of Lagrangian contributions
gallego-posada Apr 23, 2023
4b201a8
Implement PrimalDual and DualPrimal alternating updates
gallego-posada Apr 23, 2023
9cc93a5
Fix type hint for alternating flag
gallego-posada Apr 23, 2023
1226e0d
Add previous loss to misc in PDAlternating
gallego-posada Apr 23, 2023
3852e8c
Update tutorials
gallego-posada Apr 23, 2023
af7b970
Return latest CMPState after roll
gallego-posada Apr 23, 2023
189074f
Improve docstrings for optimizers
gallego-posada Apr 23, 2023
b0b4692
Add ALTERNATING_TYPE type hint
gallego-posada Apr 23, 2023
fc88ef5
Refactor `SimultaneousConstrainedOptimizer` -> `SimultaneousOptimizer`
gallego-posada Apr 23, 2023
e1dc2ce
Modularize builders for cooper tests
gallego-posada Apr 23, 2023
d8f3da9
Fix typos in multiplier loading
gallego-posada Apr 23, 2023
6d5489a
Update checkpoint test
gallego-posada Apr 23, 2023
3d974a4
Consider exact satisfaction as feasible for ineq constraints
gallego-posada Apr 23, 2023
865dde1
Add IndexedMultiplier
gallego-posada Apr 23, 2023
83d61cf
Update several instances of multiplier creation
gallego-posada Apr 23, 2023
456d769
Ignore extra kwargs in Unconstrained roll
gallego-posada Apr 23, 2023
0ecb325
Release min-norm tutorial
gallego-posada Apr 24, 2023
25a1f7e
Default device None in multiplier builder
gallego-posada Apr 24, 2023
9e75b51
Fix typos in documentation
gallego-posada Apr 24, 2023
9793068
Edit min-norm tutorial title
gallego-posada Apr 24, 2023
62251ba
Adjust description in min-norm tutorial
gallego-posada Apr 24, 2023
74c399b
On-demand sparse gradient for IndexedMultiplier
gallego-posada Apr 28, 2023
82ac7aa
Ensure no broadcasting in `compute_lagrangian_contribution` inner pro…
gallego-posada Apr 28, 2023
1df85c1
Remove unused imports
gallego-posada Apr 29, 2023
c603668
Add enums and refactor
gallego-posada Apr 29, 2023
b426dd3
Uncomment test in alternating update
gallego-posada May 5, 2023
3d1ec79
Rename test
gallego-posada May 5, 2023
8e3c0fb
Black
gallego-posada May 5, 2023
59b2529
Stack constraint analytical_gradients
gallego-posada May 5, 2023
cbccd7f
Use clone in output of constant multiplier
gallego-posada May 5, 2023
ede8431
Use clone in DenseMultiplier forward
gallego-posada May 5, 2023
12d10e4
Implement slack variables
gallego-posada May 5, 2023
2c69f85
Fix access to multiplier value in extrapolation test
gallego-posada May 6, 2023
8058573
Bug fixes in alternating tests
gallego-posada May 6, 2023
6c3ac90
test_surrogate
juan43ramirez May 8, 2023
2f46ccf
test_alternating_surrogate
juan43ramirez May 8, 2023
d9ac7d5
split test_manual_alternating
juan43ramirez May 8, 2023
bb9f08c
__repr__ for cmp_state
juan43ramirez May 8, 2023
7be9d68
change typing in formulation.py
juan43ramirez May 8, 2023
aae106e
pre-commit trailing whitespace
juan43ramirez May 8, 2023
43a6e2e
strict dual restarts + comment
juan43ramirez May 8, 2023
9ede2ed
[max=True] drop support for pytorch < 1.12
juan43ramirez May 8, 2023
c4ad3e7
[max=True] enable Extra optim with max=True
juan43ramirez May 8, 2023
2fc418a
[max=True] require maximize=True for dual_optims
juan43ramirez May 8, 2023
95ba48a
[max=True] tutorials with max=True
juan43ramirez May 8, 2023
a20c247
trying out badges
juan43ramirez May 8, 2023
9855d46
LagrangianStore in cmp __init__
juan43ramirez May 9, 2023
ee4b991
Undo change in formulation type hint
juan43ramirez May 12, 2023
2012f7b
formatting of tox.ini
juan43ramirez May 12, 2023
e266ad1
pre-commit
juan43ramirez May 12, 2023
24ad020
Set feasible indices for restarts in `populate_lagrangian`
juan43ramirez May 12, 2023
d1fd7d6
HitCount to point to docs
juan43ramirez May 12, 2023
b6cf0be
Use Union in type hint
juan43ramirez May 18, 2023
450b455
Fix previous commit
juan43ramirez May 18, 2023
8b3aac5
Modularize formulations (#74)
juan43ramirez Jun 21, 2023
9f01d10
Fix typo in populate of strictly feasible indices
gallego-posada Jul 9, 2023
12b8376
Fix creation of sparse tensor for grad of restarted IndexedMultipliers
gallego-posada Aug 10, 2023
a5bf4c5
Fix typo in creation of sparse tensor
gallego-posada Aug 10, 2023
6b39626
PID optimizer (#75)
juan43ramirez Aug 10, 2023
c873cf6
Fix typo in creation of Cooper optimizer from state_dict
gallego-posada Aug 18, 2023
0a5ce27
PID + EMA (#79)
juan43ramirez Sep 16, 2023
4e804fd
Implement PI optimizer
gallego-posada Sep 18, 2023
d235792
Bug fix for PI optimizer
gallego-posada Sep 18, 2023
deebbb0
Remove redundant code
gallego-posada Sep 18, 2023
d8cddc3
Force use of sparse gradients for IndexedMultipliers and IndexedSlacks
gallego-posada Sep 18, 2023
bcf9105
Update logic in PI initialization
gallego-posada Sep 18, 2023
1333d8b
Bug fix for sparse PI optimizer
gallego-posada Sep 18, 2023
4d0633f
Update docstrings for PI(D) optimizers
gallego-posada Sep 22, 2023
260b4f7
Separate Constraints for Primal and Dual + API Update (#78)
juan43ramirez Nov 27, 2023
01c58f4
Add `formulation_type` attribute to ConstraintGroup
gallego-posada Nov 30, 2023
ec94fe9
Update AugmentedLagrangian formulation
gallego-posada Nov 30, 2023
c7244f2
Update `update_value` methods in PenaltyCoefficients
gallego-posada Nov 30, 2023
c410c68
Add violation tolerance kwargs to ALM
gallego-posada Nov 30, 2023
0b00caf
Enable penalty coefficient update from ConstraintGroup
gallego-posada Nov 30, 2023
84f87ce
Implement optimizers compatible with ALM
gallego-posada Nov 30, 2023
e55ab26
Add simple tutorial for AugmentedLagrangian
gallego-posada Nov 30, 2023
7b3aa7f
Fix typo
gallego-posada Nov 30, 2023
926eec3
Clean up optimizer instantiation in tests
gallego-posada Nov 30, 2023
a1840d5
Fix typo in class names
gallego-posada Nov 30, 2023
0f58344
Fix format in raise message
gallego-posada Nov 30, 2023
4b85488
Update Augmented Lagrangian tests
gallego-posada Nov 30, 2023
0931af7
Remove unnecessary gradient zeroing in multiplier post_step_
gallego-posada Nov 30, 2023
976664e
Update tox config
gallego-posada Nov 30, 2023
02399a1
Remove support for py3.7
gallego-posada Nov 30, 2023
7ab907b
Update type-hints for py3.9+
gallego-posada Nov 30, 2023
6bfb8c6
Update min version to py3.9
gallego-posada Nov 30, 2023
3f4e84b
Pin torch versions for tox
gallego-posada Nov 30, 2023
80dd2e3
Fix tensor copy in PID optimizer
gallego-posada Nov 30, 2023
7827e81
Update docs for AlternatingOptimizer
gallego-posada Nov 30, 2023
8fc29f9
Update supported OS and torch versions
gallego-posada Nov 30, 2023
5876bd5
Remove windows action from gh build
gallego-posada Nov 30, 2023
8751eda
TODO in build.yaml
juan43ramirez Nov 30, 2023
add43ce
Tutorial on flags `contributes_to_primal_lagrangian` and `contributes…
juan43ramirez Dec 5, 2023
4a0710f
`.clone().detach()` in PI optimizer
juan43ramirez Dec 7, 2023
d20628b
Minor docstring adjustment
juan43ramirez Dec 7, 2023
1d86ca7
Placeholder test for PI optimizer
juan43ramirez Dec 7, 2023
af47fc5
Update `maximize` behavior in PI optimizer
gallego-posada Dec 7, 2023
9999c27
Update logic in PI optimizer class
gallego-posada Dec 8, 2023
cac3a88
Add test for PI optimizer
gallego-posada Dec 8, 2023
16b8126
Update PI optimizer docstring
gallego-posada Dec 8, 2023
2a23308
Rename PID_optimizers module
gallego-posada Dec 15, 2023
553127f
Apply code format
gallego-posada Dec 15, 2023
deec08f
Improve docstring and test for PI optimizer
gallego-posada Dec 15, 2023
17c9993
WIP - Update PID optimizer and test
gallego-posada Dec 15, 2023
ffa9609
Implement PID optimizer with flexible init schemes
gallego-posada Dec 15, 2023
5d10d21
Add test PID(KD=0) matches PI
gallego-posada Dec 15, 2023
c5c7923
Format code
gallego-posada Dec 15, 2023
3b5c87b
Improve docstring for multiplier restart_on_feasible
gallego-posada Dec 15, 2023
8a34f89
Update supported OS
gallego-posada Dec 15, 2023
3b0c546
Update minimum torch version
gallego-posada Dec 15, 2023
8bd3df8
Update dependencies
gallego-posada Dec 16, 2023
648d005
Flake8
gallego-posada Dec 16, 2023
389d89b
Update numpy dependency
gallego-posada Dec 16, 2023
3527df5
Save multiplier checkpoint under tmpdir
juan43ramirez Dec 16, 2023
9ba0a17
Remove old widget tutorial
gallego-posada Dec 16, 2023
e024ef1
Update setuptool deps
gallego-posada Dec 16, 2023
7767276
Change flake8 excluded dirs
juan43ramirez Dec 16, 2023
9456ddf
Flake8
juan43ramirez Dec 16, 2023
2ee448c
Flake8 on tutorials
juan43ramirez Dec 16, 2023
3d11ff7
Add lint env to GH actions
juan43ramirez Dec 16, 2023
0ef6931
Add Flake to pre-commit
juan43ramirez Dec 16, 2023
8b0702d
Update coverage workflow
gallego-posada Dec 16, 2023
5b12296
Update coverage workflow name
gallego-posada Dec 16, 2023
d528eff
Fix typo in coverage.yml
juan43ramirez Dec 16, 2023
05fa8e9
Add coverage badge
gallego-posada Dec 16, 2023
837f59d
Delete unused travis.yml
juan43ramirez Dec 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.9", "3.10", "3.11"]
# No gpu workflow yet!: https://github.com/apache/singa/issues/802

steps:
Expand All @@ -31,3 +31,5 @@ jobs:
run: tox
env:
PLATFORM: ${{ matrix.platform }}
- name: Check code formatting
run: tox -e lint
13 changes: 6 additions & 7 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Coverage
name: coverage

on:
push:
Expand All @@ -13,10 +13,10 @@ jobs:
# Setup lastest python version
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.10"

- name: Install dependencies
run: |
Expand All @@ -26,8 +26,7 @@ jobs:
- name: Coverage tests
run: pytest --cov=cooper . --cov-report term-missing

- name: Codecov
if: success()
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: codecov
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ repos:
- id: black
- id: black-jupyter
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
exclude: ^docs/
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.8"
python: "3.9"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
Expand Down
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cooper-org/cooper/tree/master/LICENSE)
[![DOCS](https://readthedocs.org/projects/cooper/badge/?version=latest)](https://cooper.readthedocs.io/en/latest/?version=latest)
[![Build and Test](https://github.com/cooper-org/cooper/actions/workflows/build.yml/badge.svg)](https://github.com/cooper-org/cooper/actions/workflows/build.yml)
[![Codecov](https://codecov.io/gh/cooper-org/cooper/branch/dev/graph/badge.svg?token=1AKM2EQ7RT)](https://codecov.io/gh/cooper-org/cooper/branch/dev/graph/badge.svg?token=1AKM2EQ7RT)
[![Coverage](https://codecov.io/gh/cooper-org/cooper/graph/badge.svg?token=4U41P8JCE1)](https://codecov.io/gh/cooper-org/cooper)
[![HitCount](https://hits.dwyl.com/cooper-org/cooper.svg?style=flat-square)](https://cooper.readthedocs.io/en/latest/?version=latest)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/cooper-org/cooper/issues)

## About

Expand Down Expand Up @@ -38,7 +40,7 @@ training a Logistic Regression clasifier on the MNIST dataset. The model is
constrained so that the squared L2 norm of its parameters is less than 1.

This example illustrates how **Cooper** integrates with:
- constructing a ``cooper.LagrangianFormulation`` and a ``cooper.SimultaneousConstrainedOptimizer``
- constructing a ``cooper.LagrangianFormulation`` and a ``cooper.SimultaneousOptimizer``
- models defined using a ``torch.nn.Module``,
- CUDA acceleration,
- typical machine learning training loops,
Expand All @@ -65,7 +67,7 @@ dual_optimizer = cooper.optim.partial_optimizer(torch.optim.SGD, lr=1e-3)

# Create a ConstrainedOptimizer for performing simultaneous updates based on the
# formulation, and the selected primal and dual optimizers.
cooper_optimizer = cooper.SimultaneousConstrainedOptimizer(
cooper_optimizer = cooper.SimultaneousOptimizer(
formulation, primal_optimizer, dual_optimizer
)

Expand Down
25 changes: 6 additions & 19 deletions cooper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Top-level package for Constrained Optimization in Pytorch."""
"""Top-level package for Cooper."""

import sys

Expand All @@ -13,23 +13,10 @@
# package is not installed
import warnings

warnings.warn("Could not retrieve cooper version!")
warnings.warn("Could not retrieve Cooper version!")

from cooper.formulation import (
AugmentedLagrangianFormulation,
Formulation,
LagrangianFormulation,
UnconstrainedFormulation,
)
from cooper.optim import (
AlternatingConstrainedOptimizer,
ConstrainedOptimizer,
CooperOptimizer,
ExtrapolationConstrainedOptimizer,
SimultaneousConstrainedOptimizer,
UnconstrainedOptimizer,
)
from cooper.problem import CMPState, ConstrainedMinimizationProblem
from cooper.utils import StateLogger
from cooper.cmp import CMPState, ConstrainedMinimizationProblem, LagrangianStore
from cooper.constraints import ConstraintGroup, ConstraintState, ConstraintType
from cooper.formulations import FormulationType

from . import formulation, multipliers, optim, utils
from . import formulations, multipliers, optim, utils
Loading
Loading