I implemented a CPLEX model as .mod, which uses data from a .dat file. Three example sets look like this in the .dat file:
Set1 from SheetRead(Data1, "Sheet1!A2:A5");
Set2 from SheetRead(Data2, "Sheet1!A2:A3");
Set3 from SheetRead(Data3, "Sheet1!A2:A250");
Now I am investigating different data using the same model. That means that in one case Set1 has 4 data entries and therefore goes from A2:A5 but in another case it might include data from A2:A100. Is there a possibility so that I don´t have to put in the excel ranges manually every time? I tried to put a very high upper limit so that in every case all data is included, but then CPLEX includes a zero into the set in case the actual range is smaller.
Thanks a lot! Best Regards
Addition: I tried to use oplrun -D option and it does not really work out yet, but I could not figure out the reason because there is no error message or something.
Assume in that there is the following written in the .mod file called RCPLEX.mod:
tuple TEST{
key int i;
key int j;
}
{TEST} A=...;
float p[A]=...;
...It follows an optimization using set A and parameter p.
A is the result of several operations in R. It is a data.frame. p represents the second column of this data.frame A.
So what I did is:
Result <- system("oplrun -DA=A -Dp=A[,2] RCPLEX.mod")
This gives a value of 5. But this is not the correct result of the CPLEX .mod. It also does change with the input. I think it does not run the CPLEX .mod because it also takes only 1 second of time. The CPLEX .mod normally takes like 10 minutes. Did I do something wrong? Maybe in application of the -D option on data.frames/sets?