Changeset 6475 for branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition
- Timestamp:
- 06/24/11 14:23:19 (14 years ago)
- Location:
- branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Crossovers/PWRPPXCrossover.cs
r6406 r6475 28 28 29 29 namespace HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition { 30 [Item("PWR OrderCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")]30 [Item("PWRPPXCrossover", "Represents a crossover operation swapping sequences of the parents to generate offspring.")] 31 31 [StorableClass] 32 32 public class PWRPPXCrossover : PWRCrossover { -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWREncoding.cs
r6406 r6475 48 48 } 49 49 50 public PWREncoding(int problemDimension, IRandom random)50 public PWREncoding(int nrOfJobs, int nrOfResources, IRandom random) 51 51 : base() { 52 PermutationWithRepetition = new IntegerVector( problemDimension * problemDimension);53 int[] lookUpTable = new int[ problemDimension];52 PermutationWithRepetition = new IntegerVector(nrOfJobs * nrOfResources); 53 int[] lookUpTable = new int[nrOfJobs]; 54 54 55 55 for (int i = 0; i < PermutationWithRepetition.Length; i++) { 56 int newValue = random.Next( problemDimension);57 while (lookUpTable[newValue] >= problemDimension)58 newValue = random.Next( problemDimension);56 int newValue = random.Next(nrOfJobs); 57 while (lookUpTable[newValue] >= nrOfResources) 58 newValue = random.Next(nrOfJobs); 59 59 60 60 PermutationWithRepetition[i] = newValue; -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWRRandomCreator.cs
r6406 r6475 63 63 } 64 64 65 public static PWREncoding Apply(int jobs, int resources, IRandom random) { 66 return new PWREncoding(jobs, resources, random); 67 } 68 65 69 66 70 protected override PWREncoding CreateSolution() { 67 PWREncoding result = new PWREncoding(JobsParameter.ActualValue.Value, Random); 68 return result; 71 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, Random); 69 72 } 70 73 }
Note: See TracChangeset
for help on using the changeset viewer.