Skip to main content
. 2022 Aug 26;22(17):6438. doi: 10.3390/s22176438
Algorithm 12: Functional Flow of Hildreth’s Quadratic Programming solution for MPC, constrained solution
For iterations 1 to 40
  • 1. 

    Save λcurrent → λprevious

  • 2. 
    LOOP1 to build λ, i = 0 to # elements in M or Msize
    • a. 
      w = 0;
    • b. 
      LOOP2 to build λ, j starts at 0
      • i. 
        w = w + P[i][j]∙λ[j]
      • ii. 
        If j<Msize, repeat LOOP2 else GOTO 2.c
    • 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. 
      i<Msize repeat LOOP1 else GOTO 3
  • 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 is false GOTO 1, else GOTO 4.
  • 4. 
    Calculate new Δu
    • a. 
      Start loop, j = 0 to j = Msize
      • i. 
        Δuc = Δuc +∙λ[j] ME−1[j]
    • b. 
      GOTO 4.a if j<Msize else GOTO 4.c
    • c. 
      DU = Δu°-Δuc
  • 5. 

    End