- Timestamp:
- 12/07/16 23:46:29 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/LocalSearch/ExhaustiveBitflipSubspace.cs ¶
r14450 r14466 22 22 using System.Threading; 23 23 using HeuristicLab.Algorithms.MemPR.Interfaces; 24 using HeuristicLab.Algorithms.MemPR.Util; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; … … 48 49 49 50 public void Optimize(TContext context) { 50 var evalWrapper = new EvaluationWrapper (context);51 var evalWrapper = new EvaluationWrapper<BinaryVector>(context.Problem, context.Solution); 51 52 var quality = context.Solution.Fitness; 52 53 try { … … 59 60 } 60 61 } 61 62 public sealed class EvaluationWrapper {63 private readonly TContext context;64 private readonly ISingleObjectiveSolutionScope<BinaryVector> scope;65 private readonly SingleEncodingIndividual individual;66 67 public EvaluationWrapper(TContext context) {68 this.context = context;69 // don't clone the solution, which is thrown away again70 var cloner = new Cloner();71 cloner.RegisterClonedObject(context.Solution.Solution, null);72 this.scope = (ISingleObjectiveSolutionScope<BinaryVector>)context.Solution.Clone(cloner);73 this.individual = new SingleEncodingIndividual(context.Problem.Encoding, this.scope);74 }75 76 public double Evaluate(BinaryVector b) {77 scope.Solution = b;78 return context.Problem.Evaluate(individual, null);79 }80 }81 62 } 82 63 }
Note: See TracChangeset
for help on using the changeset viewer.