IBM的CPLEX cplex.setOut(env.getNullStream())无法正常工作

问题描述 投票:0回答:1

我已经查看了问题,看看是否有人已经问过这个问题,据我所知,没有其他人有这个问题。

我试图从命令行压缩oplrun的详细输出。我知道有些人使用cplex.setOut(env.getNullStream())很幸运,其中cplex是IloCplex类型的对象。函数setOut()继承自IloAlgorithm类。

当我尝试在我的模型(.mod)文件中的主代码块中使用它时,我收到错误:

脚本运行时错误:未知属性'setOut'。

我在调用solve()之前放置了函数调用。

什么想法可能是错的?

谢谢。

这是一段代码:

main{

    var opl = thisOplModel;
    var mod = opl.modelDefinition;
    var dat = opl.dataElements;
    var set = opl.settings;
    var cplex1 = new IloCplex();

    cplex1.setOut(env.getNullStream()); //Giving me problems

    opl = new IloOplModel(mod,cplex1);
    opl.addDataSource(dat);
    opl.generate();

    cplex1.tilim = opl.tiLim;
    cplex1.mipemphasis = 0;

    cplex1.solve();
    // more stuff ... 
}
optimization cplex opl
1个回答
0
投票

啊,你正在使用IBM ILOG Script for OPL(又名oplscript)。 setOut方法仅适用于C ++,Java,.NET OPL API(例如,参见here)。

根据文档中的this页面,CPX_PARAM_SCRIND是“没有等效OPL选项的CPLEX参数”之一。除非您切换到使用C ++,Java或.NET OPL API之一,否则我认为不可能按照您的要求进行操作。在IBM developerWorks官方论坛here上提出了类似的问题。

© www.soinside.com 2019 - 2024. All rights reserved.