Research Article

Different Transfer Functions for Binary Particle Swarm Optimization with a New Encoding Scheme for Discounted {0-1} Knapsack Problem

Algorithm 1

PSO algorithm.
Input: Initial parameters
Output: optimal solution
(1)for each particle do
(2) Initialize particle
(3)while stop condition is not met do
(4)for each particle do
(5)  Evaluate objective function
(6)  if the objective function valuepBest then
(7)   current value is replace by pBest
(8) Calculate the gBest (the global best value)
(9)for each particle do
(10)  Calculate particle velocity by equation (5)
(11)  Update particle position by equation (6)