Skip to content
Alexander Fust edited this page Sep 9, 2024 · 16 revisions

GAMS Model Instance Inspector (MII)

image

How To Get Started

Before the MII is downloaded and installed please make sure that GAMS is installed. Details on how to install GAMS can be found on the download page. Please make sure that the PATH variable is set during the GAMS installation. If this is not done on your system you have to copy the MII to the GAMS system directory. Details on adding GAMS to the path can be found in the GAMS documentation.

When GAMS has been successfully installed the MII needs to be downloaded. All the MII releases can be found on GitHub, but the recommendation is that the latest version is used.

Now the MII needs to be installed. If you did not add GAMS to the PATH please copy/move the MII to the GAMS system directory; otherwise our recommendations are

  • Windows
    • Extract the archive, e.g. GAMS_MII-0.4.9-x86_64.zip
    • Move the MII directory to your prefered location.
    • Navigate into the directory and run the mii.exe
  • Linux
    • Move the AppImage (GAMS_MII-0.4.9-x86_64.AppImage) to your prefered location
    • Make the AppImage executable: chmod +x GAMS_MII-0.4.9-x86_64.AppImage
    • Run the MII: ./GAMS_MII-0.4.9-x86_64.AppImage
  • macOS x86 (Intel)
    • Open the dmg, e.g. GAMS_MII-0.4.9-x86_64.dmg
    • Run the MII by double clicking on the MII icon
  • macOS M (ARM)
    • Open the dmg, e.g. GAMS_MII-0.4.9-arm_64.dmg
    • Run the MII by double clicking on the MII icon

Loading a model instance

There are three ways to use the MII to inspect a model instance.

Select a gms file and click the Run button

  • This will run the selected gms file with some required command line parameters and the data of the last model instance, located in the specified scratch directory (scrdir), will be opened for inspection.
  • The way to generate a scratch directory is to execute a gms file with the command line parameter MIIMode. With the scrdir parameter the location of the scratch directory is specified, which is required so that the MII knows where the data is located.

image

image

Open a model from the GAMS Model Library (via gamslib)

  • To load and open a GAMS model from the GAMS Model library the gamslib checkbox has to be activated. Furthermore, the name of a model of the library has to be given, e.g. trnsport.gms or copper.gms.
  • As mentioned before the MIIMode and scrdir are required, so that the model instance can be found and displayed.

image

Select gamscntr.dat from a scratch directory of a model that was executed already and click the Run button

  • This does not run the model again but opens the given model instance for inspection.
  • When a scratch directory is opened the given command line parameters are ignored.
  • Please keep in mind that sharing scratch directories might not work. The scratch files contain absolute paths of the system the model was executed on, so if the files are moved/shared the paths may not exist and the model instance can not be loaded by the MII.

image

image

In all the cases the process log gives information about the steps involved to show the model instance. This will include information about a gams run, loading a model instance and other information like warnings and possible issues.

Utilizing the Search

The MII supports searching for labels. This means the headers of all table based views are searched. In future versions searching the data might be added as well as searching the Postopt view.

The search term can be plain or a regular expression. In the latter case the Regular Expression checkbox has to be activated. For complex regular expressions it can be useful to test them before using them. This can be done with the regex101 online tool.

After defining a search term Return/Enter has to be pressed to perform the search. If any occurrences of the term have been found they will be shown in the search result view, which is on the right side of the MII. Any entries of the result view can be selected by clicking on it. This will highlight the column or row related to the entry.

image

Utilizing the Filter Dialog

image

The Filter Dialog, opened via Main Menu > View or CTRL + G, can be used to reduce or extend the displayed data. For example the Blockpic views are usually reduced via the dialog (to select the most valuable data) and the Postopt view is empty by default and the Filter Dialog is used to show data the user is interested in (otherwise too much data might be visible).

Depending on the current view some filters may not have an effect, i.e. the view only contains symbol names but no labels or the model does not have certain special values. The content of the filter dialog tabs is also view depended, e.g it can happen that the Dimension tab has no data because it is not available in the current context.

Predefined and Custom Views

The Predefined Views give a basic overview about the model instance. These sticky views can be used as a starting point to filter for specific entries or might be saved to create custom views (cloned views). In addition to that Custom Views can be saved as well, so that one view is a starting point for a new view with reduced effort for the filter configuration. Any saved view can also be modified without affecting the view they are derived from. For example this way it is possible to create multiple Postopt views, showing different sets of information. Please keep in mind that the MII does not yet persist the configuration, i.e. after a restart the configuration has to be done again.

Blockpic and Symbol Views

The Blockpic views give an overview about the model instance. Using the Filter dialog they can be further adjusted or the views context menu can be used to create a Symbol view. A Symbol view shows information about one or more equations and variables, so that they can be viewed in detail. As any other view the Symbol view can be customized via the Filter Dialog or saved.

Postopt View

The Postopt view always starts with an empty view, where the symbols of interest have to be selected. The reason for this design is that for non-trivial models this view may contain too much data, which reduces the usability as well as the performance.

image

It is possible to directly navigate to the Filter Dialog by clicking on the text displayed inside the Postopt view. After selecting any symbol name the view will be filled with data.

image