Changeset 14552 for branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/LocalSearch/StaticAPI
- Timestamp:
- 01/09/17 00:36:20 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Binary/LocalSearch/StaticAPI/ExhaustiveBitflip.cs
r14450 r14552 30 30 namespace HeuristicLab.Encodings.Binary.LocalSearch { 31 31 public static class ExhaustiveBitflip { 32 public static Tuple<int, int> Optimize(IRandom random, BinaryVector solution, ref double quality, bool maximization, Func<BinaryVector, double> evalFunc, CancellationToken token, bool[] subspace = null) {33 if (double.IsNaN(quality)) quality = evalFunc(solution );32 public static Tuple<int, int> Optimize(IRandom random, BinaryVector solution, ref double quality, bool maximization, Func<BinaryVector, CancellationToken, double> evalFunc, CancellationToken token, bool[] subspace = null) { 33 if (double.IsNaN(quality)) quality = evalFunc(solution, token); 34 34 var improved = false; 35 35 var order = Enumerable.Range(0, solution.Length).Shuffle(random).ToArray(); … … 47 47 // bitflip the solution 48 48 solution[idx] = !solution[idx]; 49 var after = evalFunc(solution );49 var after = evalFunc(solution, token); 50 50 evaluations++; 51 51 if (FitnessComparer.IsBetter(maximization, after, quality)) {
Note: See TracChangeset
for help on using the changeset viewer.