Exemplo n.º 1
0
    public QualityAnalyzer()
      : base() {
      #region Create parameters
      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestQuality", "The best quality value found in the current run."));
      Parameters.Add(new ValueLookupParameter<DataTable>("Qualities", "The data table to store the current best, current average, current worst, best and best known quality value."));
      Parameters.Add(new ValueLookupParameter<DoubleValue>("AbsoluteDifferenceBestKnownToBest", "The absolute difference of the best known quality value to the best quality value."));
      Parameters.Add(new ValueLookupParameter<PercentValue>("RelativeDifferenceBestKnownToBest", "The relative difference of the best known quality value to the best quality value."));
      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The results collection where the analysis values should be stored."));
      #endregion

      #region Create operators
      BestQualityMemorizer bestQualityMemorizer = new BestQualityMemorizer();
      BestQualityMemorizer bestKnownQualityMemorizer = new BestQualityMemorizer();
      DataTableValuesCollector dataTableValuesCollector = new DataTableValuesCollector();
      QualityDifferenceCalculator qualityDifferenceCalculator = new QualityDifferenceCalculator();
      ResultsCollector resultsCollector = new ResultsCollector();

      bestQualityMemorizer.BestQualityParameter.ActualName = BestQualityParameter.Name;
      bestQualityMemorizer.MaximizationParameter.ActualName = MaximizationParameter.Name;
      bestQualityMemorizer.QualityParameter.ActualName = QualityParameter.Name;
      bestQualityMemorizer.QualityParameter.Depth = QualityParameter.Depth;

      bestKnownQualityMemorizer.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
      bestKnownQualityMemorizer.MaximizationParameter.ActualName = MaximizationParameter.Name;
      bestKnownQualityMemorizer.QualityParameter.ActualName = QualityParameter.Name;
      bestKnownQualityMemorizer.QualityParameter.Depth = QualityParameter.Depth;

      dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestQuality", null, BestQualityParameter.Name));
      dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestKnownQuality", null, BestKnownQualityParameter.Name));
      dataTableValuesCollector.CollectedValues.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", null, QualityParameter.Name));
      ((ScopeTreeLookupParameter<DoubleValue>)dataTableValuesCollector.CollectedValues["Quality"]).Depth = QualityParameter.Depth;
      dataTableValuesCollector.DataTableParameter.ActualName = QualitiesParameter.Name;

      qualityDifferenceCalculator.AbsoluteDifferenceParameter.ActualName = AbsoluteDifferenceBestKnownToBestParameter.Name;
      qualityDifferenceCalculator.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
      qualityDifferenceCalculator.RelativeDifferenceParameter.ActualName = RelativeDifferenceBestKnownToBestParameter.Name;
      qualityDifferenceCalculator.SecondQualityParameter.ActualName = BestQualityParameter.Name;

      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestQuality", null, BestQualityParameter.Name));
      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestKnownQuality", null, BestKnownQualityParameter.Name));
      resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", null, QualityParameter.Name));
      ((ScopeTreeLookupParameter<DoubleValue>)resultsCollector.CollectedValues["Quality"]).Depth = QualityParameter.Depth;
      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("AbsoluteDifferenceBestKnownToBest", null, AbsoluteDifferenceBestKnownToBestParameter.Name));
      resultsCollector.CollectedValues.Add(new LookupParameter<PercentValue>("RelativeDifferenceBestKnownToBest", null, RelativeDifferenceBestKnownToBestParameter.Name));
      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(QualitiesParameter.Name));
      resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
      #endregion

      #region Create operator graph
      OperatorGraph.InitialOperator = bestQualityMemorizer;
      bestQualityMemorizer.Successor = bestKnownQualityMemorizer;
      bestKnownQualityMemorizer.Successor = dataTableValuesCollector;
      dataTableValuesCollector.Successor = qualityDifferenceCalculator;
      qualityDifferenceCalculator.Successor = resultsCollector;
      resultsCollector.Successor = null;
      #endregion

      Initialize();
    }
Exemplo n.º 2
0
        public QualityAnalyzer()
            : base()
        {
            #region Create parameters
            Parameters.Add(new ValueLookupParameter <BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
            Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", "The value which represents the quality of a solution."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("BestQuality", "The best quality value found in the current run."));
            Parameters.Add(new ValueLookupParameter <DataTable>("Qualities", "The data table to store the current best, current average, current worst, best and best known quality value."));
            Parameters.Add(new ValueLookupParameter <DoubleValue>("AbsoluteDifferenceBestKnownToBest", "The absolute difference of the best known quality value to the best quality value."));
            Parameters.Add(new ValueLookupParameter <PercentValue>("RelativeDifferenceBestKnownToBest", "The relative difference of the best known quality value to the best quality value."));
            Parameters.Add(new ValueLookupParameter <VariableCollection>("Results", "The results collection where the analysis values should be stored."));
            #endregion

            #region Create operators
            BestQualityMemorizer        bestQualityMemorizer        = new BestQualityMemorizer();
            BestQualityMemorizer        bestKnownQualityMemorizer   = new BestQualityMemorizer();
            DataTableValuesCollector    dataTableValuesCollector    = new DataTableValuesCollector();
            QualityDifferenceCalculator qualityDifferenceCalculator = new QualityDifferenceCalculator();
            ResultsCollector            resultsCollector            = new ResultsCollector();

            bestQualityMemorizer.BestQualityParameter.ActualName  = BestQualityParameter.Name;
            bestQualityMemorizer.MaximizationParameter.ActualName = MaximizationParameter.Name;
            bestQualityMemorizer.QualityParameter.ActualName      = QualityParameter.Name;
            bestQualityMemorizer.QualityParameter.Depth           = QualityParameter.Depth;

            bestKnownQualityMemorizer.BestQualityParameter.ActualName  = BestKnownQualityParameter.Name;
            bestKnownQualityMemorizer.MaximizationParameter.ActualName = MaximizationParameter.Name;
            bestKnownQualityMemorizer.QualityParameter.ActualName      = QualityParameter.Name;
            bestKnownQualityMemorizer.QualityParameter.Depth           = QualityParameter.Depth;

            dataTableValuesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("BestQuality", null, BestQualityParameter.Name));
            dataTableValuesCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("BestKnownQuality", null, BestKnownQualityParameter.Name));
            dataTableValuesCollector.CollectedValues.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", null, QualityParameter.Name));
            ((ScopeTreeLookupParameter <DoubleValue>)dataTableValuesCollector.CollectedValues["Quality"]).Depth = QualityParameter.Depth;
            dataTableValuesCollector.DataTableParameter.ActualName = QualitiesParameter.Name;

            qualityDifferenceCalculator.AbsoluteDifferenceParameter.ActualName = AbsoluteDifferenceBestKnownToBestParameter.Name;
            qualityDifferenceCalculator.FirstQualityParameter.ActualName       = BestKnownQualityParameter.Name;
            qualityDifferenceCalculator.RelativeDifferenceParameter.ActualName = RelativeDifferenceBestKnownToBestParameter.Name;
            qualityDifferenceCalculator.SecondQualityParameter.ActualName      = BestQualityParameter.Name;

            resultsCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("BestQuality", null, BestQualityParameter.Name));
            resultsCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("BestKnownQuality", null, BestKnownQualityParameter.Name));
            resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", null, QualityParameter.Name));
            ((ScopeTreeLookupParameter <DoubleValue>)resultsCollector.CollectedValues["Quality"]).Depth = QualityParameter.Depth;
            resultsCollector.CollectedValues.Add(new LookupParameter <DoubleValue>("AbsoluteDifferenceBestKnownToBest", null, AbsoluteDifferenceBestKnownToBestParameter.Name));
            resultsCollector.CollectedValues.Add(new LookupParameter <PercentValue>("RelativeDifferenceBestKnownToBest", null, RelativeDifferenceBestKnownToBestParameter.Name));
            resultsCollector.CollectedValues.Add(new LookupParameter <DataTable>(QualitiesParameter.Name));
            resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
            #endregion

            #region Create operator graph
            OperatorGraph.InitialOperator         = bestQualityMemorizer;
            bestQualityMemorizer.Successor        = bestKnownQualityMemorizer;
            bestKnownQualityMemorizer.Successor   = dataTableValuesCollector;
            dataTableValuesCollector.Successor    = qualityDifferenceCalculator;
            qualityDifferenceCalculator.Successor = resultsCollector;
            resultsCollector.Successor            = null;
            #endregion

            Initialize();
        }
Exemplo n.º 3
0
 protected QualityDifferenceCalculator(QualityDifferenceCalculator original, Cloner cloner) : base(original, cloner)
 {
 }
 protected QualityDifferenceCalculator(QualityDifferenceCalculator original, Cloner cloner) : base(original, cloner) { }