Accessing the solution
You can access the solution directly through OPL or through the Concert API.
Accessing the solution through OPL
Print the OPL solution directly like this:
C++
opl.printSolution(cout);
Java
opl.printSolution(System.out);
.NET (Visual Basic)
opl.PrintSolution(Console.Out)
Accessing the solution through Concert
You can use the typical Concert API to access results.
C++
cout << endl
<< "OBJECTIVE: " << fixed << setprecision(2) << opl.getCplex().getObjValue()
<< endl;
Java
System.out.println("OBJECTIVE: " + opl.getCplex().getObjValue());
.NET (Visual Basic)
Console.Out.WriteLine("OBJECTIVE: " + Str(opl.Cplex.ObjValue))
In the same way, you can ask the IloCplex instance for the values of the variables from the OPL model. See Using OPL model instances for details.