Skip to main content
. 2023 Jul 14;25(7):1066. doi: 10.3390/e25071066
Algorithm 2 SFDM1
  • Input:

    Stream X=X1X2, distance metric d(·,·), parameter ε(0,1), size constraints k1,k2Z+ (k=k1+k2)

  • Output:

    A set SX s.t. |SXi|=ki for i{1,2}

  • Stream processing

  • 1:

    U={dmin(1ε)j:jZ0+(1ε)jdmindmax}

  • 2:

    Initialize Sμ,Sμ,i= for every μU and i{1,2}

  • 3:

    for all xX do

  • 4:

        Run Lines 3–6 of Algorithm 1 to update Sμ w.r.t. x

  • 5:

        if c(x)=i then

  • 6:

            Run Lines 3–6 of Algorithm 1 to update Sμ,i w.r.t. x with size constraint ki

  • Post-processing

  • 7:

    U={μU:|Sμ|=k|Sμ,i|=ki,i{1,2}}

  • 8:

    for all μU do

  • 9:

        if |SμXi|<ki for some i{1,2} then

  • 10:

            while |SμXi|<ki do

  • 11:

               x+arg maxxSμ,id(x,SμXi)

  • 12:

               SμSμ{x+}

  • 13:

            while |Sμ|>k do

  • 14:

               xarg minxSμXid(x,SμXi)

  • 15:

               SμSμ{x}

  • 16:

    return Sarg maxμUdiv(Sμ)