1

I have a large OPL problem which in the last run has run for 9+ Hrs, the engine log says 32 solutions found.

The last lines in the .dat file are SheetWrite. The results are not being written back to Excel and the error is : Sheet data not supported on this platform .

Can anyone please help me understand this issue.

Ranajit
  • 49
  • 6

1 Answers1

1

SheetWrite works only when you have Excel and a Windows machine. If you do not you may export your result into a csv file instead.

If you use CPLEX 20.1 you may use CSVPublish

If you do not, see How to export into a csv file ? in How to with OPL ?

   execute
    {
    // turn an OPL tupleset into a csv file
    function turnTuplesetIntoCSV(tupleSet,csvFileName)
    {
    var f=new IloOplOutputFile(csvFileName);

    var quote="\"";
    var nextline="\\\n";
    var nbFields=tupleSet.getNFields();
    for(var j=0;j<nbFields;j++) f.write(tupleSet.getFieldName(j),";");
    f.writeln();
    for(var i in tupleSet)
    {
     
    for(var j=0;j<nbFields;j++)
    {
    var value=i[tupleSet.getFieldName(j)];
    if (typeof(value)=="string") f.write(quote);
    f.write(value);
    if (typeof(value)=="string") f.write(quote);
    f.write(";");
    }
    f.writeln();
    }
    f.close();
    }
    }
    tuple t
    {
    string firstname;
    int number;
    }
    {t} s={<"Nicolas",2>,<"Alexander",3>};
    execute
    {
    turnTuplesetIntoCSV(s,"export.csv");
    }
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15