Skip to content

ThomasHJorgensen/NumericalSetup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

See a short introduction to my numerical setup here

Note: The code has only been tested on Windows and will likely not work without modifications on iOS.

File structure:

  • Example.ipynb: Main execution file (Jupyter Notebook) from which the model is solved and simulated. Also contains plots.
  • Example.py: Main Python module. This file defines the model class, initializes parameters (in par struct), allocates memory to store the solution in (sol struct), and allocates memory to store the simulated paths in (sim struct). This builds on the EconModel class.
  • cppfuncs: Folder containing all c++ files. The main file linking to Python is the cpp_link_file.cpp. The solve.cpp files contains the solution algorithm and simulate.cpp contains the simulation module.
  • cpp_link_file.dll: The executable file, constructed when compiling the c++ code in Example.ipynb. This is all done automatically once you have followed the installation guide below.

Installation guide:

  1. Download Anaconda using default options
  2. Add the location of the Anaconda-installation to PATH in "environment variables".
  3. Download Git
  4. Download Visual Studio Code
  5. in VS-code, install the "Python" extension.
  6. Download Visual Studio Community compiler. Remember to add C/C++ features for installation.
  7. Clone this repository from GitHub by i) opening the Anaconda Prompt, ii) navigating to the location on disk where you want the files cloned to, iii) write git clone https://github.com/ThomasHJorgensen/NumericalSetup.git and hit enter.
  8. In Anaconda Prompt install required Python packages by typing pip install econmodel consav

To learn more about how this code uses OpenMP and NLopt to parallelize and solve numerical optimization problems, respectively, see e.g. EconModelNotebooks.

About

This repo illustrates my numerical setup using C++ and Python link.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published