Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/05/14 12:53:58 (10 years ago)
Author:
sawinkle
Message:

#2109: Fetched random number generator in Evaluator implementations from scope, so that the same results are produced using the same seed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/ArtificialAnt/GEArtificialAntEvaluator.cs

    r10071 r10280  
    6363      get { return (ILookupParameter<IGenotypeToPhenotypeMapper>)Parameters["GenotypeToPhenotypeMapper"]; }
    6464    }
     65    public ILookupParameter<IRandom> RandomParameter {
     66      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     67    }
    6568    #endregion
    6669
     
    7881      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionGrammar>("SymbolicExpressionTreeGrammar", "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));
    7982      Parameters.Add(new LookupParameter<IGenotypeToPhenotypeMapper>("GenotypeToPhenotypeMapper", "Maps the genotype (an integer vector) to the phenotype (a symbolic expression tree)."));
     83      Parameters.Add(new LookupParameter<IRandom>("Random", "Random number generator for the genotype creation and the genotype-to-phenotype mapping."));
    8084    }
    8185
    8286    public sealed override IOperation Apply() {
    83       SymbolicExpressionTree expression = GenotypeToPhenotypeMapperParameter.ActualValue.Map(
     87      SymbolicExpressionTree tree = GenotypeToPhenotypeMapperParameter.ActualValue.Map(
     88        RandomParameter.ActualValue,
    8489        SymbolicExpressionTreeGrammarParameter.ActualValue,
    8590        IntegerVectorParameter.ActualValue
    8691      );
    87       SymbolicExpressionTreeParameter.ActualValue = expression;
     92      SymbolicExpressionTreeParameter.ActualValue = tree;
    8893      BoolMatrix world = WorldParameter.ActualValue;
    8994      IntValue maxTimeSteps = MaxTimeStepsParameter.ActualValue;
     
    9297      interpreter.MaxTimeSteps = maxTimeSteps.Value;
    9398      interpreter.World = world;
    94       interpreter.Expression = expression;
     99      interpreter.Expression = tree;
    95100      interpreter.Run();
    96101
Note: See TracChangeset for help on using the changeset viewer.