How can I read a 1 dimensional data in excel to a two dimensional data in cplex?

Viewed 39

I have made data.I have a data file that is organized in 1 column. It is generated as this, since I tried to generate unpuntual times in s scenario for n patient at a clinic. My question is, now when i read the column into cplex mod as a two dimensional data, let say Tunpunctual[s][n]? enter image description here

1 Answers

In Excel, Rocket science and optimization

there is a very simple 2D array read example.

.mod

int n=2;
int m=3;

int ar[1..n][1..m]=...;
{int} se=...;

int subar[1..2]=...;
int subar2[1..2]=...;

subject to
{
  
}

{int} se2= {i+1 | i in se};
int ar2[i in 1..n][j in 1..m]=ar[i][j]+1;

execute
{
  writeln("subar=",subar);
  writeln("subar2=",subar2);
}

.dat

SheetConnection s("read2Darray.xlsx");

ar from SheetRead(s,"B1:D2");
subar from SheetRead(s,"B1:C1");
subar2 from SheetRead(s,"B1:B2");
se from SheetRead(s,"B1:D2");

se2 to SheetWrite(s,"B5:D6");
ar2 to SheetWrite(s,"F5:H6");

subar to SheetWrite(s,"B8:B9");
subar2 to SheetWrite(s,"B11:C11");
Related