C++ コードで OPL/Cplex ライブラリを使用していますが、
私の file.mod では、この決定変数をデカールしました: dvar int+ x[nodes][nodes][1..nb_max][lambdas];
Cplex がモデルを解いたので、次のように目標値を正常に回復しました。
try {
IloCplex cplex(env);
cplex.setOut(env.getNullStream());
IloOplErrorHandler handler(env,cout);
IloOplModelSource modelSource(env, "file.mod");
IloOplSettings settings(env,handler);
IloOplModelDefinition def(modelSource,settings);
IloOplModel opl(def,cplex);
IloOplDataSource dataSource(env, "file2.dat");
opl.addDataSource(dataSource);
opl.generate();
if ( cplex.solve() ) {
cout<< opl.getCplex().getObjValue()<< endl;
}
}
私の質問は、多次元配列「x」を回復するにはどうすればよいですか? で試しました
IloIntVar x = opl.getElement("x").asIntVar; IloIntVar xvar =x.get(0);//最初の項目
しかし、次のエラーが発生します!
エラー: '' から非スカラー型 'IloIntVar' への変換が要求されました エラー: 'class IloIntVar' には 'get' という名前のメンバーがありません
私は OPL の初心者です。よろしくお願いします。