Порядок вектора столбцов решения не поддерживается при чтении файла lp в OsiCbcSolverInterface - PullRequest
0 голосов
/ 06 апреля 2020

Я теряю порядок столбцов при чтении файла .lp в OsiCbcSolverInterface.

private OsiCbcSolverInterface solver = new OsiCbcSolverInterface();

.
.. // add all the constraints to the solver
 solver.writeLpNative(fileName + ".lp", rowNames.toArray(new String[rowNames.size()]),
                        columnNames.toArray(new String[columnNames.size()]), 1e-7);

private CustomCbcSolver customCbcSolver = new CustomCbcSolver(solver);

customCbcSolver.solve();
double[] solutionVec = customCbcSolver.solver().getColSolutionVec();

// above solution works fine, the columnNames and solutionVec are correctly aligned
//but now if I read the lp file generated above into a solver and then solve like,

//loading the previously generated lp file
 solver = new OsiCbcSolverInterface();
 solver.readFile(new File(fileName + ".lp"));
customCbcSolver = new CustomCbcSolver(solver);
double[] solutionVecAfterReading = customCbcSolver.solver().getColSolutionVec();

// now solutionVecAfterReading and columnNames are not aligned

solutionVecAfterReading и solutionVec не идентичны. Оба разные. Но оба идентичных при сортировке. Это означает, что вектор решения отображается неправильно во второй раз, когда мы решаем, читая файл.

Есть ли что-то, что мне не хватает?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...