Step 14: Display the solution

Shows lines to display the solution in this example.

Go to the comment Step 14 in Dietlesson.cs, and add the following lines to display the solution.


            System.Console.WriteLine();
            System.Console.WriteLine("Solution status = " 
                                     + cplex.GetStatus());
            System.Console.WriteLine();
            System.Console.WriteLine(" cost = " + cplex.ObjValue);
            for (int i = 0; i < nFoods; i++) {
               System.Console.WriteLine(" Buy" 
                                        + i 
                                        + " = " 
                                        + cplex.GetValue(Buy[i]));
            }
            System.Console.WriteLine();
         }