public static OffspringSelectionGeneticAlgorithm CreateGpTimeSeriesSample() {
      var problem = new SymbolicTimeSeriesPrognosisSingleObjectiveProblem();
      problem.Name = "Symbolic time series prognosis problem (Mackey Glass t=17)";
      problem.ProblemData.Name = "Mackey Glass t=17";
      problem.MaximumSymbolicExpressionTreeLength.Value = 125;
      problem.MaximumSymbolicExpressionTreeDepth.Value = 12;
      problem.EvaluatorParameter.Value.HorizonParameter.Value.Value = 10;

      foreach (var symbol in problem.SymbolicExpressionTreeGrammar.Symbols) {
        if (symbol is Exponential || symbol is Logarithm) {
          symbol.Enabled = false;
        } else if (symbol is AutoregressiveTargetVariable) {
          symbol.Enabled = true;
          var autoRegressiveSymbol = symbol as AutoregressiveTargetVariable;
          autoRegressiveSymbol.MinLag = -30;
          autoRegressiveSymbol.MaxLag = -1;
        }
      }

      var osga = new OffspringSelectionGeneticAlgorithm();
      osga.Name = "Genetic Programming - Time Series Prediction (Mackey-Glass-17)";
      osga.Description = "A genetic programming algorithm for creating a time-series model for the Mackey-Glass-17 time series.";
      osga.Problem = problem;
      SamplesUtils.ConfigureOsGeneticAlgorithmParameters<GenderSpecificSelector, SubtreeCrossover, MultiSymbolicExpressionTreeManipulator>
        (osga, popSize: 100, elites: 1, maxGens: 25, mutationRate: 0.15);
      osga.MaximumSelectionPressure.Value = 100;
      return osga;

    }
 private OffspringSelectionGeneticAlgorithm(OffspringSelectionGeneticAlgorithm original, Cloner cloner)
     : base(original, cloner)
 {
     qualityAnalyzer             = cloner.Clone(original.qualityAnalyzer);
     selectionPressureAnalyzer   = cloner.Clone(original.selectionPressureAnalyzer);
     successfulOffspringAnalyzer = cloner.Clone(original.successfulOffspringAnalyzer);
     Initialize();
 }
    public OffspringSelectionGeneticAlgorithm CreateGeArtificialAntSample() {
      OffspringSelectionGeneticAlgorithm ga = new OffspringSelectionGeneticAlgorithm();

      #region Problem Configuration
      var problem = new HeuristicLab.Problems.GrammaticalEvolution.GEArtificialAntProblem();
      #endregion
      #region Algorithm Configuration
      ga.Name = "Grammatical Evolution - Artificial Ant (SantaFe)";
      ga.Description = "Grammatical evolution algorithm for solving a artificial ant problem";
      ga.Problem = problem;
      SamplesUtils.ConfigureOsGeneticAlgorithmParameters<GenderSpecificSelector, Encodings.IntegerVectorEncoding.SinglePointCrossover, Encodings.IntegerVectorEncoding.UniformOnePositionManipulator>(
        ga, 200, 1, 50, 0.05, 200);
      #endregion

      return ga;
    }
Ejemplo n.º 4
0
    public static OffspringSelectionGeneticAlgorithm CreateGpMultiplexerSample() {
      var problem = new HeuristicLab.Problems.GeneticProgramming.Boolean.MultiplexerProblem();
      problem.Name = "11-Multiplexer Problem";
      problem.Encoding.TreeLength = 50;
      problem.Encoding.TreeDepth = 50;

      var osga = new OffspringSelectionGeneticAlgorithm();
      osga.Name = "Genetic Programming - Multiplexer 11 Problem";
      osga.Description = "A genetic programming algorithm that solves the 11-bit multiplexer problem.";
      osga.Problem = problem;
      SamplesUtils.ConfigureOsGeneticAlgorithmParameters<GenderSpecificSelector, SubtreeCrossover, MultiSymbolicExpressionTreeManipulator>
        (osga, popSize: 100, elites: 1, maxGens: 50, mutationRate: 0.25);
      osga.MaximumSelectionPressure.Value = 200;
      return osga;

    }
    public OffspringSelectionGeneticAlgorithm CreateGeSymbolicRegressionSample() {
      var ga = new OffspringSelectionGeneticAlgorithm();

      #region Problem Configuration
      var problem = new HeuristicLab.Problems.GrammaticalEvolution.GESymbolicRegressionSingleObjectiveProblem();

      #endregion
      #region Algorithm Configuration
      ga.Name = "Grammatical Evolution - Symbolic Regression (Poly-10)";
      ga.Description = "Grammatical evolution algorithm for solving a symbolic regression problem problem";
      ga.Problem = problem;
      problem.Load(new PolyTen().GenerateRegressionData());

      // must occur after loading problem data because the grammar creates symbols for random constants once the data is loaded
      var consts = problem.SymbolicExpressionTreeGrammar.AllowedSymbols.OfType<Constant>().ToList();
      foreach (var c in consts) {
        problem.SymbolicExpressionTreeGrammar.RemoveSymbol(c);
      }

      SamplesUtils.ConfigureOsGeneticAlgorithmParameters<GenderSpecificSelector, Encodings.IntegerVectorEncoding.SinglePointCrossover, Encodings.IntegerVectorEncoding.UniformOnePositionManipulator>(
        ga, 1000, 1, 50, 0.05, 200);
      #endregion

      return ga;
    }
 private OffspringSelectionGeneticAlgorithm(OffspringSelectionGeneticAlgorithm original, Cloner cloner)
   : base(original, cloner) {
   qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
   selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
   successfulOffspringAnalyzer = cloner.Clone(original.successfulOffspringAnalyzer);
   Initialize();
 }