- Timestamp:
- 12/18/19 16:11:21 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/IEvaluationResult.cs
r17357 r17382 26 26 [StorableType("406EB24F-A59C-440C-8B83-49FC05F48855")] 27 27 public interface IEvaluationResult : IItem { 28 29 //TODO: make methods generic for get/set additional data 28 30 void SetAdditionalData(string identifier, object o); 29 31 object GetAdditionalData(string identifier); -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/ISingleObjectiveProblemDefinition.cs
r17363 r17382 37 37 where TEncodedSolution : class, IEncodedSolution { 38 38 39 double Evaluate(TEncodedSolution solution, IRandom random); 40 double Evaluate(TEncodedSolution solution, IRandom random, CancellationToken cancellationToken); 39 ISingleObjectiveEvaluationResult Evaluate(TEncodedSolution solution, IRandom random); 40 ISingleObjectiveEvaluationResult Evaluate(TEncodedSolution solution, IRandom random, CancellationToken cancellationToken); 41 41 42 void Evaluate(ISingleObjectiveSolutionContext<TEncodedSolution> solutionContext, IRandom random); 42 43 void Evaluate(ISingleObjectiveSolutionContext<TEncodedSolution> solutionContext, IRandom random, CancellationToken cancellationToken); -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/ISolutionContext.cs
r17363 r17382 33 33 IEvaluationResult EvaluationResult { get; } 34 34 35 36 //TODO: make methods generic for get/set additional data 35 37 void SetAdditionalData(string identifier, object o); 36 38 object GetAdditionalData(string identifier); -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs
r17366 r17382 113 113 } 114 114 115 public doubleEvaluate(TEncodedSolution solution, IRandom random) {115 public ISingleObjectiveEvaluationResult Evaluate(TEncodedSolution solution, IRandom random) { 116 116 return Evaluate(solution, random, CancellationToken.None); 117 117 } 118 public abstract doubleEvaluate(TEncodedSolution solution, IRandom random, CancellationToken cancellationToken);118 public abstract ISingleObjectiveEvaluationResult Evaluate(TEncodedSolution solution, IRandom random, CancellationToken cancellationToken); 119 119 120 120 public void Evaluate(ISingleObjectiveSolutionContext<TEncodedSolution> solutionContext, IRandom random) { … … 122 122 } 123 123 public virtual void Evaluate(ISingleObjectiveSolutionContext<TEncodedSolution> solutionContext, IRandom random, CancellationToken cancellationToken) { 124 double quality= Evaluate(solutionContext.EncodedSolution, random, cancellationToken);125 solutionContext.EvaluationResult = new SingleObjectiveEvaluationResult(quality);124 var evaluationResult = Evaluate(solutionContext.EncodedSolution, random, cancellationToken); 125 solutionContext.EvaluationResult = evaluationResult; 126 126 } 127 127 … … 139 139 return GetNeighbors(solutionContext.EncodedSolution, random).Select(n => new SingleObjectiveSolutionContext<TEncodedSolution>(n)); 140 140 } 141 142 143 141 144 142 public static bool IsBetter(bool maximization, double quality, double bestQuality) {
Note: See TracChangeset
for help on using the changeset viewer.