Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/18/19 16:11:21 (4 years ago)
Author:
mkommend
Message:

#2521: Refactored single-objective problems to use EvaluationResult instead of double as return type from Evaluate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs

    r17356 r17382  
    9797    }
    9898
    99     public override double Evaluate(BinaryVector solution, IRandom random, CancellationToken cancellationToken) {
     99    public override ISingleObjectiveEvaluationResult Evaluate(BinaryVector solution, IRandom random, CancellationToken cancellationToken) {
    100100      var totalWeight = 0.0;
    101101      var totalValue = 0.0;
     
    105105        totalValue += Values[i];
    106106      }
    107       return totalWeight > KnapsackCapacity ? KnapsackCapacity - totalWeight : totalValue;
     107      var quality = totalWeight > KnapsackCapacity ? KnapsackCapacity - totalWeight : totalValue;
     108      return new SingleObjectiveEvaluationResult(quality);
    108109    }
    109110
Note: See TracChangeset for help on using the changeset viewer.