private void btnPrtEnv_Click(object sender, EventArgs e) { string filename = "ENV-" + DateTime.Now.ToShortTimeString() + ".png"; filename = filename.Replace(":", "-"); _mapDrawer.DrawEnv(filename, _map.GetMapStateMgr().CopyEntropy(), _human.path, Color.Blue, null); }
private void btnStart_Click(object sender, EventArgs e) { string methodName = ""; string methodShortName = ""; long startTime = 0; long endTime = 0; long deltaTime = 0; double spendTime = 0.0; HexaPath maxPath = new HexaPath(); startTime = DateTime.Now.Ticks; if (_planMethod == planMethod.EX_DFS) { ExhaustiveDFSPathPlanner planner = new ExhaustiveDFSPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "EXHAUSTIVE DFS"; methodShortName = "EXDFS"; } else if (_planMethod == planMethod.ITERATIVE_BACK_PROP) { IterativeBackPropPathPlanner planner = new IterativeBackPropPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "ITERATIVE BACK PROPAGATE"; methodShortName = "ITBP"; } else if (_planMethod == planMethod.SIMPLE_GREEDY) { SimpleGreedyPathPlanner planner = new SimpleGreedyPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "SIMPLE GREEDY"; methodShortName = "SG"; } else if (_planMethod == planMethod.GENE_ALG) { GeneticAlgorithmPathPlanner planner = new GeneticAlgorithmPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "GENETIC ALGORITHM"; methodShortName = "GA"; } else if (_planMethod == planMethod.BACK_PROP) { BackPropPathPlanner planner = new BackPropPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "BACK PROP"; methodShortName = "BP"; } else if (_planMethod == planMethod.IT_BACK_PROP_ENH) { IterativeBackPropEnhPathPlanner planner = new IterativeBackPropEnhPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "ITERATIVE BACK PROPAGATE ENH"; methodShortName = "ITBPE"; } else if (_planMethod == planMethod.IT_BACK_PROP_RETRK) { IterativeBackPropRetrackPathPlanner planner = new IterativeBackPropRetrackPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "ITERATIVE BACK PROPAGATE RETRK"; methodShortName = "ITBPR"; } else if (_planMethod == planMethod.IT_BP_COMBO) { IterativeBackPropComboPathPlanner planner = new IterativeBackPropComboPathPlanner(_map, (Robot)_agent); maxPath = planner.FindPath(_graph, _startPos); methodName = "ITERTATIVE BACK PROP COMBO"; methodShortName = "ITBPCOM"; } else if (_planMethod == planMethod.EXPAND_TREE_1) { TreeExpandingWithIterativeTrackingPathPlanner planner = new TreeExpandingWithIterativeTrackingPathPlanner(_map, (Robot)_agent); planner.iteratingOnce = true; maxPath = planner.FindPath(_graph, _startPos); //Console.WriteLine("EXCLUSIVE EXPANDING NODE NUM: " + planner.GetExclusiveExpandingNodeNum(_graph, _startPos)); methodName = "EXPANDING TREE ONE"; methodShortName = "EXP_TREE_1"; } else if (_planMethod == planMethod.EXPAND_TREE_N) { TreeExpandingWithIterativeTrackingPathPlanner planner = new TreeExpandingWithIterativeTrackingPathPlanner(_map, (Robot)_agent); planner.iteratingOnce = false; maxPath = planner.FindPath(_graph, _startPos); // Console.WriteLine("EXCLUSIVE EXPANDING NODE NUM: " + planner.GetExclusiveExpandingNodeNum(_graph, _startPos)); methodName = "EXPANDING TREE N"; methodShortName = "EXP_TREE_N"; } endTime = DateTime.Now.Ticks; deltaTime = endTime - startTime; spendTime = deltaTime / 10000.0; Console.WriteLine("PATH BY " + methodName + " : " + maxPath.ToString()); txtBoxInfo.AppendText("PATH BY " + methodName + " : " + maxPath.ToString() + "\n"); double[,] tempEntropy = (double[, ])_map.GetMapStateMgr().CopyEntropy(); double maxScore = _agent.Score(maxPath, tempEntropy); Console.WriteLine("SCORE: " + maxScore); txtBoxInfo.AppendText("SCORE: " + maxScore + "\n"); Console.WriteLine("TIME SPENT: " + spendTime + "\n"); txtBoxInfo.AppendText("TIME SPENT: " + spendTime + " ms\n\n"); _agent.Update(maxPath, tempEntropy); string filename = methodShortName + "-" + DateTime.Now.ToShortTimeString() + ".png"; filename = filename.Replace(":", "-"); _mapDrawer.DrawEnv(filename, tempEntropy, maxPath, Color.Green, _humanPath); }