Home

GGIG Graphical Interface Generator Programming Guide

image

Contents

1. dim7text dim8text dim8Gtext to handle later as props of AgpDataView 1E d efpivot TE IE IE s defview fractiondigits 1000 codesandkeys null comparedim null compareitem null comparemode null hideEmptyRows null hideEmptyCols null COO null pdf null evalall null language null Filters for the elements in the different dimensions Without filters all elements found on a logical dimension will be shown to the user in any table The exemptions are the items either defined for the product or the activity dimension see above In order to restrict the selection in the other logical dimensions a selection list can be defined in the table definition Take as an example the following XML tag lt regionSel gt MS lt regionSel gt It means that the table will only show elements with the tag lt region gt see below which comprise MS in their lt sel gt field The example would refer to the Member States There is a specific selection list lt regionSel gt FromDataCube lt regionSel gt Which will neglect the elements under lt region gt as defined in the file but rather takes any one found in the data cube The option was introduced to avoid the necessity to define all 180 000 HSMU codes in the file Alternatively a regex string can be used e g lt dim5Sel gt red 0 9 _regex lt dim5Sel gt GGIG Graphical Interface Generator Documentation
2. Attaching long texts and filters to elements Items for activities products regions and dim5 are typically defined in the file see the following example lt region gt lt key gt SK020038 lt key gt lt itemName gt SK020 FT41 GT100 Specialist dairying FT 41 lt itemName gt lt sel gt all RS SK FA SKFA FT41 GT100 FT41GT100 lt sel gt lt region gt The definitions for one item are enclosed in the tag lt region gt lt region gt lt activity gt lt activity gt lt product gt lt product gt lt dim5 gt lt dim5 gt The order of the items in the tables is defined by these lists Each item has a key which corresponds to the symbol identifier found in the GDX file The keys are case sensitive The itemName is a long text which is typically shown to the user The elements found between the lt sel gt lt sel gt tags can be used as filters in table definitions or interactively by the user A specific tag is lt aggreg gt yes lt aggreg gt When found for an item in the rows it will be shown twice in the table once in the top part and then again The structure of the GAMS generated gdx files used by the exploitation tools The exploitation tools load directly the gdx files generated by the GAMS processes linked to the tasks described above The gdx files only store non zero numerical values The main content of a gdx file are two types of records The first type provides a list of
3. Purpose Used for on off settings i e in cases where one of two options must be chosen e g in cases of project modules which can be used or not 1 of 2 Cannot be used for 1 of n selections where n 2 use a List instead Applicable fields Title GamsName Value Tasks Style Control optic Use branching priorities Possible value true false User action tick untick box with mouse Example definition lt control gt lt order 162 6 lt order gt lt Type gt EHBERBBR lt Tupe gt lt Title gt Generate GAMS child processes on different threads lt Title gt lt Value gt true lt Value gt lt gamsName gt threads lt gamsName gt lt tasks gt Build HSHU database Run scenario with market model Generate expost results Run scenario without market model Baseline calibration supply models HSHU baseline Downscale scenario results lt tasks gt lt control gt Output to GAMS SETGLOBAL Priorities false GGIG Graphical Interface Generator Documentation Singelist Purpose Used for 1 of n selections Used in cases where more then 2 mutually exclusive values for a setting are available Applicable fields Title GamsName Value Options Tasks Style Control optic Choose model type Fe IN Note Drop down list will appear if the user clicks on arrow Possible value Defined by options field User action tick untick one of the selection possibilities with mouse Example definit
4. from GUI controls That parallel way to define run specific input is typically necessary for more complex tools where e g policy scenarios are defined in GAMS code The scenario editor is a predefined task which must be named Define scenario e g lt task gt lt name gt Define scenario lt name gt lt userLeuls gt runner Administrator developper debugger lt userLevls gt lt task gt A related setting stores the directory where the input files are found lt scenarioDdir gt lt attr gt scend attr gt lt scenariodir gt Batch execution The batch execution facility is a tool which e Allows executing many different tasks after each other without requiring user input e Reports the settings used any errors and GAMS result codes in a HTML page from which they may queried at a later time e Ensures that each new run generates its own listing file which can be opened from the HTML page e Allows storing the output of the different runs in a separate directory while reading input from unchanged result directories The purpose of the batch execution facility 1s therefore at least twofold On the one hand it allows setting up test suits for the GAMS code of a project such as checking for compilation without errors for all tasks and different settings such as with and without market parts etc Secondly production runs of e g different scenarios can be started automatically Timer facilities allow starting
5. these tags can additional by stored in different lines see example below scontrol gt lt order gt 1118 lt order gt lt Type gt singlelist lt Type gt lt Title gt First year lt Title gt lt Value gt 1984 lt Ualue gt lt Options gt 1984 1985 1986 1987 1988 1989 19981997 1992 1993 19941995 1996 lt Options gt lt xgamsHame gt FirstYear lt gamsHame gt lt tasks gt Prepare national database Finish national database FSS selection routine Build regional time series Build regional database Build global database Generate trend projection Generate farm type trends r tasks s control gt The different tags or keywords are discussed n detail below Standard Java property files deprecated It follows the basic implementation of a property file in Java Each line thus consists of a key value pair separated by an equal sign The definition of the controls is stored in the same file along with general settings such as the name of the GAMS project directories the user name etc For each control one line is used That line comprises all the necessary information to generate the control as well as to store the current setting Wolfgang Britz Version July 2014 14 GGIG Graphical Interface Generator Documentation The control definition file s text based and can hence be edited with any text editor Most of the settings with the exemption of the definitions of the controls themselves can also be e
6. 8 5 Trade and Transport Import supply 8 5 Hotel and restaurants Import supply H 5 Education Import supply 8 5 Other seruices Imnport supply 8 5 Rgriculture Import supply 8 5 Forestry Import supply 8 5 Other primary sectors Import supply 8 5 Food Pracessing Import supply 8 5 Manufacturing Import supply 8 5 Energy Import supply 8 5 Construction Import supply 8 5 Trade and Transport Import supply 8 5 Hotel and restaurants Import supply 8 5 Education Import supply 8 5 Other seruices Import supply 8 5 hgriculture Export demand 8 8 Furestry Export demand 8 8 Other primary sectaors Export demand 8 8 Export demand 8 8 Hanufacturing Export demand 8 8 Energy Expoart demand 8 8 Food Processing Construction Export demand 8 8 Trade and Transport Export demand 8 8 Hotel and restaurants Export demand 8 8 Education Export demand 8 8 Other seruices Export demand 8 8 Rgriculture Export demand 6 6 Furestry Export demand 8 8 Other primary sectors Export demand 8 8 Fond Pra cessing Export demand 8 8 Hanufacturing Export demand 8 0 Energy Export demand B8B Lonstruction Export demand 8 8 Trade and Transport Export demand 0 0 Export demand 8 8 Export demand 8
7. JAVA code Menu bar GGIG allows to add two types of menu items to the menu bar HTML links and e mail sent Wolfgang Britz Version July2014 0 GGIG Graphical Interface Generator Documentation amp helpmenuitem amp name Uiew capri web page lt name gt amp ualue http wwwu capri model orgiz ualue x helpmenuitem gt amp helpmenuitem lt name gt Send mail to capri user listi name lt value gt capritalks ilr uni bonn de lt ualue gt lt type gt mail lt type gt lt fhelpmenuitem gt Design hints for structured programming in GAMS with GGIG Using information passed from GGIG As seen above GGIG passes information mostly via SETGLOBAL settings That has the advantage that the GAMS coder is rather free how to use the information Take the following example which could be generated from a slider SSETGLOBAL STEPS 99 8 There a several ways to use that information in GAMS code below are a few examples 1 Round the setting to an integer with eval in GAMS and use it in a set definition Seval steps round steps set step S1 ZSTEPS 7 2 Use it in an combined definition and declaration statement for a scalar Scalar s_steps STEPS 7 3 Use it in assignment p control Steps STEPS 4 Use it for pre compiler conditions eual steps round steps ifthen steps 5 Use for GAMS program controls GGIG Graphical Interface Generator Documentation if 4STEPS gt 18H E S
8. Version July 2014 32 GGIG Graphical Interface Generator Documentation control Type Eadil Buttons Type lt Title gt Elasticity settings lt Title gt lt options gt Responding Changing Constant lt options gt lt rows gt K1280Q Wheat K1220Q Rye K1230Q Barley K124QQ Dat K126QQ Grain maize K1270Q Rice K1290Q Dry pulses K138QQ Potatoes K131QQ Sugar beet OtherTP Other Crops SE2 86 Livestock SE428 Family Net Income C Losts 1 Land cap Capital lab Labour lt rows gt lt tasks gt DEA lt tasks gt lt columns gt Responding Changing lt columns gt lt range gt 6 1 1 lt range gt lt gamsName gt elasticitySettings lt gamsName gt lt value gt K126QQ Wheat Responding K122QQ Rue Responding K123QQ Grain maize Responding K127QQ Potatoes Responding K131QQ Livestock Responding SE426 Capital Constant Lab K1240Q O at Responding K1260QQ K1290Q Dry pulses Responding K136QQ OtherTP Other Crops Responding SE266 Costs Constant l C lt control gt Output to GAMS SET elasticitySettings K1i260Q Responding K17200 Constant E1230 Constant E1240 Constant E1260 Constant E1270 Constant E1290 Constant K1360Q Constant K13100 Constant therTP Constant SE B6 Constant SE 420 Constant C Changing 1 Constant cap Constant lab Changing Wolfgang Britz Version July 2014 Barl
9. all GGIG features are used it can however host quite complex projects The new GUI for CAPRI built with GGIG offers an example for a rather complex implementation As mentioned above a second important contribution of GGIG is to mechanize to the largest extent the generation storage and later inspection of meta data underlying a scenario and the related result set overcoming an often encountered weakness in economic models And thirdly GGIG offers a bridge between the powerful CAPRI exploitation tools and other GAMS based models It draws on the experiences with BenImpact MIVAD and the village CGEs developed in Advanced Eval GAMS tools models resp Java based GUIs where the CAPRI exploitation tools had been used These GAMS based projects used the CAPRI exploitations but did not add any GUI functionalities to also steer their models The experiences with these examples can hence be seen as the starting point for the development of GGIG in order to expand beyond a pure project adjusted implementation of the CAPRI exploitation tools Some specific skills and eventually serious refactoring of the reporting part of an existing model are necessary to benefit from the full functionality of the CAPRI exploitation tool It therefore pays typically off to start using GGIG for exploitation from the beginning But at least no skills in coding in a higher programming language such as Java are necessary to define the necessary interfaces between t
10. code lists if showing all elements v Clean window with GAMS output with each new GAMS compile start V Use task specific settings in interface Debug XML table definition output to OS prompt Save in dairydyn ini The standard table file can be defined in the XML amp xnlTables amp attr tables xmlz attr amp xmlTables Wolfgang Britz Version July 2014 43 GGIG Graphical Interface Generator Documentation Meta data handling Why meta data Meta data are data about data In many GAMS projects it is impossible or cumbersome to tell exactly based on which shocks and settings results of a model run had been generated That is due to the fact that run specific settings are not stored at all or not stored together stored with the results of the run Later on result users are often left guessing what exactly the settings underlying the run might have been In order to overcome that problem the GGIG drawing on CAPRI GUI concepts passes all interface settings plus the user name and the current time forward to GAMS in one SET called META A correctly defined interface with GGIG should allow to steer all run specific settings If that is the case the meta data generated by GGIG will provide an exact and sufficient definition of all run specific inputs ensuring that all relevant meta data about a run are stored along with quantitative results in the same GDX file Accordingly GDX files shipped to other desk
11. defined reports to exploit the results The details of the different elements are discussed below GGIG Controls and Settings GGIG definition file Control Generator Project specific GUI GAMS include file GAMS Exploitation executable tools GAMS project code Diagram Overview on information flow in GGIG GGIG Graphical Interface Generator Documentation Current applications of GGIG Since the first prototype GGIG has been successfully implemented n a number of projects examples are listed below DairyDyn an fully dynamic single farm model focusing on the impact of Green House Gas emission indicators on allocation and investment decision A small spatial multi commodity model for world trade of cooked and uncooked poultry meat with a focus on trade bans related to Avian Influenca A EU wide layer of regional CGEs with a focus on Rural Development measures on the second pillar of the CAP which is now incorporated into CAPRI LANA HEBAMO A Hydro Economic model for the lake Naivasha in Kenya The FADNTOOL project which combines a set of economic tools for simulating policy impacts based on the FADN data An user interface augmented version of GTAP in GAMS An Agent Based model for structural change in agriculture which s realized in GAMS but uses GGIG as its user interface GGIG Graphical Interface Generator Documentation An overview on the GUI CgeRegEU
12. environmental effects of farming prices or market balances Each view thus e extracts a certain collection of numerical values e labels them so that they carry information to the user long texts units e chooses a matching presentation as a table map or graphic e and arranges them in a suitable way on screen The views can be linked to each other allowing a WEB like navigation through the data cube Views can be grouped to themes The user may open several views in parallel and he may change the views interactively according to his needs e g switch from a map to a tabular presentation or change the pivot of the table sort the rows etc Internally each view is stored in an XML schema Technically a view can be understood as a combination of a pre defined selection query along with reporting information The XML schema allows to attach long texts units and tooltips to the items of a table and thus to show meta data information to the user The XML schema hence replaces look up tables in a DBMS It may equally store information regarding the pivoting the view type table map different graphic types and for maps classification color ramp and number of classes The views can be grouped into logical entities and are shown as a popup menu to the user GGIG Graphical Interface Generator Documentation Tabular views may feature column and row groups Empty columns and rows can be hidden tables can be sorted by column wit
13. gt dairydyn gif lt attr gt lt icon gt Worksteps Worksteps allow to group tasks and thus represent the top level of structuring actions n a tool The following attributes are possible Name Name of the workstep shown as selectable radio button required GGIG Graphical Interface Generator Documentation Tasks List of tasks uk te p gt lt name gt Build database lt name gt lt tasks gt Prepare national database Finish national database FSS selection routine Build regional time series Build regional database Build global database Build HSH database lt f tasks gt lt workstep gt The work step selection is based on a set of radio buttons in a panel in the upper left corner of the generated GUI It is not necessary to define work steps n a project Tasks The control definition file must define a list of tasks such as calibrating the model and running the model for the project A task can have its own GAMS or R file to start its own result directories and its own set of controls Each control can be shared by several tasks lt Lask gt lt Task gt lt name gt Run test shocks with CGE lt name gt lt gamsFile gt regcge gms lt gqamsFile gt amp incFile regcge settings amp incFile lt regionDim gt amp regionDim gt lt DimSDim gt 1 lt DimSDim gt lt activityDim gt 2 lt activityDim gt lt productDim gt 3 lt productDim gt lt scenDim gt A lt scenDim gt lt yearDim gt 5 lt
14. lt attr gt Adat lt attr gt lt datbir gt lt modelDir gt lt attr gt gams lt attr gt lt modelDir gt lt resDir gt lt attr gt results lt attr gt lt resDir gt lt restartDir gt lt attr gt restart lt attr gt lt restartDir gt GAMS and R related settings Option User Settings System Settings Path to GAMS exe L gams exe GAMS scratch Directory d scrdir Path to R exe T britz dairydyn R 2 15 1 bin x64 Rscript exe threads 8 maxprocdir 255 license L gamslice cplex txt GAMS Options Number of processors used in GAMS Get the number of processors Processor speed relative 100 2 4 GH Intel core 2 Wolfgang Britz Version July 2014 0g GGIG Graphical Interface Generator Documentation These settings can also be defined in the XML file xgamseze gt lt attr gt D gams 3 gams exe lt fattre lt gqamsexe gt lt rexe gt lt attr gt Di r bin 4 rexe lt attr gt lt rexe gt lt gamsoptions gt lt attr gt threads lt attr gt lt gamsoptions gt lt numberofprocessors gt lt attre3 lt attr gt lt numberofprocessors gt lt processorSpeedRelative gt lt attr gt 166 attr gt lt processorSpeedRelative gt lt scratchDir gt lt attr gt 166 lt attr gt lt scratchDir gt SVN related settings Option SVN user id SVN password SVN URL for Gams SYN URL for results SVN URL for restart SVN URL for data The SVN settings can be used
15. stored from polygons for which the vertices and centroids are stored The viewer is written in Java There are two variants One s a stand alone version of the viewer realised as an applet It reads from an internal portable binary data format and java classes data and geometry can be packed into one jar file e g to ship it to a client The second version is transparently integrated in the GUI of the CAPRI modelling system Swing is used for the GUI in order to profit from the most simple implementation the viewer has been written completely new and is not based on existing GIS libraries Even certain standard JAVA classes as e g for hash tables have been replaced by own implementations to reduce implementation overhead Some care was given to support flexibility in classification given that only quantities are supported so that the tool covers natural breaks quantiles equal spread mean standard and nested means Area weighting is supported as well In order to export data to other applications the tools support first of all tab delimited clipboard export allowing import e g into EXCEL Maps can be exported as JPEGs over the clipboard Alternatively the user may export to external file in CSV format DBF to MS Access or to GAMS DBF export will generate a second file comprising meta data The exploitation tools of CAPRI build on a rather simple structure Each CAPRI work step stores its results as a GAMS parameter rep
16. the batch execution at a pre scheduled time Along with functionalities to compare in a more or less automated way differences in results between versions the batch facility is one important step towards quality control GGIG Graphical Interface Generator Documentation Generate GAMS documentation The GUI comprises a tool to generate for each GAMS file and each symbol used HTML pages which are interlinked For details on the code documentation facility see the technical document Javadoc like technical documentation for CAPRI to be found on the Capri web page under technical documents The controls on top allow the user e To define in which directory the EXP REF and GDX files are stored which serve as input into the documentation generator e To choose the directory where the HTML files will be generated e To select the tasks covered by the documentation generator Background System such as CAPRI have grown over years to a rather complex bio economic modelling system Its code based includes hundredth of single GAMS files and ten thousands of lines Not only newcomers face the challenge to get an overview about dependencies in the huge code base and to link the technical implementation to methodological concepts and documentation On top the large scale character of CAPRI often asked for technical features in the GAMS code which are far from the solution chosen for tiny examples as often presented in co
17. yearDim gt amp useHeta truez useleta amp resdir regcgez resdir amp Filemask res 8 9 4 testSha cks 4 1 gdx S amp Filemask The tasks are put in the order as they are defined in the control file on the left hand side of the interface below the work step panel 1f work steps are defined GGIG Graphical Interface Generator Documentation DAIRYDYN gams File Settings Utilities DAIRYDYWN tasks General set CO Calibrate DAIRYDY _ Single farm run C Exploit results The following attributes are possible for a task Name defines the name of task shown on interface required camsFile defines the name of the GAMS project to start optional resDir result directory where the results are stored optional filemask regex string used filter the files shown in the scenario exploitation boxes for the task required incFile defines the name of include file used by the task optional sdxsymbol defines the GAMS symbol set parameter to load for exploitation logical dim position of the logical dim in gdxsymbol where logical region activity product year scen dim5 filters filters for scenario input see below If no gamsFile incFile or resDir are given the general ones defined in the ini file are used Tasks without a GAMS or R clearly cannot be executed but they can be used to exploit GDX files That allows to e g to explore different parts of data bases Use of filters for exploitations Filters are u
18. 013 wv 2 Table column gros Scenarios 2 e In the pivot dialogue e And in gaphics map titles and the like Additional tags lt clone gt The tag uses the item and other definitions from another table and can be used e g to show the same selection in a different pivot or view types e g GGIG Graphical Interface Generator Documentation lt table gt xtheme gt Welfare lt theme lt name gt Welfare comparison overview across regions lt name gt lt EIONE gt Welfare overview lt clone gt lt defpivot gt BRBS lt defpivot gt lt table gt The clone tag must immediately follow the name tag as otherwise preceding definitions are lost Further tags There is a longer list of further tags which refer e g to definitions of graphs They are here only listed with there default settings without a detailed explanation FontsizeRelative 68 zerosAsMissingValues false blueishColors false showMarkers false domainGridlinesVisible true rangeGridLlinesVisible true showAxisTitles true ShowlastColumn true commonRange false autoRangeIncludesZero true nBins 8 quantile 58 spiderChartMaxAxis 6 spiderChartMaxObs 5 SpiderChartFilled true SpiderChartForegroundTransparency 16 pieChartMaxPlots 160 pieChartMaxPies 25 pieChartLabelMinimum 5 PieChart3D true PieChartSimpleLabels false PieChartCircular false P
19. 426 lt order gt lt Type gt multilist lt Type gt lt Title gt Longrun Option lt Title gt lt Options gt FAO2Z 656 Fao projections GLOBIOH EU Projections with GLOBIO EU model GLOBIOM GL Projections with global GLOBIOM model lt Options gt lt Value gt FA028568 Fao projections lt Ualue gt amp range 3 amp range lt gamsName gt longrunscen lt gamsName gt lt tasks gt Build global database lt tasks gt lt control gt GGIG Graphical Interface Generator Documentation Output to GAMS SET Countries DE FR L Selection groups The multilist control features a pop up menu which without selection groups only allows to clear the selection or to select all tems see below CZ000000 Czech Republic HU OD00000 Hungary PLOOOQ00 Poland 51000000 Slovenia ZEE SK000000 Slovak Republic E EE000000 Eston LTOON000 Lithua Clear Selection LYOOOOOO Latvia Select All cyooo0000 Cypr MTOOOOOO Malt EU15 Select EUL Add to selection Non EU Remove from selection The control definition files can define selection groups which allow for groups of items to be selected added or removed from the selection Each selection group starts with a forward slash following by the name of the group The items are and the next selection group are then comma separated as shown below Commas can be skipped if the next item is on a different line GGIG Graphical Interface Generator Documentation
20. 6 Export demand 8 8 Hotel and restaurants Education Other services Output to GAMS test AGR test1 F R Lest1 UPP test1 F P Ltest1 HAH Ltest1 EHE Lest1 CHS testi TTR Ltest1 HOT test1 EDU Ltest1 UsE Lest2 AGR Lest2 F R Lest2 UPP test FOP test HAH Lest2 EHE Lest2 LDHS Ltest2 TTR test HOT Lest2 EDU test UsE Ltest1 AGR test1 F R Lest1 UPP Ltest1 F P test HAH Ltest1 EHE Lest1 CHS Lest1 TTR testi HOT testi EDU Lest1 USE Lest2 AGR Lest2 F R Lest2 UPP test F P test HAH Lest2 EHE Lest2 LDHS Ltest2 ITTR Lest2 HOT Lest2 EDU test OSE fs GGIG Graphical Interface Generator Documentation Style options Most of the controls allow for a style tag Currently only the following two options are supported 1 Left alignment lt control gt lt Type gt singlelist lt Type gt lt Title gt Base year lt Title gt zUalue 2 BA4 Ualue amp ptions 2885 28806 2888c5 0ptions lt gamsName gt BaseYear lt gamsName gt lt style gt uAlignment left lt style gt lt tasks gt Define fts From FSS lt tasks gt lt control gt 2 Putting the control in the same line below the last one lt control gt lt Type gt checkbox lt Type gt lt Title gt Allow f
21. A e 26 Bir cL E ER 21 lese Di a ne ee rare re ome a E d MU M ME Ne MO LM ae err 28 NIU E Te L sINonZer0 ur 29 Wolfgang Britz Version July 2014 3 GGIG Graphical Interface Generator Documentation ee 32 SE 34 SPINNEN ee 35 Tables Er 36 SVIC OPUONS aieea a E E 39 St rtine GAMS OM GGI is cai ee ea ote eov are E a e 39 Generalinte race setine Serias A Dota cuc pei dende 41 GAMS and EECHER 41 GEET 42 Settings linked to the exploitation tools 43 Meta Gata Danding vereinen 44 EE eege 44 I rte On Pe ee Me Are 44 EXP O1 OT ne ee ernennen 46 The software behind the mapping viewer and the CAPRI exploitation tools 46 CAPRI tasks s business model od euet n Ba 48 Execution of tasks via a GamsStarter and Gams Thread 48 Retaetorins the mapp ne DIELsu en EE Lope nie 49 Views aS the Dasi CON CE Dl une ae 50 Bri VT eeas 51 Client based so HH on oe einer 32 Ihe 2eomelry Modden en 52 Views as the basic concept for exploitation rauen guae x niti eoa e eit 53 Whya EE ere ere e 55 The structure of the XML definition files for the views 56 General CO NA INES esna 56 Wolfgang Britz Version July 2014 4 GGIG Graphical Interface Generator Documentation Necessary 1125 TOL E E 56 Deines The ems or The able nasse essen 57 Additionabtags d NEME nun 58 Add tlonal tags GOL IY OF rennen 58 Additional Ee ana ua 59 Addi Onal tags C
22. GGIG Graphical Interface Generator Programming Guide Wolfgang Britz August 2010 Version Juli 2014 GGIG Graphical Interface Generator Documentation The following report is the outcome of a collaborative effort of University Bonn and the author Larger parts of the Java code underlying GGIG had been developed over the years in the content of the CAPRI modelling system which receive considerably funds from the EU research framework programs Following the general policy in CAPRI the GGIG pre compiled code can be used for other scientific projects as well The author would like to acknowledge the contribution of Alexander Gocht vTI Braunschweig to the CAPRI GUI coding efforts All errors remain with the author Wolfgang Britz Version July 2014 GGIG Graphical Interface Generator Documentation Content GGIG Graphical Interface Generator une ie i EELER I Conie EE 3 OVerVie We IM EM ETE LE ME UE 7 C rrent applicat Ons OF GGG EE 11 AIEOV NIE won tes oeste ema e pota een 12 The interlace gen e ai ee 13 KE 13 Mappine controls Setting TO GAMS sen ae ea een 13 Basic concept of the control definition Die 14 Tool name 1656 And background EEN 15 Kg EE 15 Tasks ae ae ee see 16 Se OF CC le Ee EE 17 CONTOS eigener 20 Possible fields Tor COME ONS za si 20 Type Ol EE EE 21 able Ne ne este ne 22 SC DAL AON ne ee ae De ee De ede ee erg 23 ip oo er CT 24 bequem asennaaenies 25 SI T PEA
23. L pages following the example of JAVADOC with some JavaScript to allow for collapsible trees e The methodological documentation will continue to be edited in Word and converted into a PFD document It will comprise references to GAMS sources individual GGIG Graphical Interface Generator Documentation GAMS files or even GAMS objects variables equations models parameters Those references can be addressed in the GAMS code and the HTML pages will allow opening the PDF document at the referenced point e As with JAVADOC technical documentation should be edited as 1n line comments into the GAMS sources based on clear in line documentation standards Each GAMS source as a file header with standard properties about the file e In line documentation will be mostly based on two levels the level of individual GAMS files and on the level of individual GAMS objects In some cases that may require to break down larger programs in smaller pieces with a clear task and eventually clear inputs and outputs Overview The following diagram depicts the general approach The SVN server will host the GAMS sources the documentation builder Builddoc as a Java application and the PDF with the methodological documentation Users synchronize their local work copies with the server In order to avoid developing in Java a new parser for GAMS code the GAMS compiler itself is used to generate the necessary input for the technical documentatio
24. OO aaa iet veles A ad tee 59 Alteratrye texts Tor de E EE 60 ZAckdiiional ass c TOPe ee een 60 Further E 61 Filters for the elements in the different dimensions 22222222sssseeeeennnnnnnnnnnnnnnnennnnnn 62 Attaching long texts and filters to elements ssooenensesssseseerssssssssecrerssssssssceresssssssseeeeee 63 The structure of the GAMS generated gdx files used by the exploitation tools 63 TsO acne the dati Tr E Tl CS eoe e ea ee cua Lob dus LA Gub 64 Menu DAE anne een tea ums re meen een 64 Design hints for structured programming in GAMS with GGIG eeeeeeeeesss 65 Using information passed from GO 65 Suc ure VOUT program Dy TASS arena 66 One entry pornts Tor run specifie setina S sisene 66 D CENAN OF AL O nee ee E 67 EE 67 Generate GAMS documentation ua 68 Backs sun zn Re 68 Pes wed Properties engen wasser esse 69 Techr cal mplementilon areas nen To BN eae DE 69 EIERE EE 70 SE ef or CD TIS een 71 Wolfgang Britz Version July 2014 5 GGIG Graphical Interface Generator Documentation Wolfgang Britz Version July 2014 GGIG Graphical Interface Generator Documentation Overview The GAMS Graphical Interface Generator GGIG 1s a tool to generate a basic Graphical User Interface GUI for a GAMS or R project with five main functionalities 1 Generation of user operable graphical controls from XML based definitions The XML file defines the project specific
25. Region 2 Activity 3 Product 4 Scenario 5 Year 6 Dim5 in the XML file These logical dimensions can be mapped to any dimension of the original data cube read in by the java code Pivoting can then be used to map these logical dimensions to viewport dimensions seen by the user such as the columns and rows of a table Necessary tags for tables A table definition is found between the lt table gt lt table gt tags It must at least define e The table theme such as theme Welfarec theme The themes are shown as a drop down menu in the exploitation tools e The table name such as name Welfare comparison between Member States lt name gt The names must be unique e The items of the tables The order of the themes and table names will define their order in the drop down menu GGIG Graphical Interface Generator Documentation Defining the items of the table The underlying idea of having a hand defined list of items for one of the definitions stems from the observation that most tables have only a very limited number of columns and that these are normally formatted with care regarding their text comprised Each table therefore requires a definition of items but the items must not necessarily be mapped in the column viewport lt item gt lt itemName gt Money metric lt itemName gt lt key gt CSSP lt key gt lt unit gt Mio Euro lt unit gt lt longtext gt Consumer welfare measurement expe
26. S seemed to be the only option allowing the user to import data from a CSV which must however be semi colon delimited and join one of the columns to a shapefile At least the version installed at that time was however running not very stable In the end it was decided to build on the existing code base and let Wolfgang Britz write the additional code on demand The main advantage of that approach 1s the fact that the mapping view is transparently integrated in the CAPRI GUI it is sufficient to switch from Wolfgang Britz Version July 2014 0 gg GGIG Graphical Interface Generator Documentation Table to Map n a drop down list to produce a colored map and that user demands regarding additional functionality may be and had been added taking into account the specific needs of the CAPRI network Compared to ArcGIS where the EU27 HSMU geometry plus codes and centroids requires about 340 Mbytes the CAPRI version requires about 27Mbytes solely Reading in the CAPRI GUI is somewhat slower compared to ArcGIS due to unzip on demand The actual drawing operation takes about the same time as in ArcGIS about 11 second for the full data set Classification in Java is typically faster Views as the basic concept The concept of the CAPRI exploitation tools is centred on the idea of a view Content wise each view may be understood as showing one or several indicators relating to results of CAPRI working steps e g
27. all labels used to identify the numerical data in the gdx file as GAMS does not support numerical indices but requires character labels The list does not distinguish for which data dimensions the labels are used They are hence typically a mix of product activity region and further labels The second type of records belongs to GAMS parameters scalars vectors or multi dimensional tables Each non zero numerical item in each parameter has its own record Each of these records provides the numerical data in double precision depending on the parameter type there may be different data stored in one record as for variables its upper and lower bound GGIG Graphical Interface Generator Documentation current level and marginal value etc and a vector of indices pointing in the list of codes described above Loading the data from gdx files The data matrices generated by the different tasks as described above and stored in gdx files are typically rather sparse so that it seemed appropriate to load the data from the gdx file into hash tables for exploitation purposes That is done in a two step procedure In the first step all records from the gdx file are read and vectors of all found indices are stored The length of each data dimension is only known when all data records are read and is equal to the number of unique indices for each dimension Once all records are read the final length of these index vectors then defines a linear index r
28. ample definition lt control gt lt order gt 2618 lt order gt lt Type gt Seperator lt Type gt lt Title gt Supply model lt Title gt lt tasks gt Baseline calibration market model Baseline calibration supply models Run scenario with market model Generate expost results Run scenario without market model lt tasks gt lt control gt Wolfgang Britz Version July 2014 23 GGIG Graphical Interface Generator Documentation Text Purpose Allows the user to enter text Used e g to name the output generated by a run Applicable fields Title Value Tasks Style Control optic Scenario description my first scenario Possible value Any text allowed User action Edit with keyboard Example definition lt control gt xorder gt 1458X order gt Type BEBSER Tupe lt Title gt Alternative GAMS license File for GHG emission estimation lt Title gt lt Ualue gt gamslice cplex lt Value gt lt Options gt lt Options gt lt range gt dx range gt lt gamsName gt altLicense lt gamsName gt lt tasks gt Baseline calibration market model Run scenario with market model Generate expost results lt tasks gt lt control gt Output to GAMS SETGLOBAL Scenario description my first scenario Note If the text entered refers to an existing file it is recommended to use a filesel control instead Wolfgang Britz Version July 0147424 GGIG Graphical Interface Generator Documentation Checkbox
29. and trigger feedback about how to generate an easy to maintain and useful technical documentation for CAPRI based on the example of JAVADOC http de wikipedia org wiki Javadoc It is organized as follows The next short paragraphs will list desired properties of a technical documentation for CAPRI followed by a more detailed discussion of a proposal for an implementation which s working as a prototype The last chapter will then show selected screenshots Desired properties The main properties a automated technical documentation of a tool under GGIG such as CAPRI should fulfil are as follows e Avoiding redundancies 1 e information should whenever possible only inputted once Specifically selected comments added in line in the code should be ported over to the technical documentation e Changes in the code structure should possibly be reflected automatically e The documentation must be able to reflect different GAMS projects CAPMOD CAPREG and to differentiate between instances of the same project CAPMOD in basline or calibration mode e ts biggest part of the technical documentation should be constructed directly from the code based in an automated way e It should also collect information from the SVN versioning system Technical implementation The main ingredients of the proposed implementation are as follows e The final format of the technical documentation is based on automatically generated static HTM
30. ane with the content can be scrolled by a right mouse click in the pane to open a popup menu If an editor is added under opther options the GAMS and the listing file can be opened as well Open gams file Open gams Ist file Scroll Lock The pane can hence be frozen so that e g the status of a model solve can be inspected while the project continues to run In order to successfully start a project the ini file for GGIG must comprise the information where the GAMS executable can be found but also where the GAMS code of the project to start is stored Wolfgang Britz Version July2014 0g GGIG Graphical Interface Generator Documentation General interface settings The interface has a few standard settings which can also be accessed via the edit settings dialogue These are e Certain file locations the directory where GDX files for results are assumed to be stored resDir and three directories which can be used to adjust the specific model application the root of the GAMS file workDir in GAMS called modelDir a directory for restart files and one for data files rm Option Option TRIMAG model files directory britz trimag Result Directory britz trimag Restart Directory britz trimag Data Files Directory britz trimag Note The name of the system here TRIMAG is defined in the GGIG INI file Default settings can be defined in the XML file lt datDir gt
31. ard for the user to pick a specific value In that case a spinner 1s eas er to control Applicable fields Title GamsName Value Options range Tasks Style Control optic Use lower price iterations weights after iteration 20 0 Possible value Defined by range field User action Select value by moving slider Example definition lt control gt lt order gt 1611 lt order gt lt Type gt Bpanner lt Type gt lt Title gt min end year of planning horizon lt Title gt lt Value gt 62 6 Value gt lt range gt 2615 21686 1 15 lt range gt amp gansHame 2last earhHin amp gamsHame lt tasks gt Experiments lt tasks gt lt f control gt Output to GAMS SSETGLOBAL Relative weight flows 20 GGIG Graphical Interface Generator Documentation Table TableSimple Purpose Define a table with floating point values passed to GAMS Applicable fields Title GamsName Value Columns Rows Dim3s Range Tasks Style Control optic Inputs b Price Growth rate T Wage rate full time 8 00 Euro hour Wage rate half time 7 00 Inputs Euro hour 1 00 1 00 Wage rate flexible hourly 6 00 1 00 Euro hour Cattle concentrate type 200 00 1 00 1 Euro t 1 00 1 00 Cattle concentrate type 220 00 Cattle concentrate tvne 240 00 User action e Edit single fields with numerical values Cut Paste via clipboard possible Wolfgang Britz Version July 2014 GGIG Graphical Interface Ge
32. d some core developers Accordingly institutions or tool developers often observe that promising tools are only used by a few specialists reducing returns to their investment in tool development and maintenance Possible other users often shy away from the high learning costs and or fear to generate analyse and present results based on a black box where it s unclear how to enter exactly a scenario and how to access their results It s therefore not astonishing that some tools based on GAMS and also on other modelling languages have developed their specific GUIs These GUIs let the user steer the tool with a touch amp feel comparable to other programs running on modern windowed operating systems However writing a GUI for a larger project firstly requires considerable programming skills often not found with the economic modellers themselves Secondly developing a good design coding debugging and maintaining a GUI can be a rather costly exercise As a consequence typically only rather large and well funded tools have found and invested the necessary resources to develop such GUIs CAPRI and runGTAP provide some examples These project specific GUIs are typically very powerful but tend also to be tool specific They can typically not be modified easily to fit to another GAMS project That renders it inviting to think about generic tools able to generate a GUI which can interface to GAMS The coding effort can then be shared acros
33. e be hosted in about 200 Mbytes The data are read from a generic file format generated by GAMS General Algebraic Modelling System a commonly used software package in economic modelling called GDX the software package on which CAPRI is based Access to GDX is handled via an API provided by GAMS Client based solution Technically the exploitation tool is completely client based That reflects the specific user profile of the CAPRI modelling system where the exploitation tool 1s integrated with an economic model and tools building up its data base The main aim of the tool is to support forward looking policy analysis For this purpose users will create their own scenarios and in some cases even own variants of the export data which will lead to processes requiring considerable processing and storage resources A client server solution where the production process and data storage would need to be hosted on a web server is therefore not a preferred solution also as users will often develop variants of the modelling system by code modification in GAMS and contribute to its development The structure of the data driver would however very easily support linkage to a network or WEB based data bases It should however be noted that the data base and GAMS code are managed via a Software versioning system which is a kind of client server environment The geometry model The mapping viewer of CAPRI is based on very simple and straightforward co
34. e with market balance elements items such as FEDM are found in the columns of the CAPRI tables where also the activities are stored Consequently the table will loop over the products and not over the activities Alternatively isActivity Y ES lt isActivity gt allows only items from the product dimension and lets the table loop over the activities A typical example provides a table showing activity levels yield or economic indicators for the production activities Additional tags lt subTheme gt Allows to introduce sub themes n the table selection Additional tags lt defpivot gt Defines the default pivot used for the table The pivot string consists of characters The first character position is for the table row blocks the second for the table rows the third for the column blocks and the last for the columns The logical dimensions are labelled with the following characters A Activity D Dim5 GGIG Graphical Interface Generator Documentation I Items M Activity and Product merged P products Q Year and dim5 merged S Scenario R regions X Region and dim5 merged 5 9 Dim5 Dim9 The definition lt defpivot gt OROS lt defpivot gt thus means regions are in the rows scenarios in the columns The definition lt defpivot gt PISR lt defpivot gt puts the products in the row blocks the items in the rows the scenarios in the column blocks and the regions in the columns Additional tags
35. ee rather independent components Firstly a GUI to control the different work steps of CAPRI The code deals mostly with defining GUI controls button scroll down lists etc to manipulate properties of CAPRI tasks and then to start them as GAMS processes That part has been thoroughly refactored with the revision of 2008 A second important part is the CAPRI exploitation tool which are basically generic enough to be used for other modeling systems as well The current refactoring left most of the code untouched compared to the code developed since 2006 with the exemption of the graphics which is now based on the JFreeChart library However as discussed below in 2007 the mapping viewer was refactored in larger part to host the 1x1 km grid solution developed in the CAPRI Dynaspat project The exploitation tool s a rather unique solution to exploit result sets from economic models based on the definitions of views which are defined in XML tables It combines features from DBMS reporting data mining spreadsheet functionalities and GIS into one package And thirdly there are some specialized pieces as the HTML based GAMS documentation generator which are linked into the GUI Wolfgang Britz Version July 2014 0g GGIG Graphical Interface Generator Documentation CAPRI tasks as business model A core concept in the new layout is a business object called AgpTask Technically defined as an interface such an object represents a work task n the
36. es are discussed below in detail defines the description of the control as seen by user required defines the name of global settings resp SET name optional pre selected setting s optional list of available options required where applicable Min max increment major ticks or number of rows shown required where applicable List of tasks to which the control belongs If empty t belongs to all tasks A tooltip text hovering over the control Link to a pdf file and chapter to open on mouse over Selection list opened by pop up menu see Multilist control Different style options optional Control is blocked for input useful to show settings on interface which are should be sent to GAMS for a specific task GGIG Graphical Interface Generator Documentation Type of controls The following types of controls are available The related JAVA swing JComponent is shown in bracket Tab Separator Panel Text Checkbox Singlelist RadioButtons Filesel FileselDir Multilist MultilistNonZero Slider Spinner Table SimpleTable Introduces a new tab on the tabbed plane hosting the controls to structure a pane with control JLabel in an JPanel with a border the next controls are shown together on a panel to enter a free text JTextField for on off type of settings JCheckBox for 1 of n selections JList in a JScrollPane for 1 of n selections Group in JButton vertically aligned for 1 of n selectio
37. ey Responding Rice Responding Sugar beet Responding Family Net Income Responding Land Constant Cap Labour Constant lt value gt 33 GGIG Graphical Interface Generator Documentation Slider Purpose Used to select one integer value from a given range of allowed ones The increments must also be defined Applicable fields Title GamsName Value Options range Tasks Style Control optic y 1 2 Ai 3 5 4 B 7 3 Time resolution for investment off farm labour decisions Note Selectable values will be restricted according to the increment definition Possible values Defined by range field User action Select value by pressing up down arrows or by editing the field with keyboard Example definition lt control gt Type Siler lt Type lt Title gt Time resolution for investment off farm labour decisions lt Title gt lt VUalue gt 3 8 lt Value lt range gt 1 16 1 range gt lt gamsName gt timeResolutionInu lt gamsName gt lt tasksrall tasks gt lt control gt Output to GAMS SETGLOBAL Set_substitution_elasticty 5 Wolfgang Britz Version July 2014 0 A4 GGIG Graphical Interface Generator Documentation Spinner Purpose Used to select a integer value from a range of allowed ones The increment is always unity Could be internally used as a floating value e g by using it for shares in percentages terms If the range of the spinner is large it might be h
38. gt mtr_RD lt Ualue gt lt Options gt 4modeldir4 pol_input gms lt Options gt lt range gt d lt range gt lt gamsName gt result type lt qamsName gt amp tasks Baseline calibration market model Baseline calibration supply models Baseline calibration farm types HSHU baseline Run scenario with market model Run scenario only with market model Generate expost results Run scenario without market model Run scenario only with market model Dounscale scenario results amp ftasks lt tooltip gt Name of the scenario file to run The results will be stored under the name as well lt tooltip gt lt control gt Output to GAMS SSETGLOBAL scenDes cge rd nothg GGIG Graphical Interface Generator Documentation Multilist MultiListNonZero Purpose Used for m of n selections i e in cases where features are not mutually exclusive Multilist allows m 0 i e also empty selection MultiListNonZero requires m gt 0 1 e at least one element must be selected Applicable fields Title GamsName Value Options range Tasks Style Control optic Countries Les Countries ESAIT NL ATPT Notes e left hand side range 0 right hand side range 3 e Drop down list will appear if the user clicks on arrow and number of elements gt range and range lt gt 0 Possible value Defined by options field User action tick untick box fields in the control with mouse Example definition lt control gt forder gt 1
39. h multiple sort columns supported Numerical filter can be applied to columns User View definitions GUI Selection pivot supplied filters Data model The underlying data model is very simple and straightforward All data are kept in one large multi dimensional data cube and all values must either be float values or strings Currently only read only is supported Each data dimension is linked to a vector of string keys Those keys are the base for the filter definitions Currently data cubes with up to six dimensions are used regions activities items trading partners years policy scenarios The data storage model is equally optimised to the specific needs As only float values or strings are supported all data can be stored as one primitive array of either floats or strings To allow fast and efficient indexing a linear index is constructed from the multi dimensional data cube and the non zero data and their indices are stored in a hash table That renders data retrieval very fast All data are loaded in memory at initialisation time For moderately long linear indices about 10 Bytes are required to store a non zero float and its index as an integer If the maximal linear index is very large the index is stored as a long and the storage need goes up GGIG Graphical Interface Generator Documentation to about 16 Bytes For moderately sized data cubes 20 Million numbers can henc
40. he GAMS project and the exploitation part The latter offers interlinked tables with selections sorting outlier control pivoting different type of graphs maps and flow maps Wolfgang Britz Version July 2014 9 GGIG Graphical Interface Generator Documentation Additionally GGIG features a set of utilities or ginally developed for CAPRI such as HTML based documentation of the GAMS code a GDX viewer or a batch processing mode The development of GGIG would have been impossible without the continued funding for the maintenance and development of CAPRI by the EU Commission which also let to the emergence of the CAPRI GUI and exploitation tools That code base was the starting point for GGIG I would also like to mention the contribution of Alexander Gocht over the last years to the code of the interface The main parts of GGIG are graphically depicted below At its core stands the GGIG Control generator based on Java code Based on a XML based definition file provided by the project it generates a project specific GUI which can be operated by the user The state of these controls such as numerical settings on off settings or n of m selection can be passed to GAMS by an automatically generated include file which also contains automatically generated meta data The user can also execute GAMS from the GUI The GUI can equally load numerical results and meta data n a specific GDX viewer The latter supports view definition Le pre
41. ieChartForegroundTransparency 20 The maximum number of bar plot with their own value range axis barChartMaxPlots 4 The maximum number of bar groups elements on the domain axis taken from the table rows barChartMaxDomains 18 The maximum number of bars in a bar group taken from the table column groups barChartmaxSeries 5 barChart3D true barChartStacked false barChartVertical true BarChartCylinder false BarthartForegroundTransparency 18 barChartDrawOutline false barChartDrawShadow false barChartFilledBars true linechartMaxObs 25 linechartMaxPlots 5 LineChartMaxSeries 18 LineChart3D false LineChartVertical true strokeWidth 2f LineChartDrawLines true LinechartDrawShapes true LineChartForegroundTransparency 8 linecChartCumulative false lineChartsort false The following list further tags partially explained above Wolfgang Britz Version July 2014 61 GGIG Graphical Interface Generator Documentation theme null subtheme null name null clone null item null isactivity null itemdim null regionsel activitysel productsel yearsel scensel dim5sel dim6sel dim7sel dim8sel dim9sel regiontext activitytext producttext yeartext scentext dambtext dim6text
42. in and some tests with open source products were undertaken A stand alone GIS as the sole option was certainly the less appealing solution Firstly it would have required producing rather large intermediate files and would have left the user with the time consuming and often error prone task of exporting and importing the data Secondly the user would need to switch between two different programs and GUI standards And thirdly all the usual problems with installing and maintaining additional software on a work station would occur However as indicated later the GUI naturally allows passing data over to external applications and does hence not prevent the user from using a full fledged GIS solution The main points taken into account during the search of a map viewing solution for CAPRI were 1 possibility to import data from the CAPRI GUI efficiently 2 user friendliness 3 performance and 4 in the case of plug in libraries expected realization and maintenance resource need and naturally 5 license costs It turned quickly that an ideal product was not available Some of the products were not able to allow for the necessary link between newly imported tables with region codes and an existing geo referenced geometry Others had very complex user interfaces or produced run time errors took ages to draw the HSMU maps or were quite expensive From the different options tested the gvSIG http www gvsig com index php idioma en freeware GI
43. ing settings of environment variables to the GAMS call Experienced model users typically the code developers themselves know how to change run specific settings in the GAMS code and do so typically quite efficiently The code can also be used from inside Java but that feature is not discussed in the documentation Wolfgang Britz Version July 2014 7 GGIG Graphical Interface Generator Documentation As a consequence they seldom feel the need to develop a GUI steering their GAMS project The need to invest in GUI development might have even decreased as the GAMS IDE now offers some basic functionality often found in project specific GUIs The IDE allows inter alia starting GAMS inspecting parameters found in the listing file or viewing the context of a GDX file However a GAMS code only solution for an economic model typically poses a serious entry barrier to newcomers for two reasons Firstly possible users are often not familiar with GAMS But even with some elementary knowledge of the language they might face problems understanding project specific GAMS code making use of advanced GAMS features Secondly they face the challenge to familiarize themselves with the specific code of the project They would need to learn enough to know exactly which specific code changes are necessary to implement e g scenarios in a given project In some cases the large and or complex GAMS code of projects basically excludes their usage beyon
44. ion lt control gt lt order gt 1116 lt order gt Type BER Type lt Title gt First year lt Title gt Ualue gt 1984 Ualue gt amp ptions 1985 1985 1986 1987 1988 1989 1998 1901 1992 1993 1994 1995 1996 ptions amp gansHane FirstVear gamsHame lt tasks gt Prepare national database Finish national database FSS selection routine Build regional time series Build regional database Build global database Generate trend projection Generate farm type trends x Lasks gt lt control gt Output to GAMS SETGLOBAL Choose model tupe PE Note The user cannot deselect i e one of the options is always active GGIG Graphical Interface Generator Documentation filesel Purpose Used for 1 of n selections of a list of files That is e g interesting when the user can chose from a list of pre existing scenario definitions in GAMS files Applicable fields Title GamsName Value Options Tasks Style Control optic Scenario description cge rd plusi Note Drop down list will appear if the user clicks on arrow Possible value Defined by the file selection string in options field e g lgams pol_input cge_ gms The file extension fill be automatically removed from the items User action tick untick one of the selection possibilities with mouse Example definition lt control gt lt order gt 1616 lt order gt Type EEE Type lt Title gt Scenario description lt Title gt
45. itation meta data 0 i my first scenario RIMAG Graphical User Inter Ini file gig ini User name undefined User type runner Exploitation The basic strategy of the GGIG exploitation tools roots in the CAPRI exploitation tools which require that all model results are stored on an up to 10 dimensional cube which is then stored in a GDX as a sparse matrix Additional dimension can be added if several files are loaded e g to compare scenarios or years A specific XML dialect defines views filters pivots view types into the cube and allows the user to load several result sets typically from different scenarios in parallel If no table definition file is present GIGG offers a GDX viewer which some interesting possibilities not found in the standard GDX viewer such as numerical sorting statistics selections For details the CAPRI GUI user manual should be consulted The software behind the mapping viewer and the CAPHI exploitation tools Reading the following chapter is not necessary to work with the GUI but rather intended for a reader who is technically interested The original software implementation of CAPRI was based on software available at ILR at that time and comprised a DBMS realized in Wolfgang Britz Version July 2014 0g GGIG Graphical Interface Generator Documentation FORTRAN with C C code for the GUI The very first maps in CAPRI in 1998 were produced with an MS EXCEL map
46. layout of the GUI The user can then interact with the GUI to change the state of the controls The state of each control component such as a checkbox can then be mapped to GAMS code SETGLOBALS Set definitions settings for parameters It combines hence the basic functionality of a GUI generator and a rudimentary GAMS code generator 2 Generation of GAMS compatible meta data from the state of the control which can be stored in GAMS GDX format and later accessed so that scenario definitions are automatically stored along with results 3 Execution of a GAMS or R project while passing the state of the control to GAMS respectively R as a include file 4 Exploitation of results from GAMS runs by providing an interface to define the necessary interfacing definitions in text file to load results from a GAMS into the CAPRI exploitation tools 5 Access to a set of GAMS related utilities This include e g a viewer for GDX files a utility to build a HTML based documentation of the GAMS code or a batch execution utility GGIG is steered with xml based text file and does not require knowledge in a higher programming language GGIG was developed to overcome a typical problem when economic models are implemented in GAMS GAMS itself not at least to ensure platform portability does not allow for graphical user input Run specific settings for GAMS need therefore to be introduced either by changes to the GAMS project code itself or by add
47. le which 1s core of GGIG are discussed below Wolfgang Britz Version July 2014 12 GGIG Graphical Interface Generator Documentation The interface generator Tasks Tasks are central elements in GGIG Each control can belong to one or several task and each task might have ts own GAMS or R process That allows steering even rather complex tools with one GUI which combine different GAMS or R projects It supports a structured development of the GAMS R code as either separate GAMS R files with a clear purpose are generated or a GAMS R file consists of blocks which belong to certain tasks When the user selects a task only the controls belonging to that task are shown to the user easing the handling of the GUI Mapping controls setting to GAMS Controls are user operable graphical elements A few examples are shown below Last year y 2015 20302045 2060 20752090 FILS ie esta erg AN Use hasHerds indicator variables Diagram Example of controls generated with GGIG In the case of GGIG these graphical controls are used by the user to define textual and numerical settings which in turn define run specific settings for a GAMS R project GGIG offers five functionalities related to these controls and their interactions with a GAMS project l It generates the controls from a definition file on a windowed program interface 2 It offers the necessary code to intercept user operations on the controls 3 t maps
48. le sort the rows etc Internally each view is stored in a XML schema Technically a view can be understood as a combination of a pre defined selection query along with reporting information The XML schema allows to attach long texts units and tooltips to the items of a table and thus to show meta data information to the user The XML schema does hence replace look up tables in a DBMS It may equally store information regarding the pivoting the view type table map different graphic types and for maps classification colour ramp and number of classes The views can be grouped into logical entities and are shown as a popup menu to the user Tabular views may feature column and row groups Empty columns and rows can be hidden tables can be sorted by column with multiple sort columns supported Numerical filter can be applied to columns Wolfgang Britz Version July 2014 0g GGIG Graphical Interface Generator Documentation User View definitions GUI Selection pivot supplied filters Why a XML definition files for views The exploitation tools of CAPRI build on a rather simple structure Each GIGG task can store its results as GAMS parameter representing a multi dimensional sparse cube and save it on disk as a GDX file The exploitation loads the non zeros from one or several GDX files into memory However given the length of the different dimensions and the use of short codes the user wo
49. lt Value gt MTR_RD lt VUalue gt lt Options gt gams pol_input gms lt Options gt lt xrange gt BX range gt lt gqamsHNHame gt result_type lt gamsName gt amp tasks Baseline calibration market model Baseline calibration supply models HSHU baseline Run scenario with market model Generate expost results Run scenario without market model Run scenario only with market model Downscale scenario results lt tasks gt xtooltip gt Name of the scenario file to run The results will be stored under the name as well lt tooltip gt lt control gt Output to GAMS SETGLOBAL scenDes cge rd nothg GGIG Graphical Interface Generator Documentation fileselDir Purpose Used for 1 of n selections of a list of files potentially from sub directories That is e g interesting when the user can chose from a list of pre existing scenario definitions in GAMS files Applicable fields Title GamsName Value Options Tasks Style Control optic Scenario description liaise e liaise Vase crop yields Note Drop down lists will appear if the user clicks on arrow Possible value Defined by the file selection string in options field e g lgams pol_input cge_ gms The file extension fill be automatically removed from the items User action tick untick one of the selection possibilities with mouse Example definition lt control gt Type ERBE Type lt Title gt Scenario description lt Title gt lt Value
50. lt defview gt Defines the default view used for the tables the list of default views is equal to what the user can select in the drop down box Markow chart Additional tags lt COO gt This tag defines the geometry to use for maps Currently the following geometry files are available NUTSILzip NUTS 2 geometry for countries covered by the supply module MS zip NUTS 0 geometry for the countries covered by the supply module GGIG Graphical Interface Generator Documentation RMS zip Global geometry for the regions with behavioural functions in the market model RM zip Global geometry for the trade blocks in the market model HSMU zip 1x1 km pixel clusters for EU 27 without Malta and Cyprus There are also 1x1 km pixel clusters for individual Member States but these are internally passed to the viewer when only one country is shown Alternative texts for the dimensions Normally the names for the dimensions are passed in the view by Java However their name can be changed by lt regionText gt lt regionText gt lt activityText gt lt activityText gt lt regionText gt lt regionText gt lt productText gt lt productText gt lt scenText gt lt scenText gt lt dimSText gt lt dimSText gt lt dim9Text gt lt dim9Text gt lt yearlext gt lt yearlext gt That text s shown e As description above the outer drop down selection boxes Region Years European Union 27 w 2
51. lt selGroups gt EU15 BL888888 DK888888 DE 888888 EL888888 ES888888 FR888888 IR666666 IT888888 NL 666666 AT 666666 PT 666666 SE666666 FI 666666 UK 888888 EU12 C2666666 HU 666666 PL888888 1666666 SK666666 EE 666666 LT 666666 LU666666 CY 666666 HT 666666 BG 666666 RO666666 Non EU NO 888888 TUR AL 666666 HK 666666 CS 666666 MO 666666 HR888888 BA888888 K0888888 lt selGroups gt Belgium and Luxembourg Denmark Germany Greece Spain France Irland Italy The Netherlands Austria Portugal Sweden Finland United Kingdom Czech Republic Hungary Poland Slovenia Slovak Republic Estonia Lithuania Latvia Cyprus Malta Bulgaria Romania Norway Turkey Albania Macedonia Serbia Montenegro Croatia Bosnia and Herzegovina Kosovo Wolfgang Britz Version July 2014 31 GGIG Graphical Interface Generator Documentation Radiobuttons Purpose Used to select for several items a one of n settings outputted as two dimensional set Applicable fields Title GamsName Value Options Rows Tasks Style Control optic 9 20 o o d p e e e e e e e e R C Re Re _ Re JR CAR P m Possible values Defined by range field User action Select value by pressing up down arrows or by editing the field with keyboard Example definition Wolfgang Britz
52. ms 1s handled by a GamsStarter object An instance of GamsStarter lets the task write out the necessary include file s in GAMS format to generate a specific instance of the specific task a simulation run for a specific scenario simulation year with the market model switched on or off A GamsStarter also knows about the working directory or other specific GAMS settings as the scratch directory It may generate a pipe for the GAMS output to the console to show it in a GUI An AgpTask can be executed by a GamsStarter who will then create a GamsThread A GamsThread extends the SwingWorker interface of Java so that it may communicate with the normal event queue of JVM A GamsThread can be gracefully terminated by sending a Wolfgang Britz Version July 2014 gg GGIG Graphical Interface Generator Documentation SIGNT signal to the GAMS process That will let the GAMS execution stop at a specific point determined by the GAMS engine itself and start the finalisation handling of GAMS as well as the removal of intermediate files and directories Refactoring the mapping part When the 1x1 km grid layer was added to CAPRI during the CAPRI Dynaspat project it became obvious that the existing JAVA code to produce maps needed some revision especially regarding the way the geometry was stored In this context the question of using an existing GIS independently from CAPRI or the use of existing GIS classes plugged into the CAPRI GUI was raised aga
53. n Two different types of files for each project or instance included in the documentation are used for that purpose so far l So called REF files which list information in which files and in which line symbols are declared defined assigned and referenced They also comprise information about long texts and domain of the symbols The REF file can be generated by the argument rf filename when GAMS 1s called e g GAMS capmod a c rf capmod ref As the GAMS compiler itself is used conditional includes and the like are automatically treated as during execution time That opens also the possibility to include the generation of the documentation in the GUI 2 GDX files generated with an empty symbol list at compile time GDOUT module gdx SUNLOAD GDOUT The resulting GDX file will comprise all sets parameters etc used by the programs and most importantly the set elements as declared The name of the GDX file could be passed as a parameter by the GUI Those files hence reflect the actual local code base with any local modification and can be generated for a specific instances of the projects e g for CAPMOD with and without the market module etc A JAVA application named Builddoc parses both types of files on Wolfgang Britz Version July 2014 70 GGIG Graphical Interface Generator Documentation demand for several projects and generates static HTML pages The GAMS code comprises in line comments car
54. ncepts First of all it basically supports solely polygon geometries not comprising holes line strings interpreted as rivers and points for labelling The storage model is optimised to host rectangles and is especially efficient if the polygons vertexes are all points in a raster The topology is not read from a shapefile but stored in a generic rather simple format However a shapefile interface to generate the generic format 1s available The vertices are stored in x y coordinates already projected in a rectangular coordinate system and the viewer does not deal with the geographic coordinate system but simply scales the rectangular coordinates in the viewport The viewer in its current version solely supports one layer of quantities Those restrictions naturally allow reducing memory needs and thanks to the rather simple data structures also rather allow performing drawing operations It should be noted that the JIT compiler of JAVA is indeed rather fast Wolfgang Britz Version July 2014 52 GGIG Graphical Interface Generator Documentation The biggest topology currently handled simultaneously covers an intersection of Corinne Land Cover slope classes and Soil Morphological Units and comprises around 2 7 Million polygons for EU27 As the majority of the polygons are rectangles not more then 6 7 Million points needed to be stored The topology handler and the drawing routines separate rectangles for which only the two outer points are
55. nditures necessary to reach utility in current simulation under prices of reference scenario lt longtext gt lt link gt Money metric lt link gt lt item gt An item definition is enclosed in the lt item gt lt item gt tags It must at least comprise a lt key gt and an lt itemName gt tag The case sensitive key must match the symbol identifier as found in the GDX file whereas the itemName can be freely chosen Facultative tags are lt unit gt a physical unit shown in table lt longtext gt a text shown when the mouse hovers of the column lt link gt a link to another table for the table cells under the column lt colormode gt the color mode used when a map is drawn for the item The following modes are supported e GYR Green Yellow Red e RYG Red Yellow Green e GR Green Red e RG Red Green e BG Blue Green GGIG Graphical Interface Generator Documentation e GB Green Blue e WB White Black e BW Black White e LD Light Blue Dark Blue e DL Dark Blue Light Blue lt eval gt the item is calculated from other items e g eval VAL VAL BlueBox VAL DeMinimis Z eval In order to define from which dimension they are taken the user can set either lt itemDim gt region lt itemDim gt Deprecated is the old style lt isActivity gt NO lt isActivity gt Which means that the table loops over the products and the items refer to the activity dimension A typically example is a tabl
56. nerator Documentation Example definition scontrol gt lt xorder gt 3118 lt X order gt lt Type gt table lt Type gt lt Title gt Trade elasticities lt Title gt xUalue gt 8 5 8 5 8 5 8 5 8 5 08 5 8 5 8 5 8 5 0 5 08 5 8 5 H8 5 0 5 8 5 08 5 8 5 0 5 8 5 0 5 8 5 0 5 8 5 H 5 lt Ualue gt lt Columns gt Import supply Export demand lt Columns gt lt Rows gt AGR Agriculture FOR Forestry OPP Other primary sectors FOP Food Processing MAN Manufacturing EHE Energy CHS Construction TTR Trade and Transport HOT Hotel and restaurants EDU Education OSE Other services lt Rows gt lt range gt 6 1 5 6 8 1 5 6 68 1 8 1 lt range gt lt gamsNamerp tradeElas amp gamsHame lt tasks gt Calibrate CGE lt tasks gt lt control gt Notes e The range field might comprise several tuples of low up increment which will then be assigned to the columns of the tables If there is only one tuple it will be used for all columns e If arange is given a spinner will be used as the cell editor and values outside the range will be rejected GGIG Graphical Interface Generator Documentation PARAMETER p_tradeElas hgriculture Import supply 8 5 Furestry Import supply 0 5 Other primary sectors Import supply 8 5 Food Praocessing Import supply 8 5 Hanufacturing Import supply 8 5 Enerqyu Import supply 8 5 DLonstruction Import supply
57. nitions above only records where the region key starts with BL will be shown to the users The other two filters will skip files where the base and simulation years do not match the selection In our example the base year is stored as a two digit key on position 7 and 8 and only files with a 04 are n the drop down box for the scenarios Similarly only results for the simulation year 20 are selected GGIG Graphical Interface Generator Documentation Dee EE s BL Belgium and L as I L t l Normally the name of the file will be used to characterize the scenario The merge is made for the case where several GDX files should be combined and the file name does not distinguish model runs An example offers the downscaling component of CAPRI it produces in separate GAMS run for the same scenario one file for each country which comprise rather huge data sets The merge mode allows combining these result sets together GGIG Graphical Interface Generator Documentation Controls Possible fields for controls The necessary information for each control is stored in different tags for each control definition file The controls are put on the interface in the order they are given in the XML The following fields are available Type Title GamsName Value Options Range Tasks Tooltip Pdflink Selgroups Style Disable defines the type of control required The different typ
58. ns of a list of files JList in a JScrollPane for 1 of n selections of a list of files found potentially in sub directories preceded by a sub directory lists two JList in a JScrollPane for n of m selections n 0 m non editable JComboBox for n of m selections n 1 m non editable JComboBox for integer value selection from a range of values JSlider for floating or integer value selection from a range of values JSpinner to enter floating point variables in a two or three dimension parameter comprises pivot possibilities JTable to enter floating point variables in a two or three dimension parameter no pivot possibilities JTable GGIG Graphical Interface Generator Documentation Tab Purpose Used to structure the interface by grouping controls on an input pane introduces a new tabbed plane to which controls following are then added Applicable fields Title Tasks Control optic Genera settings Farm Settings Market settings Algorithm Remark The user can only see one of the tab pane at any time care should hence be given to keep the number of tabs and the assignment of controls to tabs such that a user can easily check all key inputs GGIG Graphical Interface Generator Documentation Separator Purpose Used to structure the interface gives a title for the next block of controls Applicable fields Title Value Tasks Control optic Settings for objective function Ex
59. ntered by the user v a the controls on the GGIG interface These project independent controls are to a larger extent borrowed from the CAPRI user interface On top a first rudimentary control editor s embedded n the tool Call of GGIG In a normal installation there are two files 1 One default file with the control definitions and related default values That file should be typ cally under version control 2 A second file which s installation specific it will solely store the values entered by the user on the interface and will be in ini format Its content s updated each time the interface is closed the next run will re load the control and other setting from that file A typical call will therefore look like Java Gig jar project ini project_default xml Where the project ini stores the current user settings and the second one the control and further project specific settings It is hence possible to host several GGIG based installations in one directory where the jars etc are stored Tool name logo and background color The following three XML tags allow to set the tool name the logo shown on the interface and the background color lt toolName gt lt attr gt FADNTOOL lt attr gt lt toolName gt logo gt lt attr gt fadntool logo jpgt attr gt lt logo gt lt backgroundColor gt lt attro255 148 18 6 attr gt lt backgroundlolor gt Equally the icon shown in the task bar can be set lt icon gt lt attr
60. oom for the multi dimensional table In a second step the records are read again and the index vectors for each record now allow to define a linear index in the total table A hash code is derived from that linear index to store the numerical values into a hash table As the number of items to store in the hash table is known beforehand a rather simple hash table implementation can be used If necessary step one can be run over several parameters which may be hosted in several gdx files so that results from different runs can be merged into one hash table As the gdx files provide lists of all labels used in any parameters stored in that gdx file the index vectors allows to build lists of labels linked for each index in a data dimension There exists an additional storage type in the gdx files to retrieve long texts to the labels as defined in GAMS set definitions However one label may occur in different sets with different long texts and the gdx file does not store a possibly user defined relation between a data dimension of a parameter and a specific set an option termed domain checking in GAMS In order to link hence long texts to the labels used for a specific data dimension two options are possible Firstly at run time the user may interactively re establish the link between data dimensions and specific sets and thus add long texts to the labels used on that data dimension based on his knowledge Or the relation may be hard coded in the
61. or off farm work lt Title gt lt Value gt true lt Ualue gt BEUEB saneLine truec style amp gamsHame allouwFor fFFFarms gamsHame lt tasks gt Single farm run Calculate HACS Experiments dairy Experiments arable lt tasks gt lt control gt Which leads to the following Different states of nature for price Allow for off farm work J Starting GAMS from GGIG GGIG allows starting the GAMS project directly from the interface either in compile or run mode A break request can also be sent to GAMS stop GAMS Compile GAMS StartGAMS Stop GAMS Once started the GAMS project routes its output to the console back to lower right part of the interface GGIG Graphical Interface Generator Documentation farm_constructor gms 91 3 Mb gt exp_starter gms 74 3 Mb ini herds gms 19 3 Mb title gms 30 3 Mb ini_herds gms 86 3 Mb exp starter gms 78 3 Mb decl gms 29 3 Mb exp starter gms 195 3 Mb title gms 30 3 Mb exp starter gms 202 3 Mb title gms 30 3 Mb exp_starter gms 240 3 Mb store_res gms 232 3 Mb exp_starter gms 323 3 Mb title gms 30 3 Mb exp starter gms 325 3 Mb N store_res gms 232 3 Mb exp_starter gms 344 3 Mb Status Normal completion Job exp_starter gms Stop 12 01 10 21 06 06 elapsed 0 00 00 047 GAMS RC D IET lt gt The p
62. overall CAPRI system such a run of CAPREG to build the regional data base The interface requires getters and setters for properties such as baseYear simYear or MemberStates The setters can be accessed either by a GUI interface or by the batch execution facility formally by a class implementing the interface AgpTaskHandler Most tasks are GAMS executable tasks according to their isGams property These tasks also provide access to the name of the related GAMS program via getGamsProgramName Each of these tasks has also a method called generatelncludeFile which generates the specific so called include file in GAMS format for that task The objects also know about the main GDX file they are generating via getGdxResultFiles Related to that they allow setting the logical names of the data dimension in the result data set via setDimNames and setXMLTablesDims Once the properties of a task had been defined their logical consistency can be checked by invoking the method checkSettings Check settings returns a string with a description of the first error encountered That layout eases dramatically the update process of CAPRI Definition of new tasks or changes to existing ones will generally not require changes in the GUI but simply creates the necessity of either implementing a new object with the required methods or updating an existing one Execution of tasks via a GamsStarter and GamsThread Execution of tasks with the property isGa
63. ping plug in which was at that time a cost free add on However moving the data to EXCEL and then loading them in the viewer was not a real option for the daily debugging work on the data base and the model Therefore shortly before the first CAPRI project ended n 1999 a JAVA applet was programmed by W Britz which was able to draw simple maps from CSV Files automatically produced by the CAPMOD GAMS code That code with slight modification remained active for quite a while and some of the features are still to be found in the current mapping viewer Then for a while the exploitation tools were based on XML XSLT SVG and a mapping viewer in SVG was realized However the XML solution had the big disadvantage of requiring a large amount of single ASCII input files and was not really performant when complex pivoting was used Therefore the next evolution step was a pure Java GUI with direct access to GDX files which is the current state of the art in CAPRI GDX files are an internal file format used by GAMS which allows a rather efficient I O for large sparse tables An API library allows to access GDX files from other applications That design has the obvious advantage to be firstly based onto the portable JAVA language Secondly as no external DBMS is used it is possible to use CAPRI by solely executing GAMS programs CAPRI might hence run on any system supported by GAMS without the need to install additional software The GUI consists of thr
64. resenting a multi dimensional sparse cube which is stored as a GDX file The exploitation loads the non zeros from one or several GDX files into memory However given the length of the different dimensions and the use of short codes the user would be typically lost on his own in the large tables The XML definition file 1s the equivalent of a collection of SQL queries as it defines views which combine filters in the dimensions of the cube with information on how to show the results pivot table graph or map Views as the basic concept for exploitation The concept of the CAPRI exploitation tools is centred on the idea of a view Content wise each view may be understood as showing one or several indicators relating to results of GGIG Graphical Interface Generator Documentation CAPRI working steps e g environmental effects of farming prices or market balances Each view thus e extracts a certain collection of numerical values e labels them so that they carry information to the user long texts units e chooses a matching presentation as a table map or graphic e and arranges them in a suitable way on screen The views can be linked to each others allowing a WEB like navigation through the data cube Views can be grouped to themes The user may open several views in parallel and he may change the views interactively according to its needs e g switch from a map to a tabular presentation or change the pivot of the tab
65. rying information about references to the methodological documentation and the HTML pages comprise calls to the editor to open the actual source code at the local machine as well as information about relation between the different GAMS Symbols Handling of GDX files The expand option generates information about GDXIN and GDXOUT statements as those are executed at compile time Consequently files addressed via GDXIN or GDXOUT are automatically reported in the documentation system Hovever the file does not comprise information about the execute load and execute unload executed at run time That is quite clear as the statements may be comprised in program structures as loops or if statements where there are never reached at execution time We need hence a work around to report those files in the documentation system if we would avoid writing a new GAMS parser However SIF EXIST statements are taken into account by the expand command It is therefore proposed to put an IF NOT EXIST combined with an abort statement before all execute load statements As seen in SIF NOT EXIST XdatXarm BEEBEB od ABORT dat arm allpop gdx is missing execute load Xdat armXallpop gdx WorldPop GGIG Graphical Interface Generator Documentation By doing so the program will already at compile exit if one of the necessary files 1s missing That avoids starting a process and eventually overwriting files which then will stop la
66. s or committed e g toa SVN server still carry all necessary information to identify exactly the run Technical concept The meta handling is straight forward The state of the different control is mapped into pairs of set elements and related long text descriptions as shown below from an example application SET META Scenario description my test scenario Choose model type CGE Relative weight flows 30 Use demand elasticities true Set substitution elastictu 6 0 Countries NL ri and might with one GAMS statement as shown below stored in the GDX files along with the results Wolfgang Britz Version July 2014 Au GGIG Graphical Interface Generator Documentation execute unload Zscenario descriptionZ gdx META RESULT The user might then select some scenario EB TRIMAG t britz trimag File Settings TRIMAG taks Scenario exploitation Start TRIMAG O Scenario 1 my first scenario vi Scenario 2 l Eil v Scenario 3 v Exploit scenarios Scenario 4 v Scenario 5 v Show results TRIMAG Graphical User Inter Ini file gig ini User name undefined User type runner And then by pressing show meta view the settings used for these scenarios Wolfgang Britz Version July 2014 45 GGIG Graphical Interface Generator Documentation EJ TRIMAG t britz trimag View Handling Windows EA TRIMAG result explo
67. s projects and user might even reduce learning costs if they use similar GUIs for different tools A well established example for such a tool is the GAMS Simulation Environment GSE by Wietse Dol GSE is quite general it incorporates features of an Integrated Development Interface IDE as well as exploitation Wolfgang Britz Version July 2014 g GGIG Graphical Interface Generator Documentation features It is based on specific tags introduced in the GAMS code GGIG is certainly not a competitor to GSE GSE offers more functionality and is more IDE oriented It might however be easier to embed some simple steering settings with GGIG into an existing project compared to the tag based concept of GSE GSE was in the past a commercial product distributed with a license but can now be downloaded for free An example of a completely different approach to a GUI for modelling tools offers SEAMLESS IF with its focus on component linkage Based on OpenMI it however requires the development of an OpenMi compatible wrapper around the GAMS project itself Concepts such as the SEAMLESS IF are therefore probably only suitable for larger projects focusing on combining components based on different programming languages Furthermore SEAMLESS IF is based on a client server implementation and requires specific software licences for deployment GGIG might hence be seen as a quite simple and easy to use tool to generate GUIs for GAMS projects If
68. sed to 1 Tolet the user select from the GDX files which are potentially generated by the task based on a specific content selection e g only files from a specific year 2 To introduce a filter on the GDX element loaded in the viewer e g to only load records for a specific country A filter definition consists of 3 fields GGIG Graphical Interface Generator Documentation 1 The logical dimension to which it is applied region activity product year scen dim5 2 The selection control which is used for the filter 3 The type of filter a Starts with or ends with for GDX element filters i e only such records will be loaded where the item describing the logical dimension starts with one of the selected keys b Otherwise a pair of integer values which describe on which position of the file names the selected key should be found plus either skip for only using selecting files or merge to merge records from the chosen GDXs The screenshot below shows an example generated from the following filters amp Filter region CountriesSel starts with lt filter gt lt filter gt Base year BaseYearss el 7 8 skip lt filter gt lt filter gt Year SimYearssel 9 18 skip lt filter gt The first filter starts with does not affect the file selection but will affect which records from the selected files are loaded in the viewer In the example shown below where the filter controls fit to the defi
69. t britz capri gams lelgm x File Settings Utilities E CgeRegEU tasks General settings Methodological switches Calibrate CGE CgeRegEU General settings o Run policy experiment Run test shocks Scenario description cge_rd_plus10 Use seperate threads Countries Compile GAMS StartGAMS Stop cams I Exploit results GAMS Graphical User Interface Generator Wolfgang Britz ILR University Bonn Institute for Food and Resource Economics CgeRegEU j Tni file regcge ini E User name undefined i User type runner As shown in the example above the GUI consists a few elements 1 A menu bar which allows to change some settings see the section on general interface settings 2 A workstep and task selection panel on the left hand side where the user can select between different tasks belonging to the project 3 A right hand side panel which either shows i The generated controls a button panel to start GAMS and a windows in which the message log from GAMS is shown il A panel to select data to view and to start their exploitation iii The exploitation tools 4 A small window in the left lower corner which present a logo Whereas the elements 1 and 3 11 and 3111 are not project specific the worksteps and tasks available in 2 and the controls shown to the user in 3 1 are generated in a project specific initialisation file The details of that fi
70. ter due to missing input data The HTML page will report that sequence as Includes found in GAMS CAPTRD GMS Top Declarstions Definitions Assignments References Includes Is included by Project s DAT ARM ALLPOP GDX captrd IF EXIST next Line execute load dat arm allpop gdx WorldPop File Action The use of SIF EXIST in the context of execute unload can only be motivated with the fact to produce code which is better documented Here 1s it proposed to warn the user at run time about the fact that the file 1s overwritten Index Controls to change numerical values slider 30 Generate GAMS documentation 62 Controls to change numerical values spinner Left aligned 35 3 Predefined selection groups in multilists 28 Controls to change numerical values tables 32 Several controls on one line 35 File selection subdirectories 26
71. the settings of the controls based on the user input to as sequence of GAMS or R statements which can be included into a GAMS R project to generate a specific run 4 Itallows execution of GAMS or R 5 Itoffers a GDX viewer which supports the definition of pre defined reports The overview on the process is shown in the diagram above GGIG Graphical Interface Generator Documentation In order to allow the run specific settings to enter a specific GAMS project the generated include file should define the sole entry point of run specific information The state of the controls passed to the include file should hence define all the necessary information for a specific run The GAMS code should accordingly not allow for or require additional changes to generate a scenario 1 e a specific run It is however easily to use a text control to enter the directly the name of a include file The generated include file is overwritten each time the user starts the GAMS project Basic concept of the control definition file GGIG supports two formats for definitions file XML based property files or standard Java property files The later are only supported for backward compatibility and should no longer be used for new GGIG projects XML property file The core of GGIG consists of the control definition file The XML property file defines a controls tasks etc based on XML tags As the XML file is parsed by a standard Java XML parser
72. to perform checkout and updates in cases where the model code with related data restart files or result files is under versioning control on a SVN server If the model is not under version control the settings svn no renders the tabbed plan invisible Default settings can be defined in the XML file lt SunURLForDat gt lt attr gt lt attr gt lt SunURLForDat gt lt SunURLForGUI gt lt attr gt https suni agp uni bonn de sun capri trunk GUI lt attr gt lt SunURLforGUuI gt lt SunURLforGams gt lt attr gt https suni agp uni bonn de sun capri trunk gams lt attr gt lt SunURLforGams gt lt SunURLforRestart gt lt attr gt lt attr gt lt SunURLforRestart gt lt SunURLforResult gt lt attr gt https suni1 agp uni bonn de sun caprif trunk results regege lt attr gt lt SunURLforResult gt Including credentials lt SUNPwd gt lt attr gt 1 JX attr gt lt SUNPwd gt lt SUNUSerID gt lt attr gt ierdlag lt attr gt lt SUNUserID gt The credentials are obfuscated In order to edit them use the dialogue and copy the settings from the generated ini file to the XML Wolfgang Britz Version July 2014 0 gg GGIG Graphical Interface Generator Documentation Settings linked to the exploitation tools Path to view definition file tables xm T britz capri GUI tables xml Path to Editor agp pub soft kedit KEDITW32 EXE Language to load from tables xml Sort code lists in predefined tables Sort
73. tructure your program by tasks The following example shows how the concepts of tasks can be used on conjunction with includes to structure a top level program Siftheni task Estimate constant terms Sinclude est const gms Siftheni task Estimate constant terms and trend parameters Sinclude est const and trend gms Sendif The basic idea is to have a common a part which is shared by many tasks and then blocks which perform task specific operations As the iftheni endif are working at compile time not used code is excluded even from compilation which helps to save memory and reduce the size of the listing One entry points for run specific settings A typical problem with more complex economic simulation models defined in GAMS s the steering of scenarios GGIG pushes the GAMS developer to a code structure where all run specific settings are entered via the single include file generated by GGIG That does not imply that all data for a specific scenario are comprised in the include file It could e g mean that the user has selected via the interface the include file s with specific settings and that the names of these files are passed via the include file to GAMS GGIG Graphical Interface Generator Documentation Scenario editor The scenario editor is an optional tool to be embedded in a GGIG user interface which supports the user in setting up run specific include files where the content is not stemming
74. uld be typically lost on his own in the large tables which can comprise several million non zero data and basically an unlimited amount of zero cells The XML definition file defines the views explained above and allows a structured and user friendly way to exploit the results of the different work steps It also separates raw data from the views and from the GUI code itself which requires relatively little information about the underlying data and their structure besides what is provided by the definition files XML is an industry standard to store structured information in non binary text files which explains why that format was chosen GGIG Graphical Interface Generator Documentation The structure of the XML definition files for the views General comments It is not intended to let the user edit this file but in order to have a complete documentation some information about the structure 1s included in here The XML parser used by the GUI s java code is not a general XML parser as tests revealed that the java base general XML parsers were rather slow For the XML file used for the definition the views the standard name is tables xml using a simple parser has some consequences only one tag is allowed per line and tags are not allowed to span several lines Also error handling is so far only rudimentary as users are not supposed to edit that file The table viewer currently supports up to 6 dimensions which are named as 1
75. urses as the wide spread usage of dynamic sets conditional includes the usage of batcinludes or the application of the grid solve feature The task of documenting and keeping an overview of the CAPRI code base is certainly not eased by the fact that basically any object in GAMS has global scope The concept of functions of subroutines underlying many other programming languages with clearly defined lists of variables passed in and out is not implemented in GAMS Encapsulation and modularisation are hence not naturally supported by GAMS That also renders automated documentation of the code more challenging compared to other languages Since quite a while CAPRI user community discusses about some refactoring of the code base on more clearer coding standards with the aim to ease code maintenance documentation and further development That refactoring should also cover standard for in line documentation including a better link to the methodological documentation The project CAPRI RD which will most probably start in spring 2009 will attack some of these tasks in specific working packages But clearly that will only become success if the underlying GGIG Graphical Interface Generator Documentation concept s generally accepted and implemented by the community of CAPRI developers That means that the value added of following coding and documentation standards must be visible to any developer The paper is thought to open the discussion

Download Pdf Manuals

image

Related Search

Related Contents

Pioneer M600 Car Amplifier User Manual    Aton CL400 User manual  LF2-PP 取扱説明書  

Copyright © All rights reserved.
Failed to retrieve file