I'm using CP Optimizer from ILOG CPLEX Studio to run an optimization problem. Specifically, I'm running an OPL code in Java using Eclipse IDE. My code is working and I'm getting for an instance the following output:
Where "Fitness" is the value of the objective function and the next 100 numbers are a feasible solution for the problem. I want to save the numbers in the red box in a 2D array of integers (of dimension 10 rows x 10 columns) for being utilized for continuing the search with a local search method. The solution is displayed when I call: opl.postProcess();
in my Java code. Here is an extraction of my code:
if (cp.solve()) {
System.out.println("Fitness: " + opl.getCP().getObjValue());
opl.postProcess();
}
There exist an alternative for saving that information in a 2D array of integers?
You could have a look at the example CPLEX_Studio1210\opl\examples\opl_interfaces\java\iterators\src\iterators that shows you how to get back in java the values that you have in OPL.
Another way is to go through a file and use IloOplOutputFile in your postProcess in order ro save your array in a text file or csv file