Exemplo n.º 1
0
 private RAPGA(RAPGA original, Cloner cloner)
     : base(original, cloner)
 {
     qualityAnalyzer           = cloner.Clone(original.qualityAnalyzer);
     populationSizeAnalyzer    = cloner.Clone(original.populationSizeAnalyzer);
     offspringSuccessAnalyzer  = cloner.Clone(original.offspringSuccessAnalyzer);
     selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
     Initialize();
 }
Exemplo n.º 2
0
 private OffspringSuccessAnalyzer(OffspringSuccessAnalyzer original, Cloner cloner) : base(original, cloner)
 {
 }
Exemplo n.º 3
0
        public RAPGA()
            : base()
        {
            Parameters.Add(new ValueParameter <IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
            Parameters.Add(new ValueParameter <BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
            Parameters.Add(new ValueParameter <IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
            Parameters.Add(new ValueParameter <IntValue>("MinimumPopulationSize", "The minimum size of the population of solutions.", new IntValue(2)));
            Parameters.Add(new ValueParameter <IntValue>("MaximumPopulationSize", "The maximum size of the population of solutions.", new IntValue(300)));
            Parameters.Add(new ValueParameter <DoubleValue>("ComparisonFactor", "The comparison factor.", new DoubleValue(0.0)));
            Parameters.Add(new ValueParameter <IntValue>("Effort", "The maximum number of offspring created in each generation.", new IntValue(1000)));
            Parameters.Add(new ValueParameter <IntValue>("BatchSize", "The number of children that should be created during one iteration of the offspring creation process.", new IntValue(10)));
            Parameters.Add(new ConstrainedValueParameter <ISelector>("Selector", "The operator used to select solutions for reproduction."));
            Parameters.Add(new ConstrainedValueParameter <ICrossover>("Crossover", "The operator used to cross solutions."));
            Parameters.Add(new ValueParameter <PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
            Parameters.Add(new OptionalConstrainedValueParameter <IManipulator>("Mutator", "The operator used to mutate solutions."));
            Parameters.Add(new ValueParameter <IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
            Parameters.Add(new FixedValueParameter <BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false))
            {
                Hidden = true
            });
            Parameters.Add(new ValueParameter <MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
            Parameters.Add(new ValueParameter <IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
            Parameters.Add(new ConstrainedValueParameter <ISolutionSimilarityCalculator>("SimilarityCalculator", "The operator used to calculate the similarity between two solutions."));

            RandomCreator    randomCreator    = new RandomCreator();
            SolutionsCreator solutionsCreator = new SolutionsCreator();
            SubScopesCounter subScopesCounter = new SubScopesCounter();
            ResultsCollector resultsCollector = new ResultsCollector();
            RAPGAMainLoop    mainLoop         = new RAPGAMainLoop();

            OperatorGraph.InitialOperator = randomCreator;

            randomCreator.RandomParameter.ActualName          = "Random";
            randomCreator.SeedParameter.ActualName            = SeedParameter.Name;
            randomCreator.SeedParameter.Value                 = null;
            randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
            randomCreator.SetSeedRandomlyParameter.Value      = null;
            randomCreator.Successor = solutionsCreator;

            solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
            solutionsCreator.Successor = subScopesCounter;

            subScopesCounter.Name = "Initialize EvaluatedSolutions";
            subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
            subScopesCounter.Successor = resultsCollector;

            resultsCollector.CollectedValues.Add(new LookupParameter <IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
            resultsCollector.ResultsParameter.ActualName = "Results";
            resultsCollector.Successor = mainLoop;

            mainLoop.SelectorParameter.ActualName            = SelectorParameter.Name;
            mainLoop.CrossoverParameter.ActualName           = CrossoverParameter.Name;
            mainLoop.ElitesParameter.ActualName              = ElitesParameter.Name;
            mainLoop.ReevaluateElitesParameter.ActualName    = ReevaluateElitesParameter.Name;
            mainLoop.MaximumGenerationsParameter.ActualName  = MaximumGenerationsParameter.Name;
            mainLoop.MutatorParameter.ActualName             = MutatorParameter.Name;
            mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
            mainLoop.RandomParameter.ActualName              = RandomCreator.RandomParameter.ActualName;
            mainLoop.AnalyzerParameter.ActualName            = AnalyzerParameter.Name;
            mainLoop.EvaluatedSolutionsParameter.ActualName  = "EvaluatedSolutions";
            mainLoop.PopulationSizeParameter.ActualName      = PopulationSizeParameter.Name;
            mainLoop.ResultsParameter.ActualName             = "Results";

            foreach (ISelector selector in ApplicationManager.Manager.GetInstances <ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
            {
                SelectorParameter.ValidValues.Add(selector);
            }
            ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));

            if (proportionalSelector != null)
            {
                SelectorParameter.Value = proportionalSelector;
            }
            ParameterizeSelectors();

            qualityAnalyzer           = new BestAverageWorstQualityAnalyzer();
            populationSizeAnalyzer    = new PopulationSizeAnalyzer();
            offspringSuccessAnalyzer  = new OffspringSuccessAnalyzer();
            selectionPressureAnalyzer = new SelectionPressureAnalyzer();
            ParameterizeAnalyzers();
            UpdateAnalyzers();

            Initialize();
        }
Exemplo n.º 4
0
    public RAPGA()
      : base() {
      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
      Parameters.Add(new ValueParameter<IntValue>("MinimumPopulationSize", "The minimum size of the population of solutions.", new IntValue(2)));
      Parameters.Add(new ValueParameter<IntValue>("MaximumPopulationSize", "The maximum size of the population of solutions.", new IntValue(300)));
      Parameters.Add(new ValueParameter<DoubleValue>("ComparisonFactor", "The comparison factor.", new DoubleValue(0.0)));
      Parameters.Add(new ValueParameter<IntValue>("Effort", "The maximum number of offspring created in each generation.", new IntValue(1000)));
      Parameters.Add(new ValueParameter<IntValue>("BatchSize", "The number of children that should be created during one iteration of the offspring creation process.", new IntValue(10)));
      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
      Parameters.Add(new ConstrainedValueParameter<ISolutionSimilarityCalculator>("SimilarityCalculator", "The operator used to calculate the similarity between two solutions."));

      RandomCreator randomCreator = new RandomCreator();
      SolutionsCreator solutionsCreator = new SolutionsCreator();
      SubScopesCounter subScopesCounter = new SubScopesCounter();
      ResultsCollector resultsCollector = new ResultsCollector();
      RAPGAMainLoop mainLoop = new RAPGAMainLoop();
      OperatorGraph.InitialOperator = randomCreator;

      randomCreator.RandomParameter.ActualName = "Random";
      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
      randomCreator.SeedParameter.Value = null;
      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
      randomCreator.SetSeedRandomlyParameter.Value = null;
      randomCreator.Successor = solutionsCreator;

      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
      solutionsCreator.Successor = subScopesCounter;

      subScopesCounter.Name = "Initialize EvaluatedSolutions";
      subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
      subScopesCounter.Successor = resultsCollector;

      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
      resultsCollector.ResultsParameter.ActualName = "Results";
      resultsCollector.Successor = mainLoop;

      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
      mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
      mainLoop.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
      mainLoop.ResultsParameter.ActualName = "Results";

      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
        SelectorParameter.ValidValues.Add(selector);
      ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
      ParameterizeSelectors();

      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
      populationSizeAnalyzer = new PopulationSizeAnalyzer();
      offspringSuccessAnalyzer = new OffspringSuccessAnalyzer();
      selectionPressureAnalyzer = new SelectionPressureAnalyzer();
      ParameterizeAnalyzers();
      UpdateAnalyzers();

      Initialize();
    }
Exemplo n.º 5
0
 private RAPGA(RAPGA original, Cloner cloner)
   : base(original, cloner) {
   qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
   populationSizeAnalyzer = cloner.Clone(original.populationSizeAnalyzer);
   offspringSuccessAnalyzer = cloner.Clone(original.offspringSuccessAnalyzer);
   selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
   Initialize();
 }
 private OffspringSuccessAnalyzer(OffspringSuccessAnalyzer original, Cloner cloner) : base(original, cloner) { }