Topic
2 replies Latest Post - ‏2013-03-05T14:58:11Z by SystemAdmin
outlookeye
outlookeye
17 Posts
ACCEPTED ANSWER

Pinned topic How to import data file when using linux version IDE-OPL optimization stu

‏2012-11-07T21:05:40Z |
I was using OPL CPLEX windows version before. I import data in the .dat file through commands like these:
"SheetConnection sheet("inputs.xls")"
** from SheetRead(sheet, "input! A2:C4").

But the linux version cannot import excel file in this way.
How to import such kind of data file in linux version OPL CPLEX optimization studio 12.4?

Actualy, my windows system desktop is limited on memory resource, so I have to change to a power server which has linux, so I met this problem.

Thank you for your helps!

----
Pan
Updated on 2013-03-05T14:58:11Z at 2013-03-05T14:58:11Z by SystemAdmin
  • outlookeye
    outlookeye
    17 Posts
    ACCEPTED ANSWER

    Re: How to import data file when using linux version IDE-OPL optimization stu

    ‏2012-11-12T16:40:16Z  in response to outlookeye
    Can Anyone Help me? Thank you so much
    • SystemAdmin
      SystemAdmin
      2130 Posts
      ACCEPTED ANSWER

      Re: How to import data file when using linux version IDE-OPL optimization stu

      ‏2013-03-05T14:58:11Z  in response to outlookeye
      Hi,

      if your file is a csv file, then what you can do is parse it in script with something like

      execute {
         var f = new IloOplInputFile("output.txt");
         if (f.exists) {
           writeln("the file output.txt exists");
           var s;
           while (!f.eof) {
            s=f.readline();
            writeln(s);
           }
           f.close();
         } else { 
           writeln("the file output.txt doesn't exist");
         }
      }
      
      Updated on 2014-03-26T05:50:34Z at 2014-03-26T05:50:34Z by iron-man