![](/img/trans.png)
[英]How to run a single .mod file and lots of .dat files using CPLEX and java?
[英]How to run multiple .dat files in the same model with using flow control?
我在 CPLEX 中有一個 MIP model。 我嘗試使用帶有流量控制的啟發式算法。 每次解決問題時,我都需要使用多個“.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
*/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.