Beispiel #1
0
 public Set <CellWorldAction.ActionEnum> actions(Cell <double> s)
 {
     // All actions can be performed in each cell
     // (except terminal states)
     if (terminals.Contains(s))
     {
         return(new Set <CellWorldAction.ActionEnum>());
     }
     return(CellWorldAction.actions());
 }
Beispiel #2
0
 public ISet <CellWorldAction> actions(Cell <double> s)
 {
     // All actions can be performed in each cell
     // (except terminal states)
     if (terminals.Contains(s))
     {
         return(CollectionFactory.CreateSet <CellWorldAction>());
     }
     return(CellWorldAction.Actions());
 }
Beispiel #3
0
            private ICollection <Cell <double> > possibleOutcomes(Cell <double> c, CellWorldAction a)
            {
                // There can be three possible outcomes for the planned action
                ICollection <Cell <double> > outcomes = CollectionFactory.CreateQueue <Cell <double> >();

                outcomes.Add(cw.Result(c, a));
                outcomes.Add(cw.Result(c, a.GetFirstRightAngledAction()));
                outcomes.Add(cw.Result(c, a.GetSecondRightAngledAction()));

                return(outcomes);
            }
Beispiel #4
0
                private List <Cell <Double> > possibleOutcomes(Cell <Double> c,
                                                               CellWorldAction a)
                {
                    // There can be three possible outcomes for the planned action
                    List <Cell <Double> > outcomes = new List <Cell <Double> >();

                    outcomes.Add(cw.result(c, a));
                    outcomes.Add(cw.result(c, new CellWorldAction(a.getFirstRightAngledAction())));
                    outcomes.Add(cw.result(c, new CellWorldAction(a.getSecondRightAngledAction())));

                    return(outcomes);
                }
Beispiel #5
0
            public double probability(Cell <double> sDelta, Cell <double> s, CellWorldAction a)
            {
                double prob = 0;

                ICollection <Cell <double> > outcomes = possibleOutcomes(s, a);

                for (int i = 0; i < outcomes.Size(); ++i)
                {
                    if (sDelta.Equals(outcomes.Get(i)))
                    {
                        // Note: You have to sum the matches to
                        // sDelta as the different actions
                        // could have the same effect (i.e.
                        // staying in place due to there being
                        // no adjacent cells), which increases
                        // the probability of the transition for
                        // that state.
                        prob += distribution[i];
                    }
                }

                return(prob);
            }
Beispiel #6
0
                public override double probability(Cell <double> sDelta, Cell <double> s, CellWorldAction a)
                {
                    double[] distribution = new double[] { 0.8, 0.1, 0.1 };

                    double prob = 0;

                    List <Cell <Double> > outcomes = possibleOutcomes(s, a);

                    for (int i = 0; i < outcomes.Count; i++)
                    {
                        if (sDelta.Equals(outcomes[i]))
                        {
                            // Note: You have to sum the matches to
                            // sDelta as the different actions
                            // could have the same effect (i.e.
                            // staying in place due to there being
                            // no adjacent cells), which increases
                            // the probability of the transition for
                            // that state.
                            prob += distribution[i];
                        }
                    }

                    return(prob);
                }