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

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

*gamsoptions= LP=CONOPT NLP=CONOPT

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

  task = Import from GTAPAGG

  Postfix for data set name = test
*
* --- generate 10x10 data set without any filtering
*
  batchName = 10x10, no filtering
  Input file from GTAPAGG (*.zip) = 10x10
  Load land use data = ON
  Land use data file (*.zip) = GTAPlandusedatafor_LU_2011
  Load Non-CO2 emissions = ON
  Non-CO2 emissions data (*.har) = CONSLD_2011
  Generate MRIO split factors = ON
  Fix import demand during split = OFF
  Delete intermediate GDX file = ON
  Delete intermediate HAR file = ON
  Apply SAM split = OFF
  Use manual re-aggregation = OFF
  Split information file = osd
  Manuel aggregation file = gtap_water
  Filter method = Rebalancing
  Absolute tolerance, 1.E = -10
  Minimum number of transactions = 50000
  Relative tolerance = 1.0
  Relative tolerance .E = -6
  Use grid solve = ON
  Number of stepwise increases of thresholds = 10
  Penalty for deviation from = Private consumption, Government consumption, Investments,Intermediate consumption,Factor income plus bop, GDP
  Only allow for diagonal crop by crop intermediate use = ON
  Minimal cost share for value added in % = 5
  Reduced thresholds only in combination = OFF
  Reduced relative tolerance = 1.0
  Reduced relative tolerance .E = -2
  Print gams code to listing = offListing
  Symbol list = offSymList
  Symbol list with cross references = offSymxRef
  Profile = 0
  ProfileTol = 0.1
  Solprint = On
  Limrow = 0
  Limcol = 0

  execute=Gamsrun
*
* --- generate 57x10 data set without filtering,
*
  batchName = 57x10, no filtering
  Input file from GTAPAGG (*.zip) = 57X10
  execute=Gamsrun
*
* --- generate 57x24 data set without filtering,
*
  batchName = 57x24, no filtering
  Input file from GTAPAGG (*.zip) = 57X24
  execute=Gamsrun

*
* --- generate 57x36 data set with filtering,
*
  batchName = 57x36, 1%, 250000
  Input file from GTAPAGG (*.zip) = 57X36
  Minimum number of transactions = 250000
  execute=Gamsrun

*
* --- generate 57x45 data set with filtering,
*
  batchname = 57x45, 1%, 250000
  Input file from GTAPAGG (*.zip) = 57X45
  execute=Gamsrun
*
* --- generate 57x56 data set with filtering,
*     again somewhat higher number of transactions
*
  batchname= 57x56, 1%, 250000
  Input file from GTAPAGG (*.zip) = 57X56
  execute=Gamsrun

*---------------------------------
*
* Solve tests
*
*---------------------------------
*
  task = Simulation

  Use pre-defined configurations = OFF
  Predefined configurations = GLOBE
  Dynamics = Comparative static
  Number of years = 40
  Time resolution = 4
  Mimic comp-Static = OFF
  Report frequency = 1
  Regional coverage = Global model
  Region in model = Oceania
  International prices = CET_CES
  Overall closure = GE
  Modules =
  Depreciation period = 10
  hide_DemandSystem = CDE
  Absolute tol.\nfor small imports, 1.E = -10
  Relative tol.\nfor small imports, 1.E = -10
  Mobile factors = Land,Capital,UnSkLab,SkLab
  Factors with fixed prices =
  Parameter file 1 = IO_Subs
  Parameter file 2 = ND_VA
  Parameter file 3 = empty
  Parameter file 4 = empty
  Parameter file 5 = empty
  Regions with NUTS2 breakdown =
  AEZ-disaggregation of NUTS2 = ON
  Bi-lateral import and tariffs at tariff line level = ceta
  myGTAP file = myGTAP_GTAP_AGR
  Use expansion elasticity to adjust final demand per household = ON
  Remittances sent = Driven by labor income
  Remittances received = Share on global total
  Foreign capital income sent = Driven by capital income
  Foreign capital income received = Share on global total
  Foreign aid sent = Driven by factor income
  Foreign aid received = Share on global total
  MRIO commodities = all
  PE commodities = GrainsCrops-c,MeatLstk-c,Extraction-c,ProcFood-c,TextWapp-c,LightMnfc-c,HeavyMnfc-c,Util_Cons-c,TransComm-c,OthServices-c
  Baseline generation = ON
  Baseline results = baseline_57x10_G-RDEM_AIDADS_GDP_SSP1_POP_SSP1_CC_None_CS_OFF
  SSP scenario for population = SSP3
  SSP scenario for GDP growth = SSP2
  Source GDP growth = OECD Env-Growth
  Debt accumulation = OFF
  Regions with debt accumulation = 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,
  Saving rates depend income, its growth and age composition = OFF
  Productivity growth differentiated by sector = OFF
  Cost shares depend on GDP per capita = OFF
  RCP for CC impacts on yields = None
  Statistics for CC impacts on yields = Mean
  Land = 0.05
  Irrigation water = 0.05
  Natural ressources = 0.2
  Labour force = 1.0
  Land TP = 0.0
  Irrigation water TP = 0.0
  Natural ressources TP = 0.0
  Labour force TP = 0.0
  Capital TP = 0.0
  Land XF = 0.0
  Irrigation water XF = 0.0
  Natural ressources XF = 0.1
  Labour force XF = 0.0
  Melitz commodities = all
  Melitz commodities\n subject to cost share = all
  HETSetup = Melitz
  Fix cost nest = ON
  Keep multi-stage CES = OFF
  Pareto distribution lower limit = 0.2
  Shape parameter = 4.6
  Max cost share for HET own domestic interm. demand = 0.1
  Initialize Melitz model for shock = OFF
  Residual region = Oceania
  Foreign savings = Fixed foreign savings
  Government = Tax income
  Final consumption = Spending
  Regional numeraire = Exchange rate
  GDP price deflator = Fisher
  Factors with factors tax udates = Land,Capital,UnSkLab,SkLab,NatRes
  Use additional closure file = OFF
  Closure file = empty
  Products with consumption udates = GrainsCrops-c,MeatLstk-c,Extraction-c,ProcFood-c,TextWapp-c,LightMnfc-c,HeavyMnfc-c,Util_Cons-c,TransComm-c,OthServices-c
  Output = GUI
  Store bi-lateral results = ON
  Output string for solveReport = p_solvereport,pf.l,pffix
  Trade in VA indicators = OFF
  Store SAM in GDX = OFF
  Store benchmark = ON
  Welfare decomposition = OFF
  Post model regional and sector aggregation = OFF
  Aggregation file = 10x10
  Solution algorithm = CNS
  Option file Conopt = 1
  Option file MCP = 1
  Algorithm for CNS = CONOPT4
  Algorithm for NLP = CONOPT4
  Algorithm for MCP = PATH
  Use CNS first = ON
  FixAtBounds with CNS = OFF
  Use bounds = ON
  Maximal seconds for one solve = 1000
  Number of repeated solves = 3.0
  Zero iterations benchmark = OFF
  Zero iterations shock = OFF
  Kill bounds = OFF
  Substitute out\nimport/domestic\n prices = ON
  Armington\n prices = OFF
  quantities = ON
  Global scaling factor, 1.E- = 3
  Scaling exponent = 1.0
  Minimum scaling factor, 1.E- = 0
  Threshold for transactions, 1.E- = 10
  Threshold for SAM imbalance tests, 1.E- = 6
  Presolve steps with fixed import prices = 3
  Solve mode = Fixed foreign savings
  Use grid solve for presteps = ON
  Full model pre-solve with fixed supply = ON
  Full model pre-solve with fixed supply in each iteration = OFF
  Supress output from presolve = ON
  Print gams code to listing = offListing
  Symbol list = offSymList
  Symbol list with cross references = offSymxRef
  Profile = 0
  ProfileTol = 0.1
  Solprint = Off
  Limrow = 1000
  Limcol = 1000


  Numeraire regions  = all
  Numeraire products = all


* for solveMode  = CNS \ MCP
  for solveMode  = CNS
*
*    --- set option depending on solver
*
     if %solveMode% = CNS

        Solution algorithm = CNS
        Substitute out prices = ON

     else

        Substitute out prices = OFF
        Solution algorithm = MCP

     endif
*
*    --- define models variant tests and define matching interface settings
*
     for variant  = Fixed Allocation of global investments \ Global Bank \ Global Bank + GTAP_AEZ + GTAP_AGR \

        if %variant% = Fixed Allocation of global investments

           Foreign Savings = Fixed global allocation of investments
           hide_Modules = CO2_Emissions

        elseif %variant% = Global Bank

           Foreign Savings = Global equal returns to capital
           hide_Modules = CO2_Emissions

        else

           Foreign Savings = Global equal returns to capital
           hide_Modules    = GTAP_AGR,GTAP_AEZ,CO2_Emissions

        endif
*
*        ---- define data sets for which the variants will be tested
*
        for input = 57x10_test \ 57x24_test \57x36_test \ 57x45_test \ 57x56_test

*---------------------------------------------
*
* %solveMode%, check for %input%, %variant%
*
*---------------------------------------------

*
*             --- define the residual regions depending on the data set
*
              if  %input% = 10x10_test
                 Residual region = Oceania
                 Numeraire regions = Oceania
              elseif %input% = 57x10_test
                 Residual region = namerica
                 Numeraire regions = namerica
              else
                 Residual region = USA
                 Numeraire regions = USA
              endif
*
*             --- select input file
*
              Input file (*.gdx) = %input%
*
*             --- run the different policy experiments in parallel
*
              startParallel

              batchName = Tariffs
              Scenario file = Policy_Shocks\Tariffs
              execute=Gamsrun

              batchName = Consumption taxes
              Scenario file = Policy_Shocks\Consumption_taxes
              execute=Gamsrun

              batchName = Direct taxes
              Scenario file = Policy_Shocks\Direct_taxes
              execute=Gamsrun

              batchName = Factor taxes/subsidies
              Scenario file = Policy_Shocks\Factor_taxes_and_subsidies
              execute=Gamsrun

              batchName = TP
              Scenario file = end_and_tp_shocks\Factor_specific_TP
              execute=Gamsrun

              batchName = Factor supply
              Scenario file = end_and_tp_shocks\Factor_supply_changes
              execute=Gamsrun

              collectParallel

        endfor
     endfor
  endfor
