GAMS program for a CGE analysis of border adjustment policy

I wrote a paper of a CGE analysis of border adjustment policy.

Takeda, S., Tetsuya, H., & Arimura, T. H. (2012). “A Computable General Equilibrium Analysis of Border Adjustments Under the Cap-and-Trade System: A Case Study of the Japanese Economy.” Climate Change Economics, 03(01), http://dx.doi.org/10.1142/S2010007812500030.

The CGE analysis of this paper was conducted with GAMS. You can download GAMS code for this paper from http://shirotakeda.org/en/research/cge_ba.html.



GAMS mode (ver.6.3)

GAMS mode for Emacs version 6.3 is released.

You can download GAMS model from Github https://github.com/ShiroTakeda/gams-mode/releases. Or you can install GAMS mode from MELPA.



GAMS mode (ver.6.0)

GAMS mode for Emacs version 6.0 is released.

http://shirotakeda.org/en/gams/gams-mode.html

In addition, now you can install GAMS mode from MELPA repository. Try M-x list-packages and select gams-mode. Note that installation from MELPA only installs gams-mode.el and does not install other files.

Moreover, you can download developing version of GAMS mode from https://github.com/ShiroTakeda/GAMS-mode.

6.0: 2016-03-02

Note: Important changes have been added to this version of GAMS mode. Read the explanation below carefully and change your configurations in init.el file.
  • Changed the name of the main lisp code from “gams.el” to “gams-mode.el”.
  • The name of feature provided by gams-mode.el changed from gams to gams-mode. So you need to use (require ‘gams-mode) instead of (require ‘gams).
  • Changed the name of variables and functions whose prefix is “gams*” or “gams:”. Now all variables and functions defined in gams-mode.el have prefix “gams-“. As a result of this change, names of the following customizable variables changed.
      Old name                         New name   
      `gams:process-command-name'   -> `gams-process-command-name'
      `gams:process-command-option' -> `gams-process-command-option'
      
    You need to modify init.el setting.
  • Change the default value of variables `gams-statement-file’ and `gams-template-file’.
      gams-statement-file -> "~/.emacs.d/gams-statement.txt"
      gams-template-file -> "~/.emacs.d/gams-template.txt"
      

GAMS mode (ver.5.0)

GAMS mode for Emacs version 5.0 is released.

http://shirotakeda.org/en/gams/gams-mode.html


5.0: 2016-02-03

  • Suppose that you have a code like
    $setglobal sub_program sub_program_default.gms
    
    $include %sub_program%
    

    With this code, GAMS reads the content of sub_program_default.gms file. But the items in sub_program_default.gms file is not displayed when you evoke `gams-show-identifier-list’ (C-cC-a) because GAMS mode regards %sub_program% as a filename literally and cannot find it.

    In the new GAMS mode, you can list the items in sub_program_default.gms file by adding the following line.

    $setglobal sub_program sub_program_default.gms
    
    * gams-include-file: sub_program_default.gms
    $include %sub_program%
    

    The line “* gams-include-file: sub_program_default.gms” is a comment line and GAMS ignores it. But the GAMS mode interprets that

    $include sub_program_default.gms
    

    So the items in “sub_program_default.gms” are listed by `gams-show-identifier-list’.

    The specification by “gams-include-file” is used in the sample file “gams-sample.gms”.

  • Fixed the bug (wrong number of arguments) in `gams-insert-statement-extended’.
  • Removed variable `gams-multi-process’.
  • Changed the name of function `gams-view-docs’ to `gams-view-document’.
  • Changed the default value of `gams-sil-expand-file-more’ to t.


econ.bst (ver.2.1)

econ.bst (ver.2.1) is released.

econ.bst is available from http://shirotakeda.org/en/tex/econ-bst.html

Ver. 2.1 (2013-07-09)

  • URL field: In the new econ.bst, URL field can be displayed. If you set non-zero to `bst.show.url’, url field is displayed before note field (this is the default behavior). If you set zero to `bst.show.url’, url field is suppressed.
  • Added the new function `bst.url.pre’ and `bst.url.post’. These functions specify the strings before and after url field.
  • access field: Added the new function `bst.access.pre’ and `bst.access.post’. These functions specify the strings before and after access field. Note that access field is specific to econ.bst and not inherent in the standard bib file. The value of access field is used for accessed date for URL. For example, suppose that there are the following two settings in the bib file
    
          url          = {http://shirotakeda.org/en/tex/econ-bst.html},
          access       = {4th July, 2013}
      
    In the default econ.bst, these settings generate the reference like
    URL: http://shirotakeda.org/en/tex/econ-bst.html, accessed on 4th July, 2013.
  • Added the new function `bst.show.doi’. If you set non-zero to `bst.show.doi’, DOI field is displayed before note field. If you set zero to `bst.show.doi’, DOI field is suppressed (this is the default behavior). Note that DOI field is not inherent in the standard bib file. See econ-sample.pdf for an example.
  • Added the new function `bst.doi.pre’ and `bst.doi.post’. These functions specify the strings before and after DOI field.
  • Added the new function `bst.post.note’. This function specifies the strings after note field.
  • Added new type “online”. This is the document type for web page. Note that this is not inherent in the standard bib file and it does not work for other bst files.

GAMS mode (ver.4.2)

GAMS mode for Emacs version 4.2 is released.

http://shirotakeda.org/en/gams/gams-mode.html

4.2: 2013-02-16

  • Added the new variables `gams-outline-regexp-font-lock’ and `gams-level-color-stars-only’. With this chage, headlines are colored according to their level. See Screenshot Page.

GAMS mode (ver.4.1)

GAMS mode for Emacs version 4.1 is released.

http://shirotakeda.org/en/gams/gams-mode.html

4.1: 2012-10-13

  • Fixed minor bugs.
  • Changed the explanation in BUGS_PROBLEMS.txt and README.txt. Until the previous version, I recommended to add the following setting to Emacs.
      (setq jit-lock-chunk-size 50000)
    
    This is for making coloring in GAMS mode work well. But now I recommend the following setting:
      (setq font-lock-support-mode '((gams-mode . nil) (t . jit-lock-mode)))
    
    This means that font-lock-support-mode is not used in GAMS mode. By this setting, Emacs is likely to slow down when you open GAMS files, but you will encounter less troubles in coloring of GAMS mode.
  • Abolished the command `gams-outline-external’ (and deleted files associated with this command).

GAMS mode (ver.4.0)

GAMS mode for Emacs version 4.0 is released.

http://shirotakeda.org/en/gams/gams-mode.html

  • Made several changes on GAMS-SIL mode.

    We often include the same file many times in a program. For example, supose that a GAMS program includes the following codes.

      $batinclude aggr vst i r vst_
      $batinclude aggr vtwr i j r s vtwr_
      $batinclude aggr vom g r vom_
    
    In this code, aggr.gms is included repeatedly. In the previous GAMS-SIL model, the content of aggr.gms is expanded repeatedly in GAMS-SIL buffer. But in the new gams.el, aggr.gms is expanded only once (only first time).

  • Added a new new function `gams-sil-toggle-expand-file-more’ and a lisp variable `gams-sil-expand-file-more’ (the default value is nil).

    In GAMS-SIL mode, the contents of files included by $include commands are usually expanded. For example, if your program includes the following code:

      $include zzz.gms
    
    then, the content of zzz.gms above is always expanded in GAMS-SIL. However, if the file is included conditionally like
      $if exist xxx.gms $include xxx.gms
      $if %scenario%="bau" $include xxx.gms
    
    the content of xxx.gms is not expanded by default.

    If you want to expand the content of conditionally inluced files, type “x” in GAMS-SIL buffer. This evokes `gams-sil-toggle-expand-file-more’ command.

    If you always want to expand the content of conditionally inluced files, then set non-nil to the lisp variable `gams-sil-expand-file-more’.

  • Added the new lisp variable `gams-sil-expand-batinclude’ (default value is t).

    In GAMS-SIL mode, the contents of files included by $include commands are always expanded. But files included by $batinclude are not expanded if `gams-sil-expand-batinclude’ is nil.

  • Changed the default value of `gams-special-comment-symbol’ from “com:” to “@”. This is the string to specify the special comment like
      display "@ This is the special comment line";
    
    The special comment line is used for headlines in GAMS-SIL mode and GAMS-OUTLINE mode.
  • Added outline representation like Org-mode (or outline mode). You can only show headlines of a GAMS program.

    By default, lines starting with *@ are regarded as headlines.

      *@ 	The top level headline
      *@@ 	Second level
            text text
      *@@@ 	Third level
            text text
      *@ 	Another top level headline
    
    You can change outline representation by the following two commands:
    • `org-cycle’ (binded to TAB key)
    • `org-global-cycle’ (binded to Shift+TAB key).

    `org-cycle’ command works only on headlines and toggles hide/show the body of programs. `org-global-cycle’ toggles hide/show entire program.

    Open a sample file “org-minor-mode.gms” and try TAB and Shift+TAB.

    This feature uses codes in Org-mode. So if you want to use this feature, Org-mode must be installed (The recent Emacs has Org-mode by default). In addition, note that this command may depend on the version of Org-mode. I test in Org-mode of 7.8.11.


    [How to change symbols for headlines]

    In the default setting, “*@” is used as symbols to represent headlines. This is determined by the lisp variable `gams-outline-regexp’. This variable specifies the regular expressions of the symbol used to represent headlines and its default value is

      "\\*@+[ \t]"
    
    If you change the value of this variable, you can change symbols for headlines. For example, add the following expression to your init.el file
      (setq gams-outline-regexp "[ \t]*display \"@+[ \t]")
    
    And open “org-minor-mode-alt.gms”.


    [Other commands for outline handling]

    • “C-cC-:n” -> Move to the next headlines (`outline-next-visible-heading’).
    • “C-cC-:p” -> Move to the previous headlines (`outline-previous-visible-heading’).
    • “C-cC-:f” -> Fold the current tree (`gams-org-fold-current-tree’).
    • “C-cC-:k” -> Show branches (`show-branches’).
  • Changed the default indent number from 8 to 4.
  • Changed the name of sample setting file from “dot-emacs-sample” to “setting-sample.el”.

GAMS mode (ver.3.6.6)

GAMS mode for Emacs version 3.6.6 is released. This is a bug fix release.

http://shirotakeda.org/en/gams/gams-mode.html
  • Quited supporting XEmacs because I have no environment for testing XEmacs.
  • Increased the default value of `gams-lxi-maximum-line’ (from 500000 to 1000000).
  • Fixed a bug in `gams-show-identifier’.
  • Fixed many minor bugs.

Website was restored

I tried to update MODX for my website and failed… The database was destroyed and I had to restore the website manually.

Here is the new website http://shirotakeda.org. There are only small changes in the contents but note that I changed URL for all pages (except for the top page).

  • Old URL is http://shirotakeda.org/home/…
  • New URL is given by http://shirotakeda.org/en/…

For example, the page for GAMS mode for Emacs changed from http://shirotakeda.org/home/gams/gams-mode.html to http://shirotakeda.org/en/gams/gams-mode.html.