简体   繁体   中英

CPLEX OPL - How to read a set of variable length from Excel

I want to read a tuple from my Excel file for my OPL model in CPLEX, which has the following format:

tuple A {
  string a;
  int b;
  {string} c;
}

The set {string} c of each tuple element is of variable length.

How can I read this via SheetConnection or is this not possible?

I've tried to read it via named fields in Excel, but that didn't work. I have also read on the CPLEX documentation, that it is only possible to read tuples of fixed width, but my data is not of fixed width.

if you know the number of tuples, you could read 2 arrays with SheetRead

One for

string a;
  int b;

The second for

{string} c;

For that array you could use the max number of strings.

And then in the .mod you turn those 2 arrays into a tuple set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM