Skip to content

Commit

Permalink
Fix EllipsoidalSet.scale setter
Browse files Browse the repository at this point in the history
  • Loading branch information
shermanjasonaf committed Nov 23, 2024
1 parent 5da80fc commit b960fc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pyomo/contrib/pyros/tests/test_uncertainty_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,9 @@ def test_normal_construction_and_update(self):
scale, eset.scale, err_msg="EllipsoidalSet scale not as expected"
)
np.testing.assert_allclose(
sp.stats.chi2.cdf(scale**0.5, df=2),
# evaluate chisquare CDF for 2 degrees of freedom
# using simplified formula
1 - np.exp(-scale / 2),
eset.chi_sq_conf_lvl,
err_msg="EllipsoidalSet chi-squared confidence level not as expected",
)
Expand Down Expand Up @@ -1893,7 +1895,9 @@ def test_normal_construction_and_update(self):
new_scale, eset.scale, err_msg="EllipsoidalSet scale update not as expected"
)
np.testing.assert_allclose(
sp.stats.chi2.cdf(new_scale**0.5, df=2),
# evaluate chisquare CDF for 2 degrees of freedom
# using simplified formula
1 - np.exp(-new_scale / 2),
eset.chi_sq_conf_lvl,
err_msg="EllipsoidalSet chi-square confidence level update not as expected",
)
Expand Down
2 changes: 1 addition & 1 deletion pyomo/contrib/pyros/uncertainty_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,7 @@ def scale(self, val):
)

self._scale = val
self._chi_sq_conf_lvl = sp.stats.chi2.cdf(x=val**0.5, df=self.dim)
self._chi_sq_conf_lvl = sp.stats.chi2.cdf(x=val, df=self.dim)

@property
def chi_sq_conf_lvl(self):
Expand Down

0 comments on commit b960fc0

Please sign in to comment.