Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/15/20 13:53:11 (4 years ago)
Author:
mkommend
Message:

#2971: Added first draft of results implementation and problem adaptation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs

    r17655 r17745  
    105105    }
    106106
    107     public override void Analyze(ISymbolicExpressionTree[] trees, double[] qualities, ResultCollection results, IRandom random) {
    108       // find the tree with the best quality
    109       double maxQuality = double.NegativeInfinity;
    110       ISymbolicExpressionTree bestTree = null;
    111       for (int i = 0; i < qualities.Length; i++) {
    112         if (qualities[i] > maxQuality) {
    113           maxQuality = qualities[i];
    114           bestTree = trees[i];
    115         }
    116       }
     107    //TODO: change to new analyze interface//TODO: change to new analyze interface
     108    //public override void Analyze(ISymbolicExpressionTree[] trees, double[] qualities, ResultCollection results, IRandom random) {
     109    //  // find the tree with the best quality
     110    //  double maxQuality = double.NegativeInfinity;
     111    //  ISymbolicExpressionTree bestTree = null;
     112    //  for (int i = 0; i < qualities.Length; i++) {
     113    //    if (qualities[i] > maxQuality) {
     114    //      maxQuality = qualities[i];
     115    //      bestTree = trees[i];
     116    //    }
     117    //  }
    117118
    118       // create a solution instance
    119       var bestSolution = new Solution(bestTree, RobocodePath, NrOfRounds, Enemies);
     119    //  // create a solution instance
     120    //  var bestSolution = new Solution(bestTree, RobocodePath, NrOfRounds, Enemies);
    120121
    121       // also add the best solution as a result to the result collection
    122       // or alternatively update the existing result
    123       if (!results.ContainsKey("BestSolution")) {
    124         results.Add(new Result("BestSolution", "The best tank program", bestSolution));
    125       } else {
    126         results["BestSolution"].Value = bestSolution;
    127       }
    128     }
     122    //  // also add the best solution as a result to the result collection
     123    //  // or alternatively update the existing result
     124    //  if (!results.ContainsKey("BestSolution")) {
     125    //    results.Add(new Result("BestSolution", "The best tank program", bestSolution));
     126    //  } else {
     127    //    results["BestSolution"].Value = bestSolution;
     128    //  }
     129    //}
    129130
    130131    private void RegisterEventHandlers() {
Note: See TracChangeset for help on using the changeset viewer.