public StateActionValueTable(ValueTableInitModes initMode, double value, int numActions, params int[] stateDims)
     : this(numActions, stateDims)
 {
     if (initMode == ValueTableInitModes.Constant)
     {
         for (int s = 0; s < m_stateLength; s++)
         {
             for (int a = 0; a < m_numActions; a++)
             {
                 m_valueTable[s, a] = value;
             }
         }
     }
     else if (initMode == ValueTableInitModes.UniformRandom)
     {
         Random r = new Random();
         for (int s = 0; s < m_stateLength; s++)
         {
             for (int a = 0; a < m_numActions; a++)
             {
                 m_valueTable[s, a] = ((r.NextDouble() * 2) - 1) * value;
             }
         }
     }
 }
Exemplo n.º 2
0
 public Policy(ValueTableInitModes initMode, int value, params int[] stateDims)
     : this(stateDims)
 {
     if (initMode == ValueTableInitModes.Constant)
     {
         for (int s = 0; s < m_stateLength; s++)
         {
             m_valueTable[s] = value;
         }
     }
     else if (initMode == ValueTableInitModes.UniformRandom)
     {
         Random r = new Random();
         for (int s = 0; s < m_stateLength; s++)
         {
             m_valueTable[s] = (int)(r.NextDouble() * value);
         }
     }
 }