Skip to content

Commit

Permalink
Merge pull request #944 from jdebacker/rc_error
Browse files Browse the repository at this point in the history
Make resource constraint error tolerance a parameter
  • Loading branch information
jdebacker authored Jun 25, 2024
2 parents 38d7481 + 592499e commit 35f27be
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.11.11] - 2024-06-24 01:00:00

### Added

- Add new parameters for resource constraint tolerances for steady state and time path solution.

## [0.11.10] - 2024-06-17 01:00:00

### Added
Expand Down Expand Up @@ -253,6 +259,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Any earlier versions of OG-USA can be found in the [`OG-Core`](https://github.com/PSLmodels/OG-Core) repository [release history](https://github.com/PSLmodels/OG-Core/releases) from [v.0.6.4](https://github.com/PSLmodels/OG-Core/releases/tag/v0.6.4) (Jul. 20, 2021) or earlier.


[0.11.11]: https://github.com/PSLmodels/OG-Core/compare/v0.11.10...v0.11.11
[0.11.10]: https://github.com/PSLmodels/OG-Core/compare/v0.11.9...v0.11.10
[0.11.9]: https://github.com/PSLmodels/OG-Core/compare/v0.11.8...v0.11.9
[0.11.8]: https://github.com/PSLmodels/OG-Core/compare/v0.11.7...v0.11.8
Expand Down
2 changes: 1 addition & 1 deletion ogcore/SS.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def SS_solver(
+ " budget"
)

if ENFORCE_SOLUTION_CHECKS and (max(np.absolute(RC)) > p.mindist_SS):
if ENFORCE_SOLUTION_CHECKS and (max(np.absolute(RC)) > p.RC_SS):
print("Resource Constraint Difference:", RC)
err = "Steady state aggregate resource constraint not satisfied"
raise RuntimeError(err)
Expand Down
4 changes: 1 addition & 3 deletions ogcore/TPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,9 +1325,7 @@ def run_TPI(p, client=None):
"Transition path equlibrium not found" + " (TPIdist)"
)

if (
np.any(np.absolute(RC_error) >= p.mindist_TPI * 10)
) and ENFORCE_SOLUTION_CHECKS:
if (np.any(np.absolute(RC_error) >= p.RC_TPI)) and ENFORCE_SOLUTION_CHECKS:
raise RuntimeError(
"Transition path equlibrium not found " + "(RC_error)"
)
Expand Down
2 changes: 1 addition & 1 deletion ogcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
from ogcore.txfunc import *
from ogcore.utils import *

__version__ = "0.11.10"
__version__ = "0.11.11"
36 changes: 36 additions & 0 deletions ogcore/default_parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -3340,6 +3340,42 @@
}
}
},
"RC_SS": {
"title": "Tolerance for the resource constraint in the steady state solution",
"description": "Tolerance for the resource constraint in the steady state solution.",
"section_1": "Model Solution Parameters",
"notes": "",
"type": "float",
"value": [
{
"value": 1e-09
}
],
"validators": {
"range": {
"min": 1e-13,
"max": 0.001
}
}
},
"RC_TPI": {
"title": "Tolerance for the resource constraint in the time path solution",
"description": "Tolerance for the resource constraint in the time path solution.",
"section_1": "Model Solution Parameters",
"notes": "",
"type": "float",
"value": [
{
"value": 1e-05
}
],
"validators": {
"range": {
"min": 1e-13,
"max": 0.01
}
}
},
"reform_use_baseline_solution":{
"title": "Whether or not the baseline SS solution is used for starting values when solving the reform",
"description": "Whether or not the baseline SS solution is used for starting values when solving the reform.",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="ogcore",
version="0.11.10",
version="0.11.11",
author="Jason DeBacker and Richard W. Evans",
license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
description="A general equilibribum overlapping generations model for fiscal policy analysis",
Expand Down

0 comments on commit 35f27be

Please sign in to comment.