private void Print(DnsMessage Message) { Console.Out.WriteLine("ID: " + Message.ID); Console.Out.WriteLine("OpCode: " + Message.OpCode); Console.Out.WriteLine("AuthoritativeAnswer: " + Message.AuthoritativeAnswer); Console.Out.WriteLine("Truncation: " + Message.Truncation); Console.Out.WriteLine("RecursionDesired: " + Message.RecursionDesired); Console.Out.WriteLine("RecursionAvailable: " + Message.RecursionAvailable); Console.Out.WriteLine(); Console.Out.WriteLine("Questions"); Console.Out.WriteLine(new string('=', 40)); foreach (Question Q in Message.Questions) { Console.Out.WriteLine(Q.ToString()); } Console.Out.WriteLine(); Console.Out.WriteLine("Answer"); Console.Out.WriteLine(new string('=', 40)); foreach (ResourceRecord RR in Message.Answer) { Console.Out.WriteLine(RR.ToString()); } Console.Out.WriteLine(); Console.Out.WriteLine("Authority"); Console.Out.WriteLine(new string('=', 40)); foreach (ResourceRecord RR in Message.Authority) { Console.Out.WriteLine(RR.ToString()); } Console.Out.WriteLine(); Console.Out.WriteLine("Additional"); Console.Out.WriteLine(new string('=', 40)); foreach (ResourceRecord RR in Message.Additional) { Console.Out.WriteLine(RR.ToString()); } }
public void Run() { for (int i = 0; i < trial_times; i++) { foreach (int WR in wingmanRange) { HexaPos startPos = this._mapForm.human.path[0]; TopologyGraphGenerator topologyGenerator = new TopologyGraphGenerator(this._mapForm.map); TopologyGraph tograph = topologyGenerator.GetTopologyGraph(); PlanningGraphGenerator planningGenerator = new PlanningGraphGenerator(tograph); PathPlanningGraph planGraph = planningGenerator.GetPathPlanningGraph(this._mapForm.HumanPath, WR); PlanningGraphPruner pruner = new PlanningGraphPruner(); PathPlanningGraph newPlanGraph = pruner.GetPlanningGraph(planGraph, startPos); PathPlanningGraph prunedPlanGraph = pruner.BackwardPrune(newPlanGraph); prunedPlanGraph = pruner.ForwardPrune(prunedPlanGraph); Robot robot = new Robot(this._mapForm.map); Human human = new Human(this._mapForm.map); foreach (int HR in humanRange) { this._mapForm.map.GetMapStateMgr().RandomizeValue(); human.SetObservationRange(HR); double[,] localEntropy = this._mapForm.map.GetMapStateMgr().CopyEntropy(); human.Update(this._mapForm.HumanPath, localEntropy); foreach (int RR in robotRange) { robot.SetObservationRange(RR); Console.WriteLine("Trial Time: " + i.ToString() + " WR: " + WR.ToString() + " RR: " + RR.ToString() + " HR: " + HR.ToString()); HexaPath maxPath = new HexaPath(); TreeExpandingWithIterativeTrackingPathPlanner planner = new TreeExpandingWithIterativeTrackingPathPlanner(this._mapForm.map, robot); planner._localEntropy = localEntropy; planner.iteratingOnce = false; maxPath = planner.FindPath(prunedPlanGraph, startPos); Console.WriteLine("PATH : " + maxPath.ToString()); // double[,] tempEntropy = (double[,])this._mapForm.map.GetMapStateMgr().CopyEntropy(); //double maxScore = robot.Score(maxPath, tempEntropy); double maxScore = planner.finalMaxScore; Console.WriteLine("SCORE: " + maxScore); Console.WriteLine(""); PerformanceParameter param = new PerformanceParameter(); param.maxScore = maxScore; param.problemSize = planner.problemSize; param.scoreAtFirstRun = planner.scoreAtFirstRun; param.exploredSize = planner.exploredSize; param.totalRunTime = planner.totalRunTime; param.hitOptimalRunTime = planner.hitOptimalRunTime; param.robotRange = RR; param.humanRange = HR; param.wingmanRange = WR; param.runIndex = i; this.performanceList.Add(param); } } } } save(prefix); }