In my previous post, I showed an easy way to aggregate a matrix using mappings in GAMS. If you use a small mapping, you probably won’t make any errors, but if the sets in the mappings have many elements, the chance of an error rises. For example, you forget to map one of the elements on either side, or you map one element twice.
Tom Rutherford wrote a nice piece of code to check your mappings. This code raises an error as soon as you make one of the mistakes mentioned above.
Let us first set up a simple … Read the rest “Checking Mappings in GAMS”
If you can’t do without my blog posts and don’t want to check if there are any new posts, you can subscribe to this blog. Just scroll down in the widget bar on the right side until you find the following:
Add your email address and wait for the confirmation email.
Gams makes aggregating tables quite easy. Imagine you a table with data for 100 sectors but you want to run your model in the testing phase for an aggregation of these sectors (e.g. an aggregate the 100 sectors to the three sector groups “agriculture”, “industry”, and “services”). This is a typical situation in CGE (computable general equilibrium modeling): you have a social accounting matrix for your country and you want to start with a simple model having only a few sectors, one household, no taxes, and no government).
In Gams you simply introduce a mapping that maps the 100 sectors … Read the rest “Aggregating tables in Gams in a flexible way using mappings and compile-time variables”
After some hesitation, I finally decided to start with learning Python. I had some hesitations because I am used to R and that is a different kind of cookie. The decision was made easier because I am working on a project with models developed by other colleagues in Python (and Matlab). Furthermore, although Shiny in R is a great way for visualization of results, I got stuck building a combination of results and information. Python offers Dash (some nice examples can be found in the Dash Galley). Another reason is that nowadays you can use Python in your Gams … Read the rest “Good Books for Learning Python”
Jupyter Notebooks are a great way of working with Python and R. You can add your notes in Markdown and write code in a cell that can be evaluated over and over again.
However, one thing I didn’t like is that you have to start (on Windows) the Jupyter Notebook server in the directory where you have your notebook saved. Double-clicking a Jupyter notebook (with the extension ipynb) doesn’t work if you don’t install an additional package. Luckily, there is an easy way to get this working found on Axel’s blog.
I used the following code to enable double-click … Read the rest “Starting your Jupyter Notebook with a double-click”