Research Article
A New Moth-Flame Optimization Algorithm for Discounted {0-1} Knapsack Problem
Algorithm 1
The overall pseudocode MFO algorithm for DKP01.
| | Input: initial parameters | | | Output: optimal solution | | (1) | Initialize search agents M | | (2) | t = 1; | | (3) | while tT do | | (4) | Update flame no. by equation (9) | | (5) | Generate binary X matrix by equation (11); | | (6) | Apply repair operator on X and assign its fitness to OM; | | (7) | if t = = 1 then | | (8) | F = sort (); | | (9) | OF = sort (); | | (10) | else | | (11) | F = sort (); | | (12) | OF = sort (); | | (13) | for i = 1:m do | | (14) | for j = 1:d do | | (15) | Calculate D by equation (8); | | (16) | Update M (i, j) by equations (6) and (7); | | (17) | t = t + 1. |
|