********************************************************************
*
* 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:\scrdir36

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

  ontext

  task = Import from GTAPAGG

*
* --- generate 57x36 data set without filtering,
*
  Solprint = silent
  batchName = 57x36, no filtering
  Input file from GTAPAGG (*.zip) = 57X36
  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 57x36 data set with filtering, 300000 transaction
*
  batchName = 57x36, 0.2% 400000
  Minimum number of transactions = 400000
  Postfix for data set name = 400000
  Relative tolerance = 0.0001
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x36 data set with filtering, 300000 transaction
*
  batchName = 57x36, 0.2% 380000
  Minimum number of transactions = 380000
  Relative tolerance = 0.001
  Postfix for data set name = 380000
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x36 data set with filtering, 300000 transaction
*
  batchName = 57x36, 0.2% 360000
  Minimum number of transactions = 360000
  Postfix for data set name = 360000
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x36 data set with filtering, 300000 transaction
*
  batchName = 57x36, 0.2% 340000
  Minimum number of transactions = 340000
  Postfix for data set name = 340000
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x36 data set with filtering, 300000 transaction
*
  batchName = 57x36, 0.2% 320000
  Minimum number of transactions = 320000
  Postfix for data set name = 320000
  Relative tolerance = 0.01
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x36 data set with filtering, 300000 transaction
*
  batchName = 57x36, 0.2% 300000
  Minimum number of transactions = 300000
  Postfix for data set name = 300000
  Relative tolerance = 0.2
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x36 data set with filtering, 280000 transaction
*
  batchName = 57x36, 0.2% 280000
  Minimum number of transactions = 280000
  Postfix for data set name = 280000
  Relative tolerance = 0.2
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x36 data set with filtering, 260000 transaction
*
  batchName = 57x36, 0.2% 260000
  Minimum number of transactions = 260000
  Postfix for data set name = 260000
  Relative tolerance = 0.2
  Relative tolerance .E = 0
  execute=Gamsrun

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

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


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

*
* --- generate 57x36 data set with filtering, 160000 transaction
*
  batchName = 57x36, 0.5% 160000
  Minimum number of transactions = 160000
  Postfix for data set name = 160000
  Relative tolerance = 0.5
  execute=Gamsrun

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

  offtext

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

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

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

  Option file Conopt = 2
  Option file Path = 1
  Substitute out prices = ON
  Scale transactions = ON
  Global scaling factor, 1.E- = 3
  Threshold for transactions, 1.E- = 8


* Zero iterations, will only test check case = OFF
  Print gams code to listing = offListing
  Symbol list = offSymList
  Symbol list with cross references = offSymxRef
  Solprint = off
  Limrow = 0
  Limcol = 0

  Maximal seconds for one model solve = 1000
  Number of repeated solves = 5.0
  Presolve steps with fixed import prices = 5
  Use grid solve for presteps  = ON
  Supress output from presolve = ON
  Solve mode = Fixed foreign savings
  Dynamics = Comparative static

  Numeraire regions  = all
  Numeraire products = all
  Residual region = usa


    Scenario file = Policy_Shocks\Tariffs

*   for solver = CONOPT3 \ CONOPT4
    for solver = 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 \ noFilter

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

        endfor
     endfor

  endfor


