FP /

GAMSDevelopmentToolsRefactoringAnalysisVisualisation

GAMS development tools: refactoring, analysis, visualisation

(added 081109)

(This proposal depends on the GAMS Software Technology Infrastructure proposal and is closely related to the GAMS Model Refactoring.)

GAMS is a DSL for (economic) optimisation problems.

  • Visualisation of dependencies between equations / files
  • Support for refactoring
  • Testing framework
    • nightly runs of the system
    • connection to the SVN repository (track down latest working version etc.)
Background
FP (Haskell), "Testing, Debugging and Verification", Mathematical Modelling, Agile Software Development (should contain both unit testing and refactoring), Software Architecture
Contact
Patrik Jansson (Chalmers), Cezar Ionescu (Research.PIK)

Notes

Student Questions:

  • 1. This proposal together with the proposal GAMS infrastructure is to build an open source infrastructure for working with GAMS source code. My part is to extend this infrastructure by adding features. As far as I know, I have read a little documentation about GAMS and found that there already has a programming environment. So my question is whether the project to be built is similar to the IDE which can be downloaded from the website?

Answer from Patrik:

(It is good that you have started doing some "related work" research - one of the most important parts of a MSc thesis is to build on the current "state of the art" and not re-invent the wheel. I have not yet tried the GAMS IDE so my comments may be a bit off topic.)

No, I don't expect the outcome of this project to be an IDE, but rather software components which could be used as "plugins" for an IDE or as stand-alone "batch mode" tools. The focus should be on the grammatical and semantical structure of (models expressed in) the GAMS language, working with abstract syntax trees and source to source transformations. (I would ideally like a system which can be run on the svn version history of the model source code and present aggregated results.)

  • 2. Which language should I use and which platform ?

Patrik: I would say Haskell and Linux, but the most important part is portability (platform independent if possible). Perhaps using http://www.graphviz.org/ for visualisation? Haskell is really good at handling abstract syntax trees (perhaps helped by BNF Converter [1]), and it is the language I know best. Linux has very good support for software development and a strong open source tradition.

[1] http://www.cs.chalmers.se/Cs/Research/Language-technology/BNFC/

  • 3. For writing the test framework, is it like Junit in Java ? Also should it generate test cases automatically ?

Patrik: The important part here is to support regression testing to help detect problems when the models are refactored or improved (support test and compare before and after a certain change). If some parts can be automated that would be great, but the input data of the typical GAMS models are often rather large matrices of floating point numbers which I would expect are difficult to generate automatically. But automatic testing of "input sensitivity" would be good - running the model with small variations of the input data and measuring the change in the output (to identify the relative importanance of different parts of the input). It would also be good to test the models with "trivial" (maybe "all zeroes") or "border line case" inputs to catch bugs. If this "special cases" can be (semi-)automatically generated from analysis of the model source code that would be great. Tracking the run-time of the solver for different versions of the model source code would also be good.

  • 4. As you said, this proposal is closely related to GAMS Model Refactoring. So what is refactoring support for GAMS ?

Patrik: Refactoring, in general, is about semantic preserving transformation of source code. In the case of GAMS and their users at PIK one of the needs is to change the source code of the model to make it run faster, but still producing the same result. Another need is to restructure the code for readability, still without changing the behaviour. (It could be renaming of variables or equations, splitting or joining files, changing between s_{i+1} = sum_{j=0}^{i}(a_j) and s_{i+1} = s_i + a_i, etc.)

Currently GAMS supports separating a model into several source files (which could be thought of as sub-models or sub-modules), but there is no real module system so to the GAMS optimiser it is all one big optimisation problem. When the models grow more complex this becomes a problem for the model developers. Conceptually they talk about "combining sub-models", such as a sub-model for the economy and a sub-model for the climate, but there is no direct language support for developing and testing a sub-model by itself. In the current system they hesitate to replace one sub-module by a better version, because they are not sure about the effects that could have on the whole system. Support for dependency visualisation and unit testing could give them sufficient trust in that the changes are under control.


I hope these answers help you forward - we could set up a meeting next week to finalise the description if you want to.

Note that this project will require some interaction with Eric Bergquist who will work on GAMS Model Refactoring and optimisation and that I would like one more student working on the GAMS Software Technology Infrastructure also in parallell. (If you have friend looking for a MSc project you may try to recruit them;-)