Skip to main content


Table 4 HQP algorithm

From: Efficient embedded architectures for fast-charge model predictive controller for battery cell management in electric vehicles

Hildreth’s quadratic programming technique (HQP algorithm)
For iterations 1 to 40
1. Save λcurrent →λprevious
2. Start outer loop to build λ, i = 0 to # elements in M or Msize
 a. w = 0;
 b. start inner loop to build λ, j starts at 0
  i. w = w + P[i][j]∙λ[j]
  ii. GOTO start inner loop If j<Msize,
 c. w = w + K[i]-P[i][i]∙λ[i]
 d. λtest = -w/P[i][i]
 e. if λtest < 0 then λ[i] = 0, else λ[i] = λtest
 f. GOTO start outer loop if i<Msize
3. Check convergence
 a. calculate the Euclidean length of previous λ
 b. calculate the Euclidean length of current λ
 c. Compare ratio to reference value
 d. if converged, exit iteration, GOTO calculate new Δu
4. Else execute next iteration, GOTO 1.
5. Calculate new Δu
 a. Start loop, j = 0 to j=Msize
  i. Δuc = Δuc +∙λ[j] ME−1[j]
 b. GOTO start loop if j<Msize
 c. Δuk+1 = Δu°-Δuc
6. End