Dropdown menu in MIRO

Questions on GAMS MIRO
Post Reply
thaihoang
User
User
Posts: 1
Joined: 9 months ago

Dropdown menu in MIRO

Post by thaihoang »

Hi everyone,

I am currently working on understanding the data communication between MIRO and GAMS, and I have the following questions:

Based on the transport model, I introduce a new set y with available years from 2021..2023, each year having a particular cost stored via the k(y) parameter.

My objective is to display this list of years as a Dropdown menu in MIRO. When a user selects a specific year from the Dropdown menu, I would like the adapted cost for that year to be applied to the parameter c(i,j).

Please have a look at my attached GAMS code
transport_years.gms
(1.57 KiB) Downloaded 308 times
, which works in MIRO. However, the user currently needs to manually enter the desired year after clicking on "Load Data" and modifying the scalar value to either 2021, 2022, or 2023. Once the year is selected, the associated cost is applied.

I have two questions regarding this implementation:

+ According to the guide at https://www.gams.com/miro/widgets.html#widget-dropdown, it appears that we can only implement a Dropdown menu for singleton sets?

+ Is there an alternative method to configure the year values in the Dropdown menu dynamically, fetching them directly from the k(y) parameter? Currently, when running MIRO in configuration mode, it seems that I can only manually set the years statically. I guess I need to use a Custom Renderer in this case?

Thank you for taking the time to address these queries. I appreciate your assistance.

Best,
Thai
Robin
User
User
Posts: 6
Joined: 6 years ago

Re: Dropdown menu in MIRO

Post by Robin »

Thai,
According to the guide at https://www.gams.com/miro/widgets.html#widget-dropdown, it appears that we can only implement a Dropdown menu for singleton sets?
In Configuration Mode, dropdown menus can be configured for singleton sets as well as for scalars. This is also stated in the documentation linked by you: "Besides normal GAMS scalars, a dropdown menu can also be used for singleton sets. Unlike scalars, singleton sets can[...]"
Is there an alternative method to configure the year values in the Dropdown menu dynamically, fetching them directly from the k(y) parameter? Currently, when running MIRO in configuration mode, it seems that I can only manually set the list of input years statically.
It's possible to fill the dropdown menu choices directly with data/labels from other symbols. But the corresponding symbols need to be part of the MIRO application, otherwise MIRO does not know the data. So in your case, you can add k(y) as new input symbol to the MIRO application, start the Configuration Mode and configure the dropdown menu (see attachment):
Image
I guess I need to use a Custom Renderer in this case?
In a custom renderer (or in your case, a custom input widget, see see https://www.gams.com/miro/configuration ... ut-widgets), of course, you can do whatever you want. The limitation that dropdown menus can only be used for singleton sets and scalars no longer applies in custom code, of course. There you can basically do anything you want, as long as at the end the data is sent to GAMS in the correct format. The hurdle to getting started with self-written code may be higher at first, but the first obstacles are quickly overcome. After that, you can take your application to a whole new level.

I hope that helps!
Attachments
image.png
Post Reply