Ignore:
Timestamp:
11/19/15 11:42:02 (4 years ago)
Author:
gkronber
Message:

#2472: merged r12921,r12936:12938,r12940,r12947,r13055:13058,r13163,r13267,r13269 from trunk to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPMultiplexerSampleTest.cs

    r12009 r13280  
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Persistence.Default.Xml;
    26 using HeuristicLab.Problems.DataAnalysis.Symbolic;
    27 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    28 using HeuristicLab.Problems.Instances.DataAnalysis;
    2926using HeuristicLab.Selection;
    3027using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    5148      SamplesUtils.RunAlgorithm(osga);
    5249
    53       Assert.AreEqual(0.125, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8);
    54       Assert.AreEqual(0.237275390625, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8);
    55       Assert.AreEqual(1.181640625, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8);
    56       Assert.AreEqual(105500, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"));
     50      Assert.AreEqual(1856, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8);
     51      Assert.AreEqual(1784.76, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8);
     52      Assert.AreEqual(1536, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8);
     53      Assert.AreEqual(66900, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"));
    5754    }
    5855
    5956    public static OffspringSelectionGeneticAlgorithm CreateGpMultiplexerSample() {
    60       var instanceProvider = new RegressionCSVInstanceProvider();
    61       var regressionImportType = new RegressionImportType();
    62       regressionImportType.TargetVariable = "output";
    63       regressionImportType.TrainingPercentage = 100;
    64       var dataAnalysisCSVFormat = new DataAnalysisCSVFormat();
    65       dataAnalysisCSVFormat.Separator = ',';
    66       dataAnalysisCSVFormat.VariableNamesAvailable = true;
    67 
    68       var problemData = instanceProvider.ImportData(@"Test Resources\Multiplexer11.csv", regressionImportType, dataAnalysisCSVFormat);
    69       problemData.Name = "11-Multiplexer";
    70 
    71       var problem = new SymbolicRegressionSingleObjectiveProblem();
     57      var problem = new HeuristicLab.Problems.GeneticProgramming.Boolean.MultiplexerProblem();
    7258      problem.Name = "11-Multiplexer Problem";
    73       problem.ProblemData = problemData;
    74       problem.MaximumSymbolicExpressionTreeLength.Value = 50;
    75       problem.MaximumSymbolicExpressionTreeDepth.Value = 50;
    76       problem.EvaluatorParameter.Value = new SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator();
    77       problem.ApplyLinearScaling.Value = false;
    78 
    79 
    80       var grammar = new FullFunctionalExpressionGrammar();
    81       problem.SymbolicExpressionTreeGrammar = grammar;
    82       foreach (var symbol in grammar.Symbols) {
    83         if (symbol is ProgramRootSymbol) symbol.Enabled = true;
    84         else if (symbol is StartSymbol) symbol.Enabled = true;
    85         else if (symbol is IfThenElse) symbol.Enabled = true;
    86         else if (symbol is And) symbol.Enabled = true;
    87         else if (symbol is Or) symbol.Enabled = true;
    88         else if (symbol is Xor) symbol.Enabled = true;
    89         else if (symbol.GetType() == typeof(Variable)) {
    90           //necessary as there are multiple classes derived from Variable (e.g., VariableCondition)
    91           symbol.Enabled = true;
    92           var variableSymbol = (Variable)symbol;
    93           variableSymbol.MultiplicativeWeightManipulatorSigma = 0.0;
    94           variableSymbol.WeightManipulatorSigma = 0.0;
    95           variableSymbol.WeightSigma = 0.0;
    96         } else symbol.Enabled = false;
    97       }
     59      problem.Encoding.TreeLength = 50;
     60      problem.Encoding.TreeDepth = 50;
    9861
    9962      var osga = new OffspringSelectionGeneticAlgorithm();
Note: See TracChangeset for help on using the changeset viewer.