Skip to content

Commit

Permalink
SS_solver (#70)
Browse files Browse the repository at this point in the history
* fix tol in macro

* sample solver paras

* new optim parameters

* roll back new candidate and clean float coldstart

* rearrange block_solver, test_solver, debug file

* write safe blocks

* works but duplicate aux vars

* further testing

* unique aux vars

* Refactor write_reduced_block_solution function

* Add and include additional model files***

* bring back early aux vars

* fix JET

* add (commented out) PG and IS sampler

* redo cold_start handling

* write optim for test_solver

* more robust ss solver

* improved test_solver

* refactor block solver

* fix cold start

* second attempt fix

* fix bug

* run solver optim as regular job

* add slicesampling

* fix JET

* add optimization for solver testset

* fix JET

* fix downgrade script

* switch actions order

* fix tests

* Update optim_solver_params.jl

* Update Project.toml

* Update optim_solver_params.jl

* Update optim_solver_params.jl

* Update Project.toml

* Remove unnecessary code and comments

* try all different transform levels

* multithreading solver optim

* fix solver optim

* fix optim again

* more solver optims

* Update optim_solver_params.jl

* Update optim_solver_params.jl

* Update optim_solver_params.jl

* CRS optim

* Update optim_solver_params.jl try direct

* ESCH + successful starting point

* calc sol minimum also for starting points

* type stable kalman filter

* more types

* zygote works

* Zygote compatible quad iter sol

* solved symbolically

* missing rotation

* more info on optim solve output

* speed up reverse diff first order calc

* use first order

* exploration script

* fix reverse diff

* fix ad backend

* no truncation

* sampling works (filldist trick)

* clean version that samples

* rm memoization. not needed for llh comp since only 1 pass

* add sympy logic for reverse diff implicit diff

* update ss_solver params

* update todods

* different optim for ss solver params

* more prior weight

* WOA search

* update todo

* ABC instead of WOA (terminates early)

* fix priors to accept different kinds of Real values

* PSO instead of ABC (early termination)

* back to ABC with more iters

* sw nonlinear

* add swnonlinear to optim

* Update optim_solver_params.jl

* try ABC

* try ESCH again

* PSO

* Try ECA

* Try SA

* Try GA

* Try DE

* Rand ESCH

* Try woa

* Try ABC again

* update solver parameters

* SWnonlinear only if nonzero y

* fix steady state

* clean swnonlinear

* clean SWnonlinear w/o constraints

* switch to DE

* Update optim_solver_params.jl

* BBO set search

* let it run for 5.5h

* adaptive DE

* fix BBO -> DE

* Set Search

* Update optim_solver_params.jl

* Create sw07_estim.jl

* rm 2 params not needed

* add sw07 nonlinear

* change ss_solve params and fix rrule (inverse throwing error

* rm old swnonlinear

* update estim script

* Update SW07_nonlinear.jl

* new optim params

* add large covar option (commented out)

* sw07 params for estim

* also do optim with fixed params and previous sols

* fix naming to avoid conflict

* optim from cml

* update estim

* update to estim

* adapt otpm solver script

* add results for two distinct groups

* try fix nanmath

* add nanmath to compat

* add estim results

* test llh

* fix block solver

* Refactor code to improve performance and readability

* update todo

* manifest to compare with broken versions

* fix pythoncall compat

* hard compat constraint

* Update Julia version in Project.toml

* more results

* optimise runtime

* optim specific models timings

* Update package dependencies and optimize code

* more indvdl optims

* Update max_steps to max_evals in optimize_parameters function

* Fix MaxFuncEvals parameter in optimize_parameters function

* Update max_evals parameter in optimize_parameters function

* add optim over parameter sets

* fix multi pars optim

* Update optimization solver parameters

* Update package dependencies and optimize runtime

* update NAWM results

* found combo of params covering every case

* transition to vector of solver_parameters

* Add function to select fastest SS solver parameters

* Add functions for calculating SS solver runtime and finding SS solver parameters

* Update SS solver function name

* incremental printing of timings

* Remove OptimizationMetaheuristics dependency

* Add high priority tasks and completed tasks to todo.md

* Remove BlackBoxOptim dependency

* Commented out solver test configurations

* do multiple starting points instead of multiple parameter sets

* Update solver parameters in macros.jl

* Fix matrix equation solver in calculate_kalman_filter_loglikelihood function

* Refactor Kalman filter calculation

* Refactor block_solver function to not use starting values

* clean up sw07 nonlinear

* Update CI configuration

* Update .gitignore and Project.toml

* Commented out solver_parameters in macros.jl

* Refactor SS_solver_parameters! function and block_solver function

* Refactor filter_and_smooth function signature

* found pars for diff starting points

* update todo

* Refactor Pigeons log potential initialization and starting point search

* Add and test SW07_nonlinear model, write and translate Dynare file, and get solution

* Update test_models.jl

* Update variable names to use symbols instead of strings

* Update var_dec function in test_models.jl

* Update test_models.jl with new test cases and include Guerrieri_Iacoviello_2017 and SW07_nonlinear models

* Update z_j[0] calculation in Guerrieri_Iacoviello_2017.jl

* Fix symbol translation in MacroModelling.jl

* Commented out get_solution function call

* sw07 close to original

* sw07 linear and nonlinear

* Add SS check function and ss_equations

* Add tests for non-stochastic steady state residuals calculation

* Refactor code to improve  readability

* Update sampling method in sw07_estim.jl

* Refactor functionality tests to use collect() on check_residuals() calls

* Update get_non_stochastic_steady_state_residuals function

* Refactor key handling in get_non_stochastic_steady_state_residuals function

* Update type annotations for values argument in get_non_stochastic_steady_state_residuals function

* Refactor get_non_stochastic_steady_state_residuals function and add support for providing initial guess for NSSS

* Add guess for non-stochastic steady state and remove unused code

* Fix printing of solver information in block_solver function

* Fix type annotations in macro parameters

* add SS rel_xtol solver termination condition

* Fix solver_parameters in macros.jl

* Fix log recognition in parameters block

* add log to tests

* Add new entries to .gitignore and update todo.md

* Update  documentation

* Add RBC_calibrated model and parameters macro

* cleanup and docs

* Fix solver_parameters in macros.jl

* Delete unnecessary files

* Remove NaNMath dependency

* rename SW models and include nonlinear model in tests

* Commented out unused code in runtests.jl

* Update test_models.jl

* Update print statements in block_solver function and functionality_test function

* Update functionality_tests.jl

* Update print statements for non stochastic steady state problem

* fix tests

* refactor ss solver

* update docs

* Fix starting value string in solve_ss function

* Update R threshold in Gali_2015_chapter_3_obc.jl

* Fix solver parameter order in MacroModelling.jl

* Refactor block_solver function to use a reduced set of starting values

* Refactor block_solver function to use specific parameter starting values

* add bounds on single solve vars

* Fix parsing error in translate_mod_file function

* Refactor shock indexing in MacroModelling.jl - fix JET tests

* reactivate precompilation

* Add non-stochastic steady state guess test case

* Update SW07 estimation script with new sampling method

* add environment vars

* Update file paths in sw07_estim.jl

* add data in benchmark folder

* fix paths

* add guess to docs

* Commented out unused code and added benchmarking

* array dist in estimation

* Refactor prior distributions in estimation codes

* update todos

* update optim solver

* delete sw07 estimation files

* delete files

* Delete sw07_nonlinear_nuts_1966Q1-2004Q4_samples_1_chains/sw07_nonlinear_nuts_1966Q1-2004Q4_samples.csv

* docs update

---------

Co-authored-by: Thore Kockerols <[email protected]>
  • Loading branch information
thorek1 and Thore Kockerols authored Mar 30, 2024
1 parent 772fa4d commit 85be4b5
Show file tree
Hide file tree
Showing 35 changed files with 4,453 additions and 2,815 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Downgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: ['1']
version: ['1.10']
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- uses: cjdoris/julia-downgrade-compat-action@v1
# if: ${{ matrix.version == '1.6' }}
# if: ${{ matrix.version == '1.10' }}
with:
skip: Pkg,TOML
- uses: julia-actions/julia-buildpkg@v1
Expand Down
52 changes: 39 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,65 @@ jobs:
matrix:
test_set: ["basic", "plots", "higher_order", "estimation"]
version: ['1.8', '1.9', '1.10']
os: [ubuntu-latest, macOS-latest, windows-latest]
arch: [x64]
os: [ubuntu-latest, macos-14, windows-latest]
arch: [x64, arm64]
exclude:
- version: '1.8'
os: macOS-latest
os: ubuntu-latest
- version: '1.8'
os: windows-latest
- version: '1.9'
os: macOS-latest
os: ubuntu-latest
- version: '1.9'
os: windows-latest
- arch: arm64
os: ubuntu-latest
- arch: arm64
os: windows-latest
- arch: x64
os: macos-14
include:
- os: ubuntu-latest
prefix: xvfb-run
# - version: '1.10'
# os: macos-14
# arch: x64
# test_set: "solver0"
# - version: '1.10'
# os: macos-14
# arch: x64
# test_set: "solver1"
# - version: '1.10'
# os: macos-14
# arch: x64
# test_set: "solver2"
# - version: '1.10'
# os: macos-14
# arch: x64
# test_set: "solver3"
- version: '1.10'
os: ubuntu-latest
os: macos-14
arch: x64
test_set: "1st_order_inversion_estimation"
- version: '1.10'
os: ubuntu-latest
os: macos-14
arch: x64
test_set: "2nd_order_estimation"
- version: '1.10'
os: ubuntu-latest
os: macos-14
arch: x64
test_set: "3rd_order_estimation"
# - version: '1.10'
# os: macOS-latest
# arch: x64
# test_set: "basic"
- version: 'nightly'
os: ubuntu-latest
os: macos-14
arch: x64
test_set: "basic"
allow_failure: true
- version: '^1.11.0-0'
os: ubuntu-latest
os: macos-14
arch: x64
test_set: "basic"
allow_failure: true
Expand All @@ -57,14 +83,14 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Set Custom Test Environment Variable
- name: Set Custom Test Environment Variable (Windows)
if: matrix.os == 'windows-latest'
run: echo "TEST_SET=${{ matrix.test_set }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Set Custom Test Environment Variable (Unix)
- name: Set Custom Test Environment Variable (non-Windows)
if: matrix.os != 'windows-latest'
run: echo "TEST_SET=${{ matrix.test_set }}" >> $GITHUB_ENV
- name: Set JULIA_NUM_THREADS for Julia 1.10 on Ubuntu
if: matrix.version == '1.10' && matrix.os == 'ubuntu-latest' && (matrix.test_set == 'hmc_estimation' || matrix.test_set == 'tempering_estimation' || matrix.test_set == '2nd_order_estimation' || matrix.test_set == '3rd_order_estimation')
- name: Set JULIA_NUM_THREADS for estimation tests
if: matrix.version == '1.10' && (matrix.test_set == 'estimation' || matrix.test_set == 'solver0' || matrix.test_set == 'solver1' || matrix.test_set == 'solver2' || matrix.test_set == 'solver3' || matrix.test_set == '1st_order_inversion_estimation' || matrix.test_set == '2nd_order_estimation' || matrix.test_set == '3rd_order_estimation')
run: echo "JULIA_NUM_THREADS=auto" >> $GITHUB_ENV
- uses: actions/cache@v4
env:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ estimation__*
.micromamba/
results

octave*
octave*
*.jls
samples*
*samples.csv
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ AbstractDifferentiation = "c29ec348-61ec-40c8-8164-b8c60e9d9f3d"
AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
BlockTriangularForm = "adeb47b7-70bf-415a-bb24-c358563e873a"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
DynarePreprocessor_jll = "23afba7c-24e5-5ee2-bc2c-b42e07f0492a"
Expand Down Expand Up @@ -52,6 +53,7 @@ AxisKeys = "^0.2"
BlockTriangularForm = "^0.1"
CSV = "^0.10"
ChainRulesCore = "^1"
Combinatorics = "^1"
DataFrames = "^1"
DataStructures = "^0.18"
DocStringExtensions = "^0.8, 0.9"
Expand Down
Loading

0 comments on commit 85be4b5

Please sign in to comment.