Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/07/16 23:46:29 (7 years ago)
Author:
abeham
Message:

#2701:

  • Added MemPR for linear linkage (tabu walk still missing)
  • Added graph coloring problem
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/LocalSearch/ExhaustiveBitflipSubspace.cs

    r14450 r14466  
    2222using System.Threading;
    2323using HeuristicLab.Algorithms.MemPR.Interfaces;
     24using HeuristicLab.Algorithms.MemPR.Util;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    4849
    4950    public void Optimize(TContext context) {
    50       var evalWrapper = new EvaluationWrapper(context);
     51      var evalWrapper = new EvaluationWrapper<BinaryVector>(context.Problem, context.Solution);
    5152      var quality = context.Solution.Fitness;
    5253      try {
     
    5960      }
    6061    }
    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 again
    70         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     }
    8162  }
    8263}
Note: See TracChangeset for help on using the changeset viewer.