GAMS Studio integration

Introduction

In this section we show you how to use GAMS Studio for the development of your MIRO apps. The new integrated development environment for GAMS has built-in functionality of the most important interactions with MIRO. In this section we only give an overview of these. Different aspects are explained in more detail in corresponding linked chapters.

General

MIRO installation location

After installing GAMS MIRO, make sure that Studio and MIRO know about each other. In Studio go to FileSettingsMIRO and check whether the MIRO installation location is correct:

MIRO installation location

Main file in Studio

GAMS Studio is not executing the file currently visible in the editor, but the file which is set as main file in the corresponding group in the project explorer. Make sure that the model you want to use for MIRO is marked as the main file. If this is not the case, you can change it by right clicking on the file in the project explorer → set as main file:

Set as main file in Studio

File encoding

Your GAMS model files need to be encoded with UTF-8. In GAMS Studio this is the default file encoding from version 0.14.5 on. You can change the encoding of your file via EditEncodingconvert to ... → UTF-8. Other file encodings are not supported in GAMS MIRO!

File encoding in GAMS Studio

MIRO interaction

All interaction between GAMS Studio and MIRO can be found in the MIRO menu:

MIRO menu in GAMS Studio

Run Base mode

Launch MIRO Base mode

This option starts the MIRO Base mode. In the Base mode, you can supply your models with input data, generate, display and save the results of your optimization as well as compare different scenarios with each other, everything visually supported by various plotting tools.

MIRO Base mode

Run Hypercube mode

Launch MIRO Hypercube mode

This option starts the MIRO Hypercube mode. In this mode, you can automatically solve scenarios with several different parameterizations at once.

Hypercube mode workflow

Before using the Hypercube mode, MIRO has to know which files belong to the GAMS model. Read more on how you can tell MIRO which files belong to your model via the model assembly file.

Run Configuration mode

Launch MIRO Configuration mode

This option starts the MIRO Configuration mode. Here, you can create plots and widgets or change certain settings with a few mouse clicks, visually supported by a live preview.

MIRO Configuration mode

Skip model execution

In the MIRO menu of GAMS Studio there is the entry "Skip model execution". If this option is activated, the model is not executed before MIRO is started, but MIRO is called directly instead. This can be helpful if the model takes a long time to be solved.

Skip model execution

But: This option should be used with caution!
If the model execution is skipped, the GAMS/MIRO data contract is not created or refreshed. This means that changes made in the model are not communicated to MIRO. If you have a model that takes a long time to be solved and you don't want to run through it in order to launch MIRO, you can simply set the GAMS option a=c (action=compile) instead of the option "Skip model execution". This will only compile the model which is sufficient to update the data contract. Note that in this case a new default scenario is created, but it contains only the data that is available after the compilation phase (most of the time only input data).

Create model assembly

If you use the Hypercube mode or want to deploy a fully configured app, MIRO needs to know about the files that belong to your model. This is primarily the main model file, but also all files necessary to calculate all inputs and outputs, e.g. files that are included in the model. To tell MIRO about these files, go to create model assembly and select those folders and files which are needed. If you select a folder, all files in it will be included. If you want to use only single files of a folder, you have to expand the folder and select the corresponding file(s). When you are finished, click on create.

create model assembly file
Attention

In case you have specified custom analysis scripts, make sure to include these here as well!

Deploy

When the MIRO app is completely configured it can be deployed, i.e. exported and installed so that it can be easily shared with end users. No further changes to the model or the configuration can be made once it is deployed.

Deploy MIRO model

In GAMS Studio, select Deploy and specify which MIRO modes you want to support in your MIRO app (Base mode/Hypercube mode or both). If the Base mode is selected, you also need to decide how your model shall be executed (execution environment). There are three options:

  1. Multi-user: This option allows your app to be used by multiple users simultaneously. Your model files are extracted at a random location, which is different for each user, and your model is executed from there.
  2. Single-user: Your model is executed inside the model directory. No extraction of your model files is required, but this means that you can NOT have multiple users accessing your MIRO app at the same time.
  3. Local multi-user (uses idir): With this third option, your model is again executed from a random location, but this time no model data is extracted here. Instead, GAMS is executed with an input directory pointing to the path where your model files are located. Choose this option ONLY if you have many large files that belong to your model and extracting them would take a long time. Be aware that due to the fact that idir is used, your model might break! For example, if you use $call or the execution-time equivalent execute (or related functions), the relative paths used in these calls will no longer exist (since the curdir is now a random location). The solution is to prefix all these relative paths with %gams.idir1%. For example, in order to import an Excel file test.xlsx, GDXXRW needs to be called like this: $call gdxxrw i=%gams.idir1%test.xlsx. Alternatively, you can also use absolute paths (e.g. via $setNames "%gams.input%" fp fn fe (see here).
    Adjusting all affected paths is potentially a lot of work, so we strongly advise against using this option unless you know what you are doing!
Advice

We advise you to test your MIRO app before distributing it. GAMS Studio offers an option test deployment. This simulates how your end users will experience the MIRO app (e.g. for the Base mode MIRO is launched in the specified execution environment). In particular, you should check whether you forgot to include important files in the model assembly.