tabacoben
tabacoben

Reputation: 41

cplex/opl model - 4 index parameter - data sheet connection with excel

I'm a total beginner with CPLEX and OPL, so maybe you can help me with the coding of a mixed integer programming model.

In my case: I have an optimization function including a parameter transportation cost which are specific for the starting point (Hubs h), the destination (DCs i), the transported good (Products k) and the mode of transportation (TransportOptions r) used.

I wrote it like this:

float transportC_Hub_DC[Hubs][DCs][Products][TransportOptions] = ...; 

//transport cost of one unit of gook k vor starting point h to destination i using transportation option r

I would like to fill this array with its multiple dimensions from an excel spread sheet. At the moment my spreadsheet has the four indexes in separate columns and the specifice transportation cost in another column. It looks like this:

Excel Datasheet

My problem is that I do not know how to make the programme understand how the transportation cost data are ordered. How does the programme know that in the first cell of the column "transportation cost" is the cost for the specific combination of the different indexes? So how do I tell the programme that I used h=1, i=1, k=1, r=1 in the first cell and h=1, i=1, k=1, r=2 in the second cell and not h=1, i=1, k=2, r=1 in the second cell? What do I have to write in the model or the data file in CPLEX to make this clear?

Upvotes: 1

Views: 578

Answers (1)

Alex Fleischer
Alex Fleischer

Reputation: 10037

See technote http://www-01.ibm.com/support/docview.wss?rs=0&context=SSCMS55&uid=swg21401340&loc=en_US&cs=utf-8&cc=us&lang=all

The idea is to read a tuple set and then turn your tuple set into a 4D array.

Upvotes: 1

Related Questions