> Discrete Optimization > Transport: Piecewise Linear Optimization > Displaying a Solution

To display the solution, use the methods of IloEnv (documented in the ILOG Concert Reference Manual) and IloCplex (documented in the ILOG CPLEX Reference Manual).

    env.out() << " - Solution: " << endl;
    for(i = 0; i < nbSupply; i++){
      env.out() << "   " << i << ": ";
      for(j = 0; j < nbDemand; j++){
        env.out() << cplex.getValue(x[i][j]) << "\t";
      }
      env.out() << endl;
    }
    env.out() << "   Cost = " << cplex.getObjValue() << endl;