********************************************************************
*
* Standard test suite for GTAPinGAMS
*
* Since:  July 2015
* Author: Wolfgang Britz
*
********************************************************************

 output dir = ..\batchOutput
 work   dir = ..\gams
 res    dir = ..\results
 dat    dir = ..\data
 scrdir = d:\scrdir

*---------------------------------
*
* Generate data sets
*
*---------------------------------
*

  ontext
  task = Import from GTAPAGG
*
* --- generate 57x68 data set without filtering,
*
  batchName = 57x68, no filtering
  Input file from GTAPAGG (*.zip) = 57X68
  Load land use data = ON
  Land use data file (*.zip) = 2007LUv81
  Filter method = Rebalancing
  Absolute tolerance, 1.E = -10
  Relative tolerance = 1.0
  Relative tolerance .E = -10
  Postfix for data set name = noFilter

  Minimum number of transactions = 50000
  Number of stepwise increases of thresholds = 20
  Penalty for deviation from = Private consumption, Government consumption, Investments,Intermediate consumption,Factor income plus bop, GDP
  Print gams code to listing = offListing

  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 600000 transaction
*
  batchName = 57x68, 0.1% 600000
  Minimum number of transactions = 600000
  Postfix for data set name = 600000
  Relative tolerance = 0.1
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 700000 transaction
*
  batchName = 57x68, 0.1% 700000
  Minimum number of transactions = 700000
  Postfix for data set name = 700000
  Relative tolerance = 0.1
  Relative tolerance .E = 0
  execute=Gamsrun

*
* --- generate 57x68 data set with filtering, 500000 transaction
*
  batchName = 57x68, 0.1% 500000
  Minimum number of transactions = 500000
  Postfix for data set name = 500000
  Relative tolerance = 0.1
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 400000 transaction
*
  batchName = 57x68, 0.5% 400000
  Minimum number of transactions = 400000
  Postfix for data set name = 400000
  Relative tolerance = 0.2
  Relative tolerance .E = 0
  execute=Gamsrun
*
  batchName = 57x68, 0.2% 380000
  Minimum number of transactions = 380000
  Postfix for data set name = 380000
  Relative tolerance = 0.2
  Relative tolerance .E = 0
  execute=Gamsrun

  batchName = 57x68, 0.2% 360000
  Minimum number of transactions = 360000
  Postfix for data set name = 360000
  Relative tolerance = 0.5
  Relative tolerance .E = 0
  execute=Gamsrun

  batchName = 57x68, 0.5% 340000
  Minimum number of transactions = 340000
  Postfix for data set name = 340000
  Relative tolerance = 0.5
  Relative tolerance .E = 0
  execute=Gamsrun

  batchName = 57x68, 0.5% 320000
  Minimum number of transactions = 340000
  Postfix for data set name = 320000
  Relative tolerance = 0.5
  Relative tolerance .E = 0
  execute=Gamsrun

* --- generate 57x68 data set with filtering, 300000 transaction
*
  batchName = 57x68, 0.5% 300000
  Minimum number of transactions = 300000
  Postfix for data set name = 300000
  Relative tolerance = 0.5
  Relative tolerance .E = 0
  execute=Gamsrun

*
* --- generate 57x68 data set with filtering, 280000 transaction
*
  batchName = 57x68, 0.5% 280000
  Minimum number of transactions = 280000
  Postfix for data set name = 280000
  Relative tolerance = 0.5
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 260000 transaction
*
  batchName = 57x68, 0.5% 260000
  Minimum number of transactions = 260000
  Postfix for data set name = 260000
  Relative tolerance = 0.5
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 240000 transaction
*
  batchName = 57x68, 0.5% 240000
  Minimum number of transactions = 240000
  Postfix for data set name = 240000
  Relative tolerance = 0.5
  Relative tolerance .E = 0
  execute=Gamsrun

*
* --- generate 57x68 data set with filtering, 220000 transaction
*
  batchName = 57x68, 1% 220000
  Minimum number of transactions = 220000
  Postfix for data set name = 220000
  Relative tolerance = 1.0
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 200000 transaction
*
  batchName = 57x68, 1% 200000
  Minimum number of transactions = 200000
  Postfix for data set name = 200000
  Relative tolerance = 1.0
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 180000 transaction
*
  batchName = 57x68, 1% 180000
  Minimum number of transactions = 180000
  Postfix for data set name = 180000
  execute=Gamsrun

*
* --- generate 57x68 data set with filtering, 160000 transaction
*
  batchName = 57x68, 1% 160000
  Minimum number of transactions = 160000
  Postfix for data set name = 160000
  execute=Gamsrun

*
* --- generate 57x68 data set with filtering, 140000 transaction
*
  Relative tolerance = 0.2
  Relative tolerance .E = 1
  batchName = 57x68, 1% 140000
  Minimum number of transactions = 140000
  Postfix for data set name = 140000
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 120000 transaction
*
  batchName = 57x68, 2% 120000
  Minimum number of transactions = 120000
  Postfix for data set name = 120000
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 100000 transaction
*
  batchName = 57x68, 2% 100000
  Minimum number of transactions = 100000
  Postfix for data set name = 100000
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 80000 transaction
*
  Relative tolerance = 0.2
  Relative tolerance .E = 1
  batchName = 57x68, 2%  80000
  Minimum number of transactions = 80000
  Postfix for data set name = 80000
  execute=Gamsrun
*
* --- generate 57x68 data set with filtering, 60000 transaction
*
  batchName = 57x68, 2% 60000
  Minimum number of transactions = 60000
  Postfix for data set name = 60000
  execute=Gamsrun

  offtext

*---------------------------------
*
* Simulation runs
*
*---------------------------------
*
  task = Simulation

  Standard GTAP model = OFF
  hide_Modules = CO2_Emissions
  Non default parameters = OFF
  Parameter file = base_scenarios\noShock
  Foreign savings = Global equal returns to capital
  Government = Tax income
  Exchange rate = Monetary Union
  Final consumption = Spending
  hide_Mobile factors = UnSkLab,SkLab,Capital,Land
  Output = GDX
  Output for flow schemer = ON
  Output for price schemer = ON
  Post model regional and sector aggregation = OFF
  Aggregation file = 10x10

  Solution algorithm = CNS
  Algorithm for NLP = CONOPT
  Algorithm for CNS = CONOPT4
  Use CNS first = ON

  Option file Conopt = 2
  Option file Path = 2
  Maximal seconds for one model solve = 500
  Number of repeated solves = 5.0
  Substitute out prices = ON
  Scale transactions = ON
  Global scaling factor, 1.E- = 3
  Threshold for transactions, 1.E- = 8

  Presolve steps with fixed import prices = 5
  Solve mode = Fixed foreign savings
  Use grid solve for presteps = ON
  Supress output from presolve = ON

  Print gams code to listing = offListing
  Symbol list = offSymList
  Symbol list with cross references = offSymxRef
  Solprint = Off
  Limrow = 0
  Limcol = 0
  Dynamics = Comparative static

  Numeraire regions = all
  Numeraire products = all


  Residual region = usa
  Scenario file = Policy_Shocks\Tariffs


    for solver = CONOPT3 \ CONOPT4

     if %solver% = CONOPT3
        Algorithm for CNS = CONOPT
     else
        Algorithm for CNS = CONOPT4
     endif

     for mode = PRESOLVE \ NOPRESOLVE

        if %mode% = PRESOLVE
           Presolve steps with fixed import prices = 3
        else
           Presolve steps with fixed import prices = 0
        endif
        for DB = 60000  \ 80000 \ 100000 \ 120000 \ 140000 \ 160000 \ 180000 \  200000 \ 220000 \ 240000 \ 260000 \ 280000 \ 300000 \ 320000 \ 340000 \ 360000 \ 380000 \ 400000 \ 500000 \ 600000 \ 700000 \ noFilter

           batchName = 57x68_%DB%_%solver%_%mode%
           Input file (*.gdx) = 57x68_%DB%
           Scenario description = %solver%_%mode%
           execute=Gamsrun

        endfor
     endfor

  endfor

