Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/24/16 21:53:06 (8 years ago)
Author:
bburlacu
Message:

#1772: Slight refactor of schema diversification operators to try to fix potential problems with serialization/cloning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/SchemaCreator.cs

    r13527 r13565  
    189189      }
    190190
    191       Func<double, double> rule;
    192191      var replacementRule = ReplacementRatioUpdateRuleParameter.Value.Value;
    193 
    194       switch (replacementRule) {
    195         case "f(x) = x": {
    196             rule = x => x;
    197             break;
    198           }
    199         case "f(x) = tanh(x)": {
    200             rule = x => Math.Tanh(x);
    201             break;
    202           }
    203         case "f(x) = tanh(2x)": {
    204             rule = x => Math.Tanh(2 * x);
    205             break;
    206           }
    207         case "f(x) = tanh(3x)": {
    208             rule = x => Math.Tanh(3 * x);
    209             break;
    210           }
    211         case "f(x) = tanh(4x)": {
    212             rule = x => Math.Tanh(4 * x);
    213             break;
    214           }
    215         case "f(x) = 1-sqrt(1-x)": {
    216             rule = x => 1 - Math.Sqrt(1 - x);
    217             break;
    218           }
    219         default:
    220           throw new ArgumentException("Unknown replacement rule");
    221       }
    222192
    223193      var evaluateSchemas = new OperationCollection();
     
    235205      #region create schemas and add subscopes representing the individuals
    236206      foreach (var schema in schemas) {
    237         evaluateSchemas.Add(ExecutionContext.CreateChildOperation(new SchemaEvaluator { Schema = schema, ReplacementRule = rule }, ExecutionContext.Scope));
     207        evaluateSchemas.Add(ExecutionContext.CreateChildOperation(new SchemaEvaluator { Schema = schema, ReplacementRule = replacementRule }, ExecutionContext.Scope));
    238208      }
    239209      #endregion
Note: See TracChangeset for help on using the changeset viewer.