Research Article

An Exact Algorithm for Bilevel 0-1 Knapsack Problems

Algorithm 1

A polynomial time solution procedure for CBKP.
 Let denote the optimal value of the leader objective function;
 Let be an optimal solution of CBKP;
Initialization
  Sort the variables and in decreasing order of the ratio for and
  and for ;
  Let
     
  be the optimal solution for the following problem:
           ;
  Let
    
  be the optimal solution for the following problem:
          ;
  /*   The indexes and   are respectively the indexes of the last
  leader and follower variables with a positive value according
  to the ordering */
  Let ;
; ;
while   and ) do
  if   then
    ; ; ;
  end
  else  if   then
     ; ; ;
  end
  else  if   then
     ; ; ; ;
  end
  if   then
    ; ;
  end
end