Esempio n. 1
0
 private BestAverageWorstVRPToursCalculator(BestAverageWorstVRPToursCalculator original, Cloner cloner)
     : base(original, cloner)
 {
 }
 private BestAverageWorstVRPToursCalculator(BestAverageWorstVRPToursCalculator original, Cloner cloner)
   : base(original, cloner) {
 }
        public BestAverageWorstVRPToursAnalyzer()
            : base()
        {
            #region Create parameters
            Parameters.Add(new LookupParameter <IVRPProblemInstance>("ProblemInstance", "The problem instance."));

            Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Distance", "The distance of the VRP solutions which should be analyzed."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("BestDistance", "The best distance value."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("CurrentBestDistance", "The current best distance value."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("CurrentAverageDistance", "The current average distance value of all solutions."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("CurrentWorstDistance", "The current worst distance value of all solutions."));
            Parameters.Add(new ValueLookupParameter <DataTable>("Distances", "The data table to store the current best, current average, current worst, best and best known distance value."));

            Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("VehiclesUtilized", "The vehicles utilized of the VRP solutions which should be analyzed."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("BestVehiclesUtilized", "The best  vehicles utilized value."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("CurrentBestVehiclesUtilized", "The current best  vehicles utilized value."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("CurrentAverageVehiclesUtilized", "The current average  vehicles utilized value of all solutions."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("CurrentWorstVehiclesUtilized", "The current worst  vehicles utilized value of all solutions."));
            Parameters.Add(new ValueLookupParameter <DataTable>("VehiclesUtilizedValues", "The data table to store the current best, current average, current worst, best and best known vehicles utilized value."));

            Parameters.Add(new ValueLookupParameter <VariableCollection>("Results", "The results collection where the analysis values should be stored."));
            #endregion

            #region Create operators
            BestVRPToursMemorizer bestMemorizer           = new BestVRPToursMemorizer();
            BestAverageWorstVRPToursCalculator calculator = new BestAverageWorstVRPToursCalculator();
            ResultsCollector resultsCollector             = new ResultsCollector();

            //Distance
            bestMemorizer.BestDistanceParameter.ActualName = BestDistanceParameter.Name;
            bestMemorizer.DistanceParameter.ActualName     = DistanceParameter.Name;
            bestMemorizer.DistanceParameter.Depth          = DistanceParameter.Depth;

            calculator.DistanceParameter.ActualName        = DistanceParameter.Name;
            calculator.DistanceParameter.Depth             = DistanceParameter.Depth;
            calculator.BestDistanceParameter.ActualName    = CurrentBestDistanceParameter.Name;
            calculator.AverageDistanceParameter.ActualName = CurrentAverageDistanceParameter.Name;
            calculator.WorstDistanceParameter.ActualName   = CurrentWorstDistanceParameter.Name;

            DataTableValuesCollector distanceDataTablesCollector = new DataTableValuesCollector();
            distanceDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("BestDistance", null, BestDistanceParameter.Name));
            distanceDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("CurrentBestDistance", null, CurrentBestDistanceParameter.Name));
            distanceDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("CurrentAverageDistance", null, CurrentAverageDistanceParameter.Name));
            distanceDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("CurrentWorstDistance", null, CurrentWorstDistanceParameter.Name));
            distanceDataTablesCollector.DataTableParameter.ActualName = DistancesParameter.Name;

            resultsCollector.CollectedValues.Add(new LookupParameter <DataTable>(DistancesParameter.Name));

            //Vehicles Utlized
            bestMemorizer.BestVehiclesUtilizedParameter.ActualName = BestVehiclesUtilizedParameter.Name;
            bestMemorizer.VehiclesUtilizedParameter.ActualName     = VehiclesUtilizedParameter.Name;
            bestMemorizer.VehiclesUtilizedParameter.Depth          = VehiclesUtilizedParameter.Depth;

            calculator.VehiclesUtilizedParameter.ActualName        = VehiclesUtilizedParameter.Name;
            calculator.VehiclesUtilizedParameter.Depth             = VehiclesUtilizedParameter.Depth;
            calculator.BestVehiclesUtilizedParameter.ActualName    = CurrentBestVehiclesUtilizedParameter.Name;
            calculator.AverageVehiclesUtilizedParameter.ActualName = CurrentAverageVehiclesUtilizedParameter.Name;
            calculator.WorstVehiclesUtilizedParameter.ActualName   = CurrentWorstVehiclesUtilizedParameter.Name;

            DataTableValuesCollector vehiclesUtilizedDataTablesCollector = new DataTableValuesCollector();
            vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("BestVehiclesUtilized", null, BestVehiclesUtilizedParameter.Name));
            vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("CurrentBestVehiclesUtilized", null, CurrentBestVehiclesUtilizedParameter.Name));
            vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("CurrentAverageVehiclesUtilized", null, CurrentAverageVehiclesUtilizedParameter.Name));
            vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("CurrentWorstVehiclesUtilized", null, CurrentWorstVehiclesUtilizedParameter.Name));
            vehiclesUtilizedDataTablesCollector.DataTableParameter.ActualName = VehiclesUtilizedValuesParameter.Name;

            resultsCollector.CollectedValues.Add(new LookupParameter <DataTable>(VehiclesUtilizedValuesParameter.Name));
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator                 = bestMemorizer;
            bestMemorizer.Successor                       = calculator;
            calculator.Successor                          = distanceDataTablesCollector;
            distanceDataTablesCollector.Successor         = vehiclesUtilizedDataTablesCollector;
            vehiclesUtilizedDataTablesCollector.Successor = resultsCollector;
            resultsCollector.Successor                    = null;
            #endregion

            Initialize();
        }
    public BestAverageWorstVRPToursAnalyzer()
      : base() {
      #region Create parameters
      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));

      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Distance", "The distance of the VRP solutions which should be analyzed."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestDistance", "The best distance value."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentBestDistance", "The current best distance value."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentAverageDistance", "The current average distance value of all solutions."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentWorstDistance", "The current worst distance value of all solutions."));
      Parameters.Add(new ValueLookupParameter<DataTable>("Distances", "The data table to store the current best, current average, current worst, best and best known distance value."));

      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("VehiclesUtilized", "The vehicles utilized of the VRP solutions which should be analyzed."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestVehiclesUtilized", "The best  vehicles utilized value."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentBestVehiclesUtilized", "The current best  vehicles utilized value."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentAverageVehiclesUtilized", "The current average  vehicles utilized value of all solutions."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentWorstVehiclesUtilized", "The current worst  vehicles utilized value of all solutions."));
      Parameters.Add(new ValueLookupParameter<DataTable>("VehiclesUtilizedValues", "The data table to store the current best, current average, current worst, best and best known vehicles utilized value."));

      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The results collection where the analysis values should be stored."));
      #endregion

      #region Create operators
      BestVRPToursMemorizer bestMemorizer = new BestVRPToursMemorizer();
      BestAverageWorstVRPToursCalculator calculator = new BestAverageWorstVRPToursCalculator();
      ResultsCollector resultsCollector = new ResultsCollector();

      //Distance
      bestMemorizer.BestDistanceParameter.ActualName = BestDistanceParameter.Name;
      bestMemorizer.DistanceParameter.ActualName = DistanceParameter.Name;
      bestMemorizer.DistanceParameter.Depth = DistanceParameter.Depth;

      calculator.DistanceParameter.ActualName = DistanceParameter.Name;
      calculator.DistanceParameter.Depth = DistanceParameter.Depth;
      calculator.BestDistanceParameter.ActualName = CurrentBestDistanceParameter.Name;
      calculator.AverageDistanceParameter.ActualName = CurrentAverageDistanceParameter.Name;
      calculator.WorstDistanceParameter.ActualName = CurrentWorstDistanceParameter.Name;

      DataTableValuesCollector distanceDataTablesCollector = new DataTableValuesCollector();
      distanceDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestDistance", null, BestDistanceParameter.Name));
      distanceDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentBestDistance", null, CurrentBestDistanceParameter.Name));
      distanceDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentAverageDistance", null, CurrentAverageDistanceParameter.Name));
      distanceDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentWorstDistance", null, CurrentWorstDistanceParameter.Name));
      distanceDataTablesCollector.DataTableParameter.ActualName = DistancesParameter.Name;

      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(DistancesParameter.Name));

      //Vehicles Utlized
      bestMemorizer.BestVehiclesUtilizedParameter.ActualName = BestVehiclesUtilizedParameter.Name;
      bestMemorizer.VehiclesUtilizedParameter.ActualName = VehiclesUtilizedParameter.Name;
      bestMemorizer.VehiclesUtilizedParameter.Depth = VehiclesUtilizedParameter.Depth;

      calculator.VehiclesUtilizedParameter.ActualName = VehiclesUtilizedParameter.Name;
      calculator.VehiclesUtilizedParameter.Depth = VehiclesUtilizedParameter.Depth;
      calculator.BestVehiclesUtilizedParameter.ActualName = CurrentBestVehiclesUtilizedParameter.Name;
      calculator.AverageVehiclesUtilizedParameter.ActualName = CurrentAverageVehiclesUtilizedParameter.Name;
      calculator.WorstVehiclesUtilizedParameter.ActualName = CurrentWorstVehiclesUtilizedParameter.Name;

      DataTableValuesCollector vehiclesUtilizedDataTablesCollector = new DataTableValuesCollector();
      vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestVehiclesUtilized", null, BestVehiclesUtilizedParameter.Name));
      vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentBestVehiclesUtilized", null, CurrentBestVehiclesUtilizedParameter.Name));
      vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentAverageVehiclesUtilized", null, CurrentAverageVehiclesUtilizedParameter.Name));
      vehiclesUtilizedDataTablesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentWorstVehiclesUtilized", null, CurrentWorstVehiclesUtilizedParameter.Name));
      vehiclesUtilizedDataTablesCollector.DataTableParameter.ActualName = VehiclesUtilizedValuesParameter.Name;

      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(VehiclesUtilizedValuesParameter.Name));
      #endregion

      #region Create operator graph
      OperatorGraph.InitialOperator = bestMemorizer;
      bestMemorizer.Successor = calculator;
      calculator.Successor = distanceDataTablesCollector;
      distanceDataTablesCollector.Successor = vehiclesUtilizedDataTablesCollector;
      vehiclesUtilizedDataTablesCollector.Successor = resultsCollector;
      resultsCollector.Successor = null;
      #endregion

      Initialize();
    }