More about stable voting percentages

in #curation7 years ago

Last week, I posted: Voting percentages to keep steem account voting power between 80 and 90 percent, a post that took a look at the question, how do I adjust my voting percentage and votes per hour in order to keep my voting power stable, as low as possible above 80%?

That led to the more general question, how do I adjust voting power and votes per hour to keep my voting power stable around any desired percentage?

A spread-sheet was no longer suitable for that question, so I hacked together a quick C program to compute the answer and print the tables below.

Same assumptions as before:

  1. Voting power declines at a rate of 2% of remaining voting power per vote.
  2. Voting power is replenished at a rate of 20% per day.

Stabilization of Voting Power: Votes per hour as powers of 2

          V O T E S    P E R   H O U R
   %   1    2    4    8   16   32   64
  100 0.42 0.21 0.11 0.05 0.03 0.01 0.01
   95 0.44 0.22 0.11 0.06 0.03 0.01 0.01
   90 0.46 0.23 0.12 0.06 0.03 0.01 0.01
   85 0.49 0.25 0.12 0.06 0.03 0.02 0.01
   80 0.52 0.26 0.13 0.07 0.03 0.02 0.01
   75 0.55 0.28 0.14 0.07 0.04 0.02 0.01
   70 0.59 0.30 0.15 0.08 0.04 0.02 0.01
   65 0.64 0.32 0.16 0.08 0.04 0.02 0.01
   60 0.69 0.35 0.18 0.09 0.04 0.02 0.01
   55 0.75 0.38 0.19 0.10 0.05 0.02 0.01
   50 0.83 0.42 0.21 0.11 0.05 0.03 0.01
   45 0.92 0.46 0.23 0.12 0.06 0.03 0.01
   40 1.00 0.52 0.26 0.13 0.07 0.03 0.02
   35 1.00 0.59 0.30 0.15 0.07 0.04 0.02
   30 1.00 0.69 0.35 0.17 0.09 0.04 0.02
   25 1.00 0.83 0.42 0.21 0.10 0.05 0.03
   20 1.00 1.00 0.52 0.26 0.13 0.07 0.03
   15 1.00 1.00 0.69 0.35 0.17 0.09 0.04

Stabilization of Voting Power: Increment Votes Per Hour by 1

         V O T E S    P E R   H O U R
   %   1    2    3    4    5    6    7    8    9   10   11   12
  100 0.42 0.21 0.14 0.11 0.08 0.07 0.06 0.05 0.05 0.04 0.04 0.04    
   95 0.44 0.22 0.15 0.11 0.09 0.07 0.06 0.06 0.05 0.04 0.04 0.04
   90 0.46 0.23 0.16 0.12 0.09 0.08 0.07 0.06 0.05 0.05 0.04 0.04
   85 0.49 0.25 0.17 0.12 0.10 0.08 0.07 0.06 0.06 0.05 0.05 0.04
   80 0.52 0.26 0.18 0.13 0.11 0.09 0.08 0.07 0.06 0.05 0.05 0.04
   75 0.55 0.28 0.19 0.14 0.11 0.09 0.08 0.07 0.06 0.06 0.05 0.05
   70 0.59 0.30 0.20 0.15 0.12 0.10 0.09 0.08 0.07 0.06 0.05 0.05
   65 0.64 0.32 0.22 0.16 0.13 0.11 0.09 0.08 0.07 0.06 0.06 0.05
   60 0.69 0.35 0.23 0.18 0.14 0.12 0.10 0.09 0.08 0.07 0.06 0.06
   55 0.75 0.38 0.25 0.19 0.15 0.13 0.11 0.10 0.08 0.08 0.07 0.06
   50 0.83 0.42 0.28 0.21 0.17 0.14 0.12 0.11 0.09 0.08 0.08 0.07
   45 0.92 0.46 0.31 0.23 0.19 0.16 0.13 0.12 0.10 0.09 0.08 0.08
   40 1.00 0.52 0.35 0.26 0.21 0.17 0.15 0.13 0.12 0.10 0.10 0.09
   35 1.00 0.59 0.40 0.30 0.24 0.20 0.17 0.15 0.13 0.12 0.11 0.10
   30 1.00 0.69 0.46 0.35 0.28 0.23 0.20 0.17 0.15 0.14 0.13 0.12
   25 1.00 0.83 0.56 0.42 0.33 0.28 0.24 0.21 0.19 0.17 0.15 0.14
   20 1.00 1.00 0.69 0.52 0.42 0.35 0.30 0.26 0.23 0.21 0.19 0.17
   15 1.00 1.00 0.92 0.69 0.56 0.46 0.40 0.35 0.31 0.28 0.25 0.23

So, for example, I can use the tables above to determine that if I vote twice per hour at 30%, my voting power should stabilize at 69%, and if I vote 8 times per hour at 45%, my voting power should stabilize at 12%.

Here's the code. It was quick and dirty, so loop variables need to be adjusted and the program needs to be recompiled to adjust the table headings:

#include "stdio.h"
#include "stdlib.h"

int main(int argc, char *argv[])
{
int lcv;               /* loop control variable */

float lowbound,        // low voting boundary
      highbound;       // high voting power boundary
float rpd=0.2,         // daily replenishment (replenishment per day)
      fullweight=0.02, // Cost of 100% vote
      vphmax=13.0,     // Max votes per hour
      vpctstep=0.05,    // Gap between voting percentage rows.
      vph,             // votes per hour
      vpct,            // voting percentage
      mpv,             // minutes per vote
      rpv,             // replenish per vote
      cpv;             // cost per vote

      /*
       * Print column heading row.
       */
      printf ("     V O T E S    P E R   H O U R\n");
      printf ("   %%");
      for (lcv=1; lcv < (int) vphmax; lcv += 1 )
         printf ("%4d ", lcv);
      printf ("\n");

      /*
       * Outer loop controls voting percentage
       */
      for ( vpct=1.0; vpct>0.1; vpct -= vpctstep )
      {
         /*
          * Print row headings
          */
         printf ("%5d ", (int) (vpct * 100.0 + 0.5));

         /*
          * Middle loop controls number of votes per hour.
          */
         cpv = fullweight * vpct;   // Set cost per vote for this voting percentage.
         for ( vph=1.0; vph < vphmax; vph += 1 )
         {
            lowbound = 0.01;             // Reset lower boundary.
            highbound = 1.0;             // Reset higher boundary.
            mpv = 60.0 / vph;            // Reset minutes per vote.
            rpv = ( rpd / 1440 ) * mpv;  // Reset replenishment per vote.

            /*
             * Inner loop drives to convergance.
             */
            while ( lowbound + rpv <= highbound - ( cpv * highbound ))
            {
               /*
                * Lower boundaries by cost_per_vote,
                * then raise them by replenishment_per_vote.
                */
               lowbound = lowbound - (lowbound * cpv) + rpv;
               highbound = highbound - (highbound * cpv) + rpv;
            } // end inner loop

            /*
             * Print converged value (1 if above 100%)
             */
            if ( lowbound + highbound > 2.0 )
               printf ("%4.2f ", 1.0);
            else
               printf ("%4.2f ", (lowbound + highbound) / 2.0);
         } // end middle loop

         printf ("\n");    // Next row.

      } // end outer loop
      return (0);
}