Skip to main content
. 2018 Aug 22;18(9):2764. doi: 10.3390/s18092764
Algorithm 3. Individual reparation and promotion.
Input: solution vector xj={xj(1),xj(2),,xj(n)}
Output: repaired and promoted solution vector xj={xj(1),xj(2),,xj(n)}
1: For int k=1 to n
2: Compute value-to-weight of Ik; end for
3: Compute H={1,2,,n] according to value-to-weight
4: If (k=1nxi(k)·Wk>C)
5: Int Alvalue=0;
6: For int k=1 to n
7: If ((xi(k)==1)&&(Alvalue+WH[k]>C))
8: xi(j)=0;
9: Else Alvalue=Alvalue+WH[k];
10: End for
11: End if
12: Else if (k=1nxi(k)·WkC)
13: Int Alvalue=k=1nxi(k)·Wk;
14: For int k=1 to n
15: If ((xi(k)==0)&&(Alvalue+WH[k]C))
16: xi(j)=1 ; Alvalue=Alvalue+WH[k];
17: End for
18: End else