Research Article
A Hybrid Harmony Search Algorithm with Distribution Estimation for Solving the 0-1 Knapsack Problem
Algorithm 6
Improved repair operator.
| (1) | While < C | | (2) | Randomly select a certain number of dimensions | | (3) | Sort the selected dimensions out of order | | (4) | L = ; % Total weight held | | (5) | If B (dd (i)) == 0 | | (6) | B (dd(i)) = 1; | | (7) | = + W (dd (i)); | | (8) | end | | (9) | if > C | | (10) | B (dd(i)) = 0; | | (11) | L = − W (dd(i)); | | (12) | end | | (13) | Determines whether the selected dimension is exceeded | | (14) | end | | (15) | = L; |
|