Changeset 13404 for branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/Improvers/KnapsackImprovementOperator.cs
- Timestamp:
- 11/26/15 09:30:43 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/Improvers/KnapsackImprovementOperator.cs
r12012 r13404 125 125 int evaluatedSolutions = 0; 126 126 int j = sol.Length - 1; 127 while (KnapsackEvaluator.Apply(sol, KnapsackCapacity, Penalty, Weights, Values) 128 .SumWeights.Value > KnapsackCapacity.Value && j >= 0) { 127 var totalWeight = 0.0; 128 for (var i = 0; i < sol.Length; i++) { 129 if (sol[i]) totalWeight += Weights[i]; 130 } 131 evaluatedSolutions++; 132 133 while (totalWeight > KnapsackCapacity.Value && j >= 0) { 134 totalWeight -= Weights[order[j]]; 129 135 sol[order[j--]] = false; 130 evaluatedSolutions++;131 136 } 132 137
Note: See TracChangeset
for help on using the changeset viewer.