Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/13/13 12:11:18 (11 years ago)
Author:
ascheibe
Message:

#2069 removed dead code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/BestSolutionAnalyzer.cs

    r9790 r9880  
    2020#endregion
    2121
    22 
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    3231namespace HeuristicLab.Problems.Robocode {
    3332  [StorableClass]
    34   [Item("Best Tank program Analyzer",
     33  [Item("Best Tank Program Analyzer",
    3534        "Analyzer that stores the best tank program.")]
    36   public class BestSolutionAnalyzer : SingleSuccessorOperator,
    37     ISymbolicExpressionTreeAnalyzer {
    38     #region parameter names
     35  public class BestSolutionAnalyzer : SingleSuccessorOperator, ISymbolicExpressionTreeAnalyzer {
    3936    private const string QualityParameterName = "Quality";
    40     private const string SymbolicExpressionTreeParameterName =
    41       "TankProgram";
    42     private const string MovesParameterName = "Moves";
    43     private const string ShotsParameterName = "Shots";
     37    private const string SymbolicExpressionTreeParameterName = "TankProgram";
    4438    private const string BestSolutionParameterName = "Best solution";
    4539    private const string ResultsParameterName = "Results";
    4640    private const string RobocodePathParamaterName = "Path";
    47     private const string CoevolutionParameterName = "Coevolution";
    48     #endregion
    4941
     42    public bool EnabledByDefault {
     43      get { return true; }
     44    }
    5045
    51     #region parameters
     46    #region Parameters
    5247    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
    53       get {
    54         return (IScopeTreeLookupParameter<DoubleValue>)
    55                   Parameters[QualityParameterName];
    56       }
     48      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[QualityParameterName]; }
    5749    }
    5850    public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
    59       get {
    60         return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)
    61                   Parameters[SymbolicExpressionTreeParameterName];
    62       }
     51      get { return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    6352    }
    64     //public ILookupParameter<IntValue> MovesParameter
    65     //{
    66     //    get
    67     //    {
    68     //        return (ILookupParameter<IntValue>)
    69     //                  Parameters[MovesParameterName];
    70     //    }
    71     //}
    72     //public ILookupParameter<IntValue> ShotsParameter
    73     //{
    74     //    get
    75     //    {
    76     //        return (ILookupParameter<IntValue>)
    77     //                  Parameters[ShotsParameterName];
    78     //    }
    79     //}
    8053    public ILookupParameter<Solution> BestSolutionParameter {
    81       get {
    82         return (ILookupParameter<Solution>)
    83                   Parameters[BestSolutionParameterName];
    84       }
     54      get { return (ILookupParameter<Solution>)Parameters[BestSolutionParameterName]; }
    8555    }
    8656    public ILookupParameter<ResultCollection> ResultParameter {
    87       get {
    88         return (ILookupParameter<ResultCollection>)
    89                   Parameters[ResultsParameterName];
    90       }
     57      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
    9158    }
    9259    public ILookupParameter<StringValue> RobocodePathParameter {
    93       get {
    94         return (ILookupParameter<StringValue>)
    95             Parameters[RobocodePathParamaterName];
    96       }
    97     }
    98     public ILookupParameter<BoolValue> CoevolutionParameter {
    99       get {
    100         return (ILookupParameter<BoolValue>)
    101             Parameters[CoevolutionParameterName];
    102       }
     60      get { return (ILookupParameter<StringValue>)Parameters[RobocodePathParamaterName]; }
    10361    }
    10462    #endregion
     
    10664    [StorableConstructor]
    10765    protected BestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
    108     protected BestSolutionAnalyzer(BestSolutionAnalyzer original,
    109                                    Cloner cloner)
    110       : base(original, cloner) {
    111     }
     66    protected BestSolutionAnalyzer(BestSolutionAnalyzer original, Cloner cloner)
     67      : base(original, cloner) { }
    11268
    11369    public BestSolutionAnalyzer() {
    114       Parameters.Add(
    115         new ScopeTreeLookupParameter<DoubleValue>(
    116           QualityParameterName,
    117           "The solution quality of the tank program."));
    118       Parameters.Add(
    119         new ScopeTreeLookupParameter<ISymbolicExpressionTree>(
    120           SymbolicExpressionTreeParameterName,
    121           "The tank program to evaluate represented " +
    122           "as symbolic expression tree."));
    123       Parameters.Add(
    124         new LookupParameter<Solution>(
    125           BestSolutionParameterName, "The best tank program."));
    126       //Parameters.Add(
    127       //  new LookupParameter<IntValue>(
    128       //    MovesParameterName, "The number of moves made."));
    129       //Parameters.Add(
    130       //  new LookupParameter<IntValue>(
    131       //    ShotsParameterName, "The shots made."));
    132       Parameters.Add(
    133         new LookupParameter<ResultCollection>(
    134           ResultsParameterName, "The result collection of the algorithm."));
    135       Parameters.Add(
    136         new LookupParameter<StringValue>(
    137           RobocodePathParamaterName,
    138           "Path of the Robocode installation."));
    139       Parameters.Add(
    140           new LookupParameter<BoolValue>(
    141               CoevolutionParameterName,
    142               "Use Coevolution"));
     70      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityParameterName, "The solution quality of the tank program."));
     71      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The tank program to evaluate represented as symbolic expression tree."));
     72      Parameters.Add(new LookupParameter<Solution>(BestSolutionParameterName, "The best tank program."));
     73      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection of the algorithm."));
     74      Parameters.Add(new LookupParameter<StringValue>(RobocodePathParamaterName, "Path of the Robocode installation."));
    14375    }
    14476
     
    15991      }
    16092
    161       var coevolution = CoevolutionParameter.ActualValue.Value;
    162       double actualQuality = 0;
    163 
    164       if (coevolution)
    165         actualQuality = Interpreter.EvaluateTankProgram(bestTree, null, RobocodePathParameter.ActualValue.Value);
    166 
    16793      // create a solution instance
    168       //int shots = ShotsParameter.ActualValue.Value;
    169       //int moves = MovesParameter.ActualValue.Value;
    170       var bestSolution = new Solution(bestTree, RobocodePathParameter.ActualValue.Value);//, moves, shots);
     94      var bestSolution = new Solution(bestTree, RobocodePathParameter.ActualValue.Value);
    17195      // store the new solution in the best solution parameter
    17296      BestSolutionParameter.ActualValue = bestSolution;
     
    176100      var resultCollection = ResultParameter.ActualValue;
    177101      if (!resultCollection.ContainsKey(BestSolutionParameterName)) {
    178         resultCollection.Add(
    179           new Result(BestSolutionParameterName,
    180                      "The best tank program", bestSolution));
    181         //if(coevolution)
    182         //    resultCollection.Add(
    183         //        new Result("Actual Quality",
    184         //            "The actual quality of the best program", new DoubleValue(actualQuality)));
     102        resultCollection.Add(new Result(BestSolutionParameterName, "The best tank program", bestSolution));
    185103      } else {
    186104        resultCollection[BestSolutionParameterName].Value = bestSolution;
    187105      }
    188106
    189       if (coevolution) {
    190         if (!resultCollection.ContainsKey("Actual Quality")) {
    191           resultCollection.Add(
    192               new Result("Actual Quality",
    193                   "The actual quality of the best program", new DoubleValue(actualQuality)));
    194         } else {
    195           resultCollection["Actual Quality"].Value = new DoubleValue(actualQuality);
    196         }
    197       }
    198 
    199       // important return base.Apply() to make sure the
    200       // next operator is queued for execution
    201107      return base.Apply();
    202108    }
     
    205111      return new BestSolutionAnalyzer(this, cloner);
    206112    }
    207 
    208     // override this property to indicate that this analyzer
    209     // should be enabled by default in the algorithm
    210     public bool EnabledByDefault {
    211       get { return true; }
    212     }
    213113  }
    214114}
Note: See TracChangeset for help on using the changeset viewer.