From 4e876ae380c91c3889e1bbbf0a2ef04eef567947 Mon Sep 17 00:00:00 2001 From: jdebacker Date: Sat, 22 Jun 2024 22:09:22 -0400 Subject: [PATCH 1/3] add rc error tolerances as separate parameters --- ogcore/SS.py | 2 +- ogcore/TPI.py | 2 +- ogcore/default_parameters.json | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/ogcore/SS.py b/ogcore/SS.py index 8bb4f6ed9..7b932413c 100644 --- a/ogcore/SS.py +++ b/ogcore/SS.py @@ -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) diff --git a/ogcore/TPI.py b/ogcore/TPI.py index 14a51762c..733133d37 100644 --- a/ogcore/TPI.py +++ b/ogcore/TPI.py @@ -1326,7 +1326,7 @@ def run_TPI(p, client=None): ) if ( - np.any(np.absolute(RC_error) >= p.mindist_TPI * 10) + np.any(np.absolute(RC_error) >= p.RC_TPI) ) and ENFORCE_SOLUTION_CHECKS: raise RuntimeError( "Transition path equlibrium not found " + "(RC_error)" diff --git a/ogcore/default_parameters.json b/ogcore/default_parameters.json index 52903b395..c0e772eca 100644 --- a/ogcore/default_parameters.json +++ b/ogcore/default_parameters.json @@ -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.", From b7dc563e666975b051ff40db6f4d8537a921f36d Mon Sep 17 00:00:00 2001 From: jdebacker Date: Sun, 23 Jun 2024 17:59:17 -0400 Subject: [PATCH 2/3] format --- ogcore/TPI.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ogcore/TPI.py b/ogcore/TPI.py index 733133d37..20df7c6d5 100644 --- a/ogcore/TPI.py +++ b/ogcore/TPI.py @@ -1325,9 +1325,7 @@ def run_TPI(p, client=None): "Transition path equlibrium not found" + " (TPIdist)" ) - if ( - np.any(np.absolute(RC_error) >= p.RC_TPI) - ) 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)" ) From 592499efc268836315abff7956f9deccd305f6f8 Mon Sep 17 00:00:00 2001 From: jdebacker Date: Sun, 23 Jun 2024 18:01:54 -0400 Subject: [PATCH 3/3] bump version and update changelog --- CHANGELOG.md | 7 +++++++ ogcore/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c37fbd6c..bbbd74e62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 diff --git a/ogcore/__init__.py b/ogcore/__init__.py index 456043395..a7a60577e 100644 --- a/ogcore/__init__.py +++ b/ogcore/__init__.py @@ -20,4 +20,4 @@ from ogcore.txfunc import * from ogcore.utils import * -__version__ = "0.11.10" +__version__ = "0.11.11" diff --git a/setup.py b/setup.py index 571e96e4a..ad1c98168 100755 --- a/setup.py +++ b/setup.py @@ -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",