Ejemplo n.º 1
0
 public virtual void StoreResult <T>(List <T> output)
 {
     using (FileHandler outputFile = new FileHandler(Global.IOMode.Output))
     {
         foreach (object obj in output)
         {
             outputFile.WriteContent(obj);
         }
     }
     CUI.ShowGeneralInformation("\n\nPlease open output.txt to view the result.");
 }
Ejemplo n.º 2
0
        public override void StoreResult(params object[] obj)
        {
            Tuple <double[], int[]> solutions;

            try
            {
                solutions = (Tuple <double[], int[]>)obj[0];
            }
            catch
            {
                throw new DynamicProgrammingException("\n\nLogical Error at Rod Cutting Default Problem. The Optimal Solution Table is not in a correct format.");
            }

            using (FileHandler outputFile = new FileHandler(Global.IOMode.Output))
            {
                outputFile.WriteContent("If you cut a " + lengthOfCut + " length rod you can generate a maximum revenue : " + solutions.Item1[lengthOfCut - 1] + ". And you will get this result if you cut the rod at these pieces -");
                while (lengthOfCut > 0)
                {
                    outputFile.WriteContent(solutions.Item2[lengthOfCut - 1]);
                    lengthOfCut -= solutions.Item2[lengthOfCut - 1];
                }
            }
        }
Ejemplo n.º 3
0
        public override void StoreResult(params object[] obj)
        {
            Tuple<double[], int[]> solutions;

            try
            {
                solutions = (Tuple<double[], int[]>)obj[0];
            }
            catch
            {
                throw new DynamicProgrammingException("\n\nLogical Error at Rod Cutting Default Problem. The Optimal Solution Table is not in a correct format.");
            }

            using (FileHandler outputFile = new FileHandler(Global.IOMode.Output))
            {
                outputFile.WriteContent("If you cut a " + lengthOfCut + " length rod you can generate a maximum revenue : " + solutions.Item1[lengthOfCut - 1] + ". And you will get this result if you cut the rod at these pieces -");
                while (lengthOfCut > 0)
                {
                    outputFile.WriteContent(solutions.Item2[lengthOfCut - 1]);
                    lengthOfCut -= solutions.Item2[lengthOfCut - 1];
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Store the result of the execution
 /// </summary>
 /// <param name="output">Result to be stored</param>
 public virtual void StoreResult(params object[] output)
 {
     using (FileHandler outputFile = new FileHandler(Global.IOMode.Output))
     {
         foreach (object obj in output)
             outputFile.WriteContent(obj);
     }
     CUI.ShowGeneralInformation("\n\nPlease open output.txt to view the result.");
 }