public void Load(BinaryReader b) { prevState = new T(); prevState.Load(b); nextState = new T(); //nextState.Load(b); action = b.ReadInt32(); reward = b.ReadDouble(); }
public override int GetBestActionIndex(QState state) { //Make sure we have action for this state, if not, create new with random value if (!qData.ContainsKey(state)) { //create random state double[] d = new double[Actions.Length]; d.RandomFill(); qData[state] = d; } // found return best reqard index double[] aData = qData[state]; return(Array.IndexOf(aData, aData.Max())); }
public virtual int GetActionIndex(QState state) { int ret = 0; data.prevState = state; double r = rand.NextDouble(); if (r < option.epsilon) { ret = RandomActionIndex(); } else { // find max action for this state ret = GetBestActionIndex(state); } data.action = ret; return(ret); }
public virtual int GetBestActionIndex(QState state) { throw new NotImplementedException("GetBestActionIndex"); }
public virtual int GetBestAction(QState state) { return(GetActionFromIndex(GetActionIndex(state))); }