Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/31/10 14:26:45 (14 years ago)
Author:
gkronber
Message:

Extracted view for artificial ant problem into a separate plugin/project. #952 (Artificial Ant Problem for 3.3)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Evaluator.cs

    r3223 r3239  
    4040      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters["SymbolicExpressionTree"]; }
    4141    }
     42    public ILookupParameter<BoolMatrix> WorldParameter {
     43      get { return (ILookupParameter<BoolMatrix>)Parameters["World"]; }
     44    }
     45    public ILookupParameter<IntValue> MaxTimeStepsParameter {
     46      get { return (ILookupParameter<IntValue>)Parameters["MaxTimeSteps"]; }
     47    }
     48
    4249    public Evaluator()
    4350      : base() {
    4451      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the evaluated artificial ant solution."));
    4552      Parameters.Add(new LookupParameter<SymbolicExpressionTree>("SymbolicExpressionTree", "The artificial ant solution encoded as a symbolic expression tree that should be evaluated"));
     53      Parameters.Add(new LookupParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items."));
     54      Parameters.Add(new LookupParameter<IntValue>("MaxTimeSteps", "The maximal number of time steps that the artificial ant should be simulated."));
    4655    }
    4756
    4857    public sealed override IOperation Apply() {
     58      SymbolicExpressionTree expression = SymbolicExpressionTreeParameter.ActualValue;
     59      BoolMatrix world = WorldParameter.ActualValue;
     60      IntValue maxTimeSteps = MaxTimeStepsParameter.ActualValue;
    4961
    50       SymbolicExpressionTree solution = SymbolicExpressionTreeParameter.ActualValue;
    5162      AntInterpreter interpreter = new AntInterpreter();
    52       interpreter.MaxTimeSteps = 600;
    53       interpreter.Run(solution);
     63      interpreter.MaxTimeSteps = maxTimeSteps.Value;
     64      interpreter.World = world;
     65      interpreter.Expression = expression;
     66      interpreter.Run();
    5467
    5568      QualityParameter.ActualValue = new DoubleValue(interpreter.FoodEaten);
Note: See TracChangeset for help on using the changeset viewer.