Skip to content

Commit 2a05821

Browse files
committed
Updated test_parmest.py
1 parent 3da14f7 commit 2a05821

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

pyomo/contrib/parmest/parmest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,11 @@ def _cov_at_theta(self, method, solver, step):
17001700

17011701
# fix the value of the unknown parameters to the estimated values
17021702
for param in model.unknown_parameters:
1703-
param.fix(self.estimated_theta[param.name])
1703+
if param.is_indexed():
1704+
for idx in param:
1705+
param[idx].fix(self.estimated_theta[param[idx].name])
1706+
else:
1707+
param.fix(self.estimated_theta[param.name])
17041708

17051709
# re-solve the model with the estimated parameters
17061710
results = pyo.SolverFactory(solver).solve(model, tee=self.tee)

pyomo/contrib/parmest/tests/test_parmest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,8 @@ def test_indexed_unknown_parameter_names_are_expanded_consistently(self):
22752275
def test_cov_est_counts_expanded_indexed_unknown_parameters(self):
22762276
pest = _build_indexed_theta_estimator([(1.0, 2.0), (2.0, 4.0)])
22772277

2278+
obj, theta = pest.theta_est()
2279+
22782280
with self.assertRaisesRegex(
22792281
AssertionError,
22802282
"The number of datapoints must be greater than the number of parameters to estimate.",

0 commit comments

Comments
 (0)