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

ontext

*---------------------------------
*
* Generate data sets
*
*---------------------------------
*
  task = Import from GTAPAGG
*
* --- generate 57x82 data set without filtering,
*
  batchName = 57x82, no filtering
  Input file from GTAPAGG (*.zip) = 57X82
  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 57x82 data set with filtering, 1E.-6, 800000 transaction
*
  batchName = 57x82, 1.E-6% tiny
  Number of stepwise increases of thresholds = 2
  Minimum number of transactions = 800000
  Postfix for data set name = tiny
  Relative tolerance = 1
  Relative tolerance .E = -6
  execute=Gamsrun
*
* --- generate 57x82 data set with filtering, 800000 transaction
*
  batchName = 57x82, 0.01% 800000
  Number of stepwise increases of thresholds = 10
  Minimum number of transactions = 800000
  Postfix for data set name = 800000
  Relative tolerance = 1
  Relative tolerance .E = -2
  execute=Gamsrun
*
* --- generate 57x82 data set with filtering, 700000 transaction
*
  batchName = 57x82, 0.01% 700000
  Number of stepwise increases of thresholds = 10
  Minimum number of transactions = 700000
  Postfix for data set name = 700000
  Relative tolerance = 1
  Relative tolerance .E = -1
  execute=Gamsrun


*
* --- generate 57x82 data set with filtering, 600000 transaction
*
  batchName = 57x82, 0.01% 600000
  Number of stepwise increases of thresholds = 10
  Minimum number of transactions = 600000
  Postfix for data set name = 600000
  Relative tolerance = 1
  Relative tolerance .E = -1
  execute=Gamsrun

*
* --- generate 57x82 data set with filtering, 500000 transaction
*
  batchName = 57x82, 0.1% 500000
  Number of stepwise increases of thresholds = 10
  Minimum number of transactions = 500000
  Postfix for data set name = 500000
  Relative tolerance = 0.2
  Relative tolerance .E = 0
  execute=Gamsrun

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

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

  Number of stepwise increases of thresholds = 30

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

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

* --- generate 57x82 data set with filtering, 300000 transaction
*
  batchName = 57x82, 0.5% 300000
  Minimum number of transactions = 300000
  Postfix for data set name = 300000
  Relative tolerance = 1.0
  Relative tolerance .E = 0
  execute=Gamsrun
*
* --- generate 57x82 data set with filtering, 280000 transaction
*
  batchName = 57x82, 0.5% 280000
  Minimum number of transactions = 280000
  Postfix for data set name = 280000
  Relative tolerance = 1.0
  Relative tolerance .E = 0
  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 =
  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 = on
  Limrow = 0
  Limcol = 0

  Maximal seconds for one model solve = 2000
  Number of repeated solves = 5.0
  Presolve steps with fixed import prices = 3
  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

     if %solver% = CONOPT3
        Algorithm for CNS = CONOPT
        Algorithm for NLP = CONOPT
     else
        Algorithm for CNS = CONOPT4
        Algorithm for NLP = 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 = 280000 \ 300000 \ 320000 \ 340000 \ 360000 \ 380000 \ 400000 \ 500000 \ 600000 \ 700000 \ 800000 \ tiny \ noFilter

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

        endfor
     endfor

  endfor


