private List <BeliefState> SimulateTrial(Policy p, int cMaxSteps) { BeliefState bsCurrent = m_dDomain.InitialBelief, bsNext = null; State sCurrent = bsCurrent.sampleState(), sNext = null; Action a = null; Observation o = null; List <BeliefState> lBeliefs = new List <BeliefState>(); while (!m_dDomain.IsGoalState(sCurrent) && lBeliefs.Count < cMaxSteps) { a = p.GetAction(bsCurrent); sNext = sCurrent.Apply(a); o = sNext.RandomObservation(a); bsNext = bsCurrent.Next(a, o); bsCurrent = bsNext; lBeliefs.Add(bsCurrent); sCurrent = sNext; } return(lBeliefs); }
private void SimulateTrial(Policy p, MazeViewer viewer) { BeliefState bsCurrent = InitialBelief, bsNext = null; State sCurrent = bsCurrent.sampleState(), sNext = null; Action a = null; Observation o = null; viewer.CurrentState = (MazeState)sCurrent; viewer.CurrentBelief = bsCurrent; while (!IsGoalState(sCurrent)) { a = p.GetAction(bsCurrent); sNext = sCurrent.Apply(a); o = sNext.RandomObservation(a); bsNext = bsCurrent.Next(a, o); bsCurrent = bsNext; sCurrent = sNext; viewer.CurrentState = (MazeState)sCurrent; viewer.CurrentBelief = bsCurrent; viewer.CurrentObservation = (MazeObservation)o; Thread.Sleep(500); } }