如何 运行 在同一模型中使用流量控制多个 .dat 文件?

How to run multiple .dat files in the same model with using flow control?

我在 CPLEX 中有一个 MIP 模型。我尝试使用启发式算法和流量控制。我需要使用多个“.dat”文件并在每次解决问题时获取决策变量的解决方案值。我尝试使用“addDataSource”,但没有解决方案可用错误。当我尝试在没有“addDataSource”的情况下解决问题时,我没有收到此错误。我该如何处理这个问题。

中看到几个dat文件

https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/

{string} datFiles={"zoodat.dat","zoodat2.dat"};
    
    main
    {
      var source = new IloOplModelSource("zoodat.mod");
      var cplex = new IloCplex();
      var def = new IloOplModelDefinition(source);
     
      for(datFile in thisOplModel.datFiles)
      {
         writeln("with ",datFile);
         var opl1 = new IloOplModel(def,cplex);
         var data1=new IloOplDataSource(datFile);
          opl1.addDataSource(data1);
        
          opl1.generate();
          cplex.solve();
          opl1.postProcess();
          writeln();
   

        }

 }
 
 /*
 
 which gives
 
 with zoodat.dat
The minimum cost is 380
We will use 6 40 seats buses and 2 30 seats buses 
with zoodat2.dat
The minimum cost is 500
We will use 10 40 seats buses and 0 30 seats buses 
*/