Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/03/18 00:28:51 (6 years ago)
Author:
abeham
Message:

#1614:

  • fixed a bug in GRASP where solutions in the elite set would be mutated
  • introduced termination criteria when reaching best-known quality
  • tweaked generating random numbers in StochasticNMoveSingleMoveGenerator
  • changed DiscreteLocationCrossover to use an allele from one of the parents instead of introducing a mutation in case no feasible insert location is found
  • changed OSGA maxselpress to 500
  • slight change to contexts, introduced single-objectiveness much earlier in the class hierachy
    • limited ContextAlgorithm to SingleObjectiveBasicProblems (doesn't matter here)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveSingleMoveGenerator.cs

    r15553 r15572  
    6565
    6666      var reassignment = new int[dim];
    67       reassignment[equip] = ReassignEquipment(random, equip, assignment[equip], locations);
     67      reassignment[equip] = 1 + (assignment[equip] + random.Next(1, locations)) % locations;
    6868
    6969      return new NMove(reassignment, equipments);
     
    7474      if (locations <= 1) throw new ArgumentException("There must be at least two locations.");
    7575      var dim = assignment.Length;
    76       var equipments = new List<int>(2) { random.Next(dim), -1 };
    77       do {
    78         equipments[1] = random.Next(dim);
    79       } while (equipments[0] == equipments[1]);
     76      var equipments = new List<int>(2) { random.Next(dim) };
     77      equipments.Add((equipments[0] + random.Next(1, dim)) % dim);
    8078
    8179      var reassignment = new int[dim];
    8280      for (var i = 0; i < 2; i++) {
    8381        var equip = equipments[i];
    84         reassignment[equip] = ReassignEquipment(random, equip, assignment[equip], locations);
     82        reassignment[equip] = 1 + (assignment[equip] + random.Next(1, locations)) % locations;
    8583      }
    8684      return new NMove(reassignment, equipments);
     
    9896      for (var i = 0; i < n; i++) {
    9997        var equip = equipments[i];
    100         reassignment[equip] = ReassignEquipment(random, equip, assignment[equip], locations);
     98        reassignment[equip] = 1 + (assignment[equip] + random.Next(1, locations)) % locations;
    10199      }
    102100      return new NMove(reassignment, equipments);
    103     }
    104 
    105     private static int ReassignEquipment(IRandom random, int equip, int prevLocation, int locations) {
    106       var newLoc = random.Next(locations) + 1;
    107       while (newLoc == prevLocation + 1)
    108         newLoc = random.Next(locations) + 1;
    109       return newLoc;
    110101    }
    111102
Note: See TracChangeset for help on using the changeset viewer.