Advertisement
Guest User

Untitled

a guest
May 26th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1.       /*
  2.       *   Learn a batch from experience replay
  3.       */
  4.       for (int i = 0; i < BATCHSIZE; ++i) {
  5.         // Prioritized experience replay : select a "significant" experience based on highest TDError
  6.         int memId = xorRandInt(memory.size());
  7.         for (int j = 1; j < PRIOTOURNAMENTSIZE; ++j) {
  8.           int r = xorRandInt(memory.size());
  9.           if (memory[r].TDError > memory[memId].TDError) {
  10.             memId = r;
  11.           }
  12.         }
  13.         if (xorRandDouble() < 0.15) {
  14.           // Bypass the prioritized experience replay
  15.           memId = xorRandInt(memory.size());
  16.         }
  17.  
  18.         const Experience &exp = memory[memId];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement