Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/16 21:29:25 (8 years ago)
Author:
bburlacu
Message:

#1772: Update diversification operators (add extra evaluations to the evaluation counter, add the option for strict schema matching, add additional replacement ratio update rules.

File:
1 edited

Legend:

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

    r13480 r13496  
    5858    private const string ExclusiveMatchingParameterName = "ExclusiveMatching";
    5959    private const string UseAdaptiveReplacementRatioParameterName = "UseAdaptiveReplacementRatio";
     60    private const string StrictSchemaMatchingParameterName = "StrictSchemaMatching";
    6061    #endregion
    6162
     
    117118    public LookupParameter<IntValue> NumberOfChangedTreesParameter {
    118119      get { return (LookupParameter<IntValue>)Parameters[NumberOfChangedTreesParameterName]; }
     120    }
     121    public LookupParameter<BoolValue> StrictSchemaMatchingParameter {
     122      get { return (LookupParameter<BoolValue>)Parameters[StrictSchemaMatchingParameterName]; }
    119123    }
    120124    #endregion
     
    143147    [Storable]
    144148    private readonly UpdateEstimatedValuesOperator updateEstimatedValuesOperator;
     149
     150    [StorableHook(HookType.AfterDeserialization)]
     151    private void AfterDeserialization() {
     152      if (!Parameters.ContainsKey(StrictSchemaMatchingParameterName))
     153        Parameters.Add(new LookupParameter<BoolValue>(StrictSchemaMatchingParameterName));
     154    }
    145155
    146156    public SchemaEvaluator() {
     
    159169      Parameters.Add(new LookupParameter<DoubleLimit>(EstimationLimitsParameterName));
    160170      Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName));
     171      Parameters.Add(new LookupParameter<BoolValue>(StrictSchemaMatchingParameterName));
    161172      Parameters.Add(new LookupParameter<ISymbolicExpressionTreeManipulator>(MutatorParameterName));
    162173      Parameters.Add(new LookupParameter<ISymbolicExpressionTreeCrossover>(CrossoverParameterName));
     
    188199
    189200    public override IOperation Apply() {
     201      var strictSchemaMatching = StrictSchemaMatchingParameter.ActualValue.Value;
     202      if (strictSchemaMatching) {
     203        comp.MatchVariableWeights = true;
     204        comp.MatchConstantValues = true;
     205      } else {
     206        comp.MatchVariableWeights = false;
     207        comp.MatchConstantValues = false;
     208      }
     209
    190210      var individuals = ExecutionContext.Scope.SubScopes; // the scopes represent the individuals
    191211      var trees = individuals.Select(x => (ISymbolicExpressionTree)x.Variables["SymbolicExpressionTree"].Value).ToList();
    192       var qualities = individuals.Select(x => (DoubleValue)x.Variables["Quality"].Value).ToList();
    193212
    194213      var random = RandomParameter.ActualValue;
Note: See TracChangeset for help on using the changeset viewer.