【问题标题】:CPLEX OPL Error- Sheet data not supported on this platform此平台不支持 CPLEX OPL 错误表数据
【发布时间】:2021-05-30 18:46:30
【问题描述】:

我有一个大的 OPL 问题,在上次运行中已经运行了 9 小时以上,引擎日志显示找到了 32 个解决方案。

.dat 文件的最后几行是 SheetWrite。结果未写回 Excel,错误为:此平台不支持工作表数据。

谁能帮我理解这个问题。

【问题讨论】:

    标签: cplex opl


    【解决方案1】:

    SheetWrite 仅在您拥有 Excel 和 Windows 计算机时才有效。如果不这样做,您可以将结果导出到 csv 文件中。

    如果您使用 CPLEX 20.1,您可以使用 CSVPublish

    如果您不这样做,请参阅 How to export into a csv file ?在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");
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-23
      • 2021-01-05
      • 1970-01-01
      • 2018-10-23
      • 2019-01-25
      • 2018-08-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多