Changeset 7786 for branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/KnapsackMultipleGuidesPathRelinker.cs
- Timestamp:
- 05/09/12 12:22:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/KnapsackMultipleGuidesPathRelinker.cs
r7778 r7786 54 54 throw new ArgumentException("RelinkingAccuracy must be greater than 0."); 55 55 56 var v1 = initiator.Clone() as BinaryVector;57 vartargets = new BinaryVector[guides.Length];56 BinaryVector v1 = initiator.Clone() as BinaryVector; 57 BinaryVector[] targets = new BinaryVector[guides.Length]; 58 58 Array.Copy(guides, targets, guides.Length); 59 59 … … 61 61 throw new ArgumentException("At least one solution is of different length."); 62 62 63 varsolutions = new List<BinaryVector>();63 IList<BinaryVector> solutions = new List<BinaryVector>(); 64 64 for (int i = 0; i < v1.Length; i++) { 65 65 // TODO: path relinking 66 66 } 67 67 68 varselection = new List<IItem>();68 IList<IItem> selection = new List<IItem>(); 69 69 if (solutions.Count > 0) { 70 var noSol = (int)Math.Round(solutions.Count * n.Value);70 int noSol = (int)(solutions.Count * n.Value); 71 71 if (noSol <= 0) noSol++; 72 varstepSize = (double)solutions.Count / (double)noSol;72 double stepSize = (double)solutions.Count / (double)noSol; 73 73 for (int i = 0; i < noSol; i++) 74 selection.Add(solutions.ElementAt((int) Math.Round((i + 1) * stepSize - stepSize * 0.5)));74 selection.Add(solutions.ElementAt((int)((i + 1) * stepSize - stepSize * 0.5))); 75 75 } 76 76
Note: See TracChangeset
for help on using the changeset viewer.