Exemple #1
0
 private static bool IsSignificantChange(DS Change, AnytimeDStarState aS)
 {
     //return true;
     return(aS.h(Change, aS.Sgoal) < aS.h(aS.Sstart, aS.Sgoal) &&
            aS.h(Change, aS.Sstart) < aS.h(aS.Sstart, aS.Sgoal) &&
            aS.h(Change, aS.Sstart) + aS.h(Change, aS.Sgoal) <
            SignifcanceRatio *aS.h(aS.Sstart, aS.Sgoal));
 }
Exemple #2
0
 private static SvenKey key(DS s, AnytimeDStarState aS)
 {
     if (g(s, aS) > rhs(s, aS))
     {
         return(new SvenKey( )
         {
             k1 = rhs(s, aS) + aS.epsilon * aS.h(aS.Sstart, s),
             k2 = rhs(s, aS)
         });
     }
     else
     {
         return(new SvenKey( )
         {
             k1 = g(s, aS) + aS.h(aS.Sstart, s),
             k2 = g(s, aS)
         });
     }
 }
Exemple #3
0
 public static Metric c(DS s1, DS s2, AnytimeDStarState aS)
 {
     if (s1.IsInvalid(aS.ss, false) || s2.IsInvalid(aS.ss, false))
     {
         return(Metric.Infinity);
     }
     else
     {
         return(aS.h(s1, s2));
     }
 }
Exemple #4
0
        public override IEnumerable <Path <SS, DS> > Compute(SS ss, DS ds, Goal <SS, DS> Goal, Operator <SS, DS>[] Ops)
        {
            this.init(ss, ds, Ops, Goal);
            ExtendedDictionary <DS, Metric> H1   = new ExtendedDictionary <DS, Metric>(x => aS.h(x, aS.Sgoal));
            ExtendedDictionary <DS, DS>     tree = new ExtendedDictionary <DS, DS>(x => null);
            Path <SS, DS> Incumbant         = null;
            int           GlobalSearchLimit = GetGlobalSearchComputationLimit( );

            this.aS.ComputationLimit = GlobalSearchLimit;
            int LocalSearchLimit = GetLocalSearchComputationLimit( );

            foreach (Path <SS, DS> p in AnytimeDStarLiteLookahead(aS, GlobalSearchLimit))
            {
                this.Expansions  += aS.Expansions;
                this.Generations += aS.Generations;
                aS.Expansions     = 0;
                aS.Generations    = 0;
                if (p == null)
                {
                    switch (sm)
                    {
                    /*case ChooseMethodStep.LRTAStar:
                     * yield return LRTAStar<SS, DS>.AStarLookAhead( ss.InitialDynamicState, ss,
                     *    LocalSearchLimit, aS.sv,
                     *    ref this.Expansions, ref this.Generations, false,
                     *    Ops, H1, H, Goal, Metric.One, false );
                     * break;
                     * case ChooseMethodStep.RTAStar:
                     * yield return LRTAStar<SS, DS>.AStarLookAhead( ss.InitialDynamicState, ss,
                     *    LocalSearchLimit, aS.sv,
                     *    ref this.Expansions, ref this.Generations, false,
                     *    Ops, H1, H, Goal, Metric.One, true );
                     * break;*/
                    case ChooseMethodStep.LSSLRTAStar:
                        yield return(LSSLRTAStar <SS, DS> .LSSLRTAStarLookahead(LocalSearchLimit, ss, aS.Sstart,
                                                                                aS.Sgoal, Ops, aS.h, ref Incumbant, ref this.Expansions, aS.sv, tree, H1));

                        break;
                    }
                }
                else
                {
                    yield return(p);
                }
                aS.Sstart = aS.ss.InitialDynamicState;
            }
            yield break;
        }