Subsets from Excel

  • 27 April 2022
  • 1 reply


Hello AIMMS community!

I currently working with aimms on my thesis and for my model i need the MainExecution read a huge amount of sets and parameters. For that I’m using Excel-Sheets. I also going to need subsets and here is my, i think, for you, very simple question:

How can I exclude Excel cells from being readed? For example one of my sets is readed as

Spreadsheet::RetrieveSet ( WorkbookName, facilities, "A4:A75");

If now a subset of facilities is not contigious in this column A4:A75 but instead maybe the cells A10 to A15 and A20 to A30 and A50. How would i retrieve this subset? I tried this (see below) and many other variants and nothing worked. Hope you can help me. 

Spreadsheet::RetrieveSet ( WorkbookName, facilities, "A10:A15+A20:A30+A50");


Best answer by deannezhang 28 April 2022, 02:45

View original

1 reply

Userlevel 4
Badge +3

Welcome to AIMMS community!

In your case, I suggest

  1. in excel, add a column (for example column B)to your spreadsheet to indicate whether the element in column A belongs to the subset - 1 is yes, 0 or empty is no. 
  2. in AIMMS, add a parameter (for example isSubFacility(f) ) to take the value of column B
  3. in AIMMS, add a set (for example subFacility, with index sf), make it a subset of Facility, and add definiton: {f|isSubFacility(f)=1}
  4. then reading in column A to Facility and column B to isSubFacility

and index sf can be used where the subset is needed.


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator