# Read in an array of different sets from Excel

Question asked by felix.ober on Dec 27, 2016
Latest reply on Jan 9, 2017 by felix.ober

There Xpress followers,

I have the following problem:I want to read in an array from Excel, the values to be saved in the array are sets of integers (sets contain different numbers of elements).

 declarationsorders_to_be_filled_on_day: array(time_horizon) of set of integer end-declarations ! Subset of orders that are active on day d

If I would write the code directly into Xpress-IVE (without using an Excel table), it would look for example like:

orders_to_be_filled_on_day:: [{1,5},{2,6},{3,7},{4,8},{9,10}]

What do I have to write into the 5 cells of Excel, such that Xpress recognizes each value as a set of integers?

 {1,3} ? ? ? ? ?

Probably, it would already be enough to know, how I can read in a set of integer from Excel. I read through the manuals, but was not able to figure it out.

Thanks for the help!

If it should help, here a bit more from the code:

! HERE AS AN EXAMPLE FOR orders = 1..10, rail_car_type = 1..2, time_horizon = 1..5, scenarios = 1..2

declarations

! Subsets

rail_types_for_order: array(orders) of set of integer                    ! Subset of rail car types that can fullfill a certain order a

orders_to_be_filled_by_type: array(rail_car_types) of set of integer      ! Subset of orders that require rail car type k

orders_to_be_filled_on_day: array(time_horizon) of set of integer         ! Subset of orders that are active on day d

orders_to_be_filled_in_scenario: array(scenarios) of set of integer       ! Subset of orders containing the orders belonging to a scenario s

Objective: linctr                                                                ! Objective function

end-declarations

! INITIALIZATION OF ARRAYS

initializations from "mmsheet.excel:Data_for_meta_optimization_model.xlsx"

c as 'noindex;[Tabelle1\$E3:F3]'

rail_types_for_order as 'noindex;[Tabelle1\$C10:C19]'

orders_to_be_filled_by_type as 'noindex;[Tabelle1\$E4:F4]'

orders_to_be_filled_on_day as 'noindex;[Tabelle1\$F22:J22]'

orders_to_be_filled_in_scenario as 'noindex;[Tabelle1\$E5:F5]'

end-initializations

!rail_types_for_order:: [{1},{2},{1,2},{2},{1},{1},{2},{2},{1,2},{1}]

!orders_to_be_filled_by_type:: [{1,3,5,6,9,10},{2,3,4,7,8,9}]

!orders_to_be_filled_on_day:: [{1,5},{2,6},{3,7},{4,8},{9,10}]

!orders_to_be_filled_in_scenario:: [{1,2,3,4},{5,6,7,8,9,10}]