Skip to content

Commit 980e9ac

Browse files
authored
Replace estimagic dependency by optimagic (#17)
1 parent a5895dc commit 980e9ac

17 files changed

+71
-106
lines changed

.envs/testenv-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- pytest # dev, tests
1111
- pytest-cov # tests
1212
- pytest-xdist # dev, tests
13-
- estimagic # run, tests
13+
- optimagic # run, tests
1414
- numba # run, tests
1515
- numpy>=1.17.0 # run, tests
1616
- pandas # run, tests

.envs/testenv-others.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies:
99
- pytest # dev, tests
1010
- pytest-cov # tests
1111
- pytest-xdist # dev, tests
12-
- estimagic # run, tests
12+
- optimagic # run, tests
1313
- numba # run, tests
1414
- numpy>=1.17.0 # run, tests
1515
- pandas # run, tests

.github/workflows/main.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ jobs:
2121
os:
2222
- ubuntu-latest
2323
python-version:
24-
- '3.8'
25-
- '3.9'
2624
- '3.10'
25+
- '3.11'
26+
- '3.12'
2727
steps:
2828
- uses: actions/checkout@v3
2929
- name: create build environment
30-
uses: mamba-org/provision-with-micromamba@main
30+
uses: mamba-org/setup-micromamba@v2
3131
with:
3232
environment-file: ./.envs/testenv-linux.yml
3333
environment-name: tranquilo
34-
cache-env: true
35-
extra-specs: |
34+
cache-environment: true
35+
create-args: >-
3636
python=${{ matrix.python-version }}
3737
- name: run pytest
3838
shell: bash -l {0}
@@ -54,18 +54,18 @@ jobs:
5454
- macos-latest
5555
- windows-latest
5656
python-version:
57-
- '3.8'
58-
- '3.9'
5957
- '3.10'
58+
- '3.11'
59+
- '3.12'
6060
steps:
6161
- uses: actions/checkout@v3
6262
- name: create build environment
63-
uses: mamba-org/provision-with-micromamba@main
63+
uses: mamba-org/setup-micromamba@v2
6464
with:
6565
environment-file: ./.envs/testenv-others.yml
6666
environment-name: tranquilo
67-
cache-env: true
68-
extra-specs: |
67+
cache-environment: true
68+
create-args: >-
6969
python=${{ matrix.python-version }}
7070
- name: run pytest
7171
shell: bash -l {0}

.pre-commit-config.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ repos:
6161
rev: 1.13.0
6262
hooks:
6363
- id: blacken-docs
64-
- repo: https://github.com/PyCQA/docformatter
65-
rev: v1.5.1
66-
hooks:
67-
- id: docformatter
68-
args:
69-
- --in-place
70-
- --wrap-summaries
71-
- '88'
72-
- --wrap-descriptions
73-
- '88'
74-
- --blank
64+
# - repo: https://github.com/PyCQA/docformatter
65+
# rev: v1.5.1
66+
# hooks:
67+
# - id: docformatter
68+
# args:
69+
# - --in-place
70+
# - --wrap-summaries
71+
# - '88'
72+
# - --wrap-descriptions
73+
# - '88'
74+
# - --blank
7575
- repo: https://github.com/charliermarsh/ruff-pre-commit
7676
rev: v0.0.261
7777
hooks:

docs/rtd_environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88
- setuptools_scm
99
- toml
1010
- pip
11-
- estimagic
11+
- optimagic
1212
- ipython
1313
- ipython_genutils
1414
- joblib

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- pytest-xdist # dev, tests
1515
- setuptools_scm # dev
1616
- toml # dev
17-
- estimagic # run, tests
17+
- optimagic # run, tests
1818
- numba # run, tests
1919
- numpy>=1.17.0 # run, tests
2020
- pandas # run, tests

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ keywords =
2929
[options]
3030
packages = find:
3131
install_requires =
32-
estimagic>=0.4.2
3332
numba
3433
numpy>=1.17.0
34+
optimagic>=0.5.1
3535
pandas
3636
plotly
3737
scipy>=1.2.1

src/tranquilo/subsolvers/gqtpar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def gqtpar(model, x_candidate, *, k_easy=0.1, k_hard=0.2, maxiter=200):
7474
zero_threshold = (
7575
model.square_terms.shape[0]
7676
* np.finfo(float).eps
77-
* np.linalg.norm(model.square_terms, np.Inf)
77+
* np.linalg.norm(model.square_terms, np.inf)
7878
)
7979
stopping_criteria = {
8080
"k_easy": k_easy,
@@ -174,7 +174,7 @@ def _get_initial_guess_for_lambdas(
174174
gradient_norm = np.linalg.norm(main_model.linear_terms)
175175
model_hessian = main_model.square_terms
176176

177-
hessian_infinity_norm = np.linalg.norm(model_hessian, np.Inf)
177+
hessian_infinity_norm = np.linalg.norm(model_hessian, np.inf)
178178
hessian_frobenius_norm = np.linalg.norm(model_hessian, "fro")
179179

180180
hessian_gershgorin_lower, hessian_gershgorin_upper = _compute_gershgorin_bounds(

src/tranquilo/subsolvers/gqtpar_fast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def gqtpar_fast(model, x_candidate, *, k_easy=0.1, k_hard=0.2, maxiter=200):
6060
# than that backward substituition is not reliable.
6161
# See Golub, G. H., Van Loan, C. F. (2013), "Matrix computations", p.165.
6262
zero_threshold = (
63-
model_hessian.shape[0] * np.finfo(float).eps * _norm(model_hessian, np.Inf)
63+
model_hessian.shape[0] * np.finfo(float).eps * _norm(model_hessian, np.inf)
6464
)
6565
stopping_criteria = {
6666
"k_easy": k_easy,
@@ -179,7 +179,7 @@ def _get_initial_guess_for_lambdas(model_gradient, model_hessian):
179179
gradient_norm = _norm(model_gradient, -1.0)
180180
model_hessian = model_hessian
181181

182-
hessian_infinity_norm = _norm(model_hessian, np.Inf)
182+
hessian_infinity_norm = _norm(model_hessian, np.inf)
183183
hessian_frobenius_norm = _norm(model_hessian, -1.0)
184184

185185
hessian_gershgorin_lower, hessian_gershgorin_upper = _compute_gershgorin_bounds(

src/tranquilo/visualize.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from plotly import graph_objects as go
99
from plotly.subplots import make_subplots
1010

11-
from estimagic.optimization.optimize_result import OptimizeResult
11+
from optimagic.optimization.optimize_result import OptimizeResult
1212
from tranquilo.clustering import cluster
1313
from tranquilo.geometry import log_d_quality_calculator
1414
from tranquilo.volume import get_radius_after_volume_scaling
@@ -25,8 +25,8 @@ def visualize_tranquilo(results, iterations):
2525
`nag_pybobyqa` and `nag_dfols`.
2626
2727
Args:
28-
results (dict or OptimizeResult): An estimagic optimization result or a
29-
dictionary with different estimagic optimization results.
28+
results (dict or OptimizeResult): An optimagic optimization result or a
29+
dictionary with different optimagic optimization results.
3030
iterations (int, list, tuple or dict): The iterations to compare the results
3131
at. Can be an integer if we want to compare different results at the same
3232
iteration, a list or tuple if we want to compare different iterations of

0 commit comments

Comments
 (0)