Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/04/19 17:31:54 (5 years ago)
Author:
mkommend
Message:

#2521: Added cancellation token to evaluate function of problems.

Location:
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3
Files:
6 edited

Legend:

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

    r17270 r17320  
    2323using System.Diagnostics.Contracts;
    2424using System.Linq;
     25using System.Threading;
    2526using HEAL.Attic;
    2627using HeuristicLab.Common;
     
    134135
    135136
    136     public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) {
     137    public override double Evaluate(ISymbolicExpressionTree tree, IRandom random, CancellationToken cancellationToken) {
    137138      var interpreter = new Interpreter(tree, World, MaxTimeSteps);
    138139      interpreter.Run();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs

    r17270 r17320  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HEAL.Attic;
    2627using HeuristicLab.Common;
     
    8990
    9091
    91     public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) {
     92    public override double Evaluate(ISymbolicExpressionTree tree, IRandom random, CancellationToken cancellationToken) {
    9293      // Doesn't use classes from HeuristicLab.Problems.DataAnalysis.Symbolic to make sure that the implementation can be fully understood easily.
    9394      // HeuristicLab.Problems.DataAnalysis.Symbolic would already provide all the necessary functionality (esp. interpreter) but at a much higher complexity.
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs

    r17270 r17320  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HEAL.Attic;
    2627using HeuristicLab.Common;
     
    103104
    104105
    105     public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) {
     106    public override double Evaluate(ISymbolicExpressionTree tree, IRandom random, CancellationToken cancellationToken) {
    106107      if (NumberOfBits <= 0) throw new NotSupportedException("Number of bits must be larger than zero.");
    107108      if (NumberOfBits > 10) throw new NotSupportedException("Even parity does not support problems with number of bits > 10.");
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs

    r17270 r17320  
    2424using System.Diagnostics.Contracts;
    2525using System.Linq;
     26using System.Threading;
    2627using HEAL.Attic;
    2728using HeuristicLab.Common;
     
    117118
    118119
    119     public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) {
     120    public override double Evaluate(ISymbolicExpressionTree tree, IRandom random, CancellationToken cancellationToken) {
    120121      if (NumberOfBits <= 0) throw new NotSupportedException("Number of bits must be larger than zero.");
    121122      if (NumberOfBits > 37) throw new NotSupportedException("Multiplexer does not support problems with number of bits > 37.");
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/LawnMower/Problem.cs

    r17270 r17320  
    2222using System;
    2323using System.Linq;
     24using System.Threading;
    2425using HEAL.Attic;
    2526using HeuristicLab.Common;
     
    9293    }
    9394
    94     public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) {
     95    public override double Evaluate(ISymbolicExpressionTree tree, IRandom random, CancellationToken cancellationToken) {
    9596      var length = LawnLengthParameter.Value.Value;
    9697      var width = LawnWidthParameter.Value.Value;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs

    r17270 r17320  
    2020#endregion
    2121
     22using System.Threading;
    2223using HEAL.Attic;
    2324using HeuristicLab.Common;
     
    9899    private void AfterDeserialization() { RegisterEventHandlers(); }
    99100
    100     public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) {
     101    public override double Evaluate(ISymbolicExpressionTree tree, IRandom random, CancellationToken cancellationToken) {
    101102      return Interpreter.EvaluateTankProgram(tree, RobocodePath, Enemies, null, false, NrOfRounds);
    102103    }
Note: See TracChangeset for help on using the changeset viewer.