示例#1
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="instance">instance</param>
        public WHCAnStarPathManager(Instance instance)
            : base(instance)
        {
            //Need a Request on Fail
            BotNormal.RequestReoptimizationAfterFailingOfNextWaypointReservation = true;

            //translate to lightweight graph
            var graph  = GenerateGraph();
            var config = instance.ControllerConfig.PathPlanningConfig as WHCAnStarPathPlanningConfiguration;

            PathFinder = new WHCAnStarMethod(graph, instance.SettingConfig.Seed, instance.Bots.Select(b => b.ID).ToList(), instance.Bots.Select(b => _waypointIds[instance.WaypointGraph.GetClosestWaypoint(b.Tier, b.X, b.Y)]).ToList(), new PathPlanningCommunicator(
                                                 instance.LogSevere,
                                                 instance.LogDefault,
                                                 instance.LogInfo,
                                                 instance.LogVerbose,
                                                 () => { instance.StatOverallPathPlanningTimeouts++; }));
            var method = PathFinder as WHCAnStarMethod;

            method.LengthOfAWaitStep    = config.LengthOfAWaitStep;
            method.RuntimeLimitPerAgent = config.RuntimeLimitPerAgent;
            method.RunTimeLimitOverall  = config.RunTimeLimitOverall;
            method.LengthOfAWindow      = config.LengthOfAWindow;
            method.UseBias            = config.UseBias;
            method.UseDeadlockHandler = config.UseDeadlockHandler;

            if (config.AutoSetParameter)
            {
                //best parameter determined my master thesis
                method.LengthOfAWindow      = 15;
                method.UseBias              = false;
                method.RuntimeLimitPerAgent = config.Clocking / instance.Bots.Count;
                method.RunTimeLimitOverall  = config.Clocking;
            }
        }
示例#2
0
        public void WHCAnStar()
        {
            var method = new WHCAnStarMethod(GetGraph(), 0, new List <int>(new int[] { 0, 1 }), new List <int>(new int[] { 2, 1 }), PathPlanningCommunicator.DUMMY_COMMUNICATOR);

            method.LengthOfAWaitStep = 0.99;
            method.UseBias           = false;
            var agents = Test(method);

            output(agents);
        }