Beispiel #1
0
            public long totalTime(Node root)
            {
                long E =0;
                TravelPlan tp = new TravelPlan(root);
                //System.IO.StreamWriter file = new System.IO.StreamWriter(@"test.txt");
                for (int i = 1; i < AllNodesButRoot.Count&& AllNodesButRoot.ElementAt(routeNew[i]-1) !=null; i++)
                {
                    var des = AllNodesButRoot.ElementAt(routeNew[i]-1);
                    if(AllNodesButRoot.ElementAt(routeNew[i] - 1) is City)
                    {
                        var c = (City)AllNodesButRoot.ElementAt(routeNew[i] - 1);
                        if (c.isDummy == true)
                        {
                            des = root;
                        }

                    }
                    tp.Travel(tp.currentState, des);

                  //  file.WriteLine( tp.currentState.ToString());
                    if (tp.currentState.day >= 16)
                    {
                        E = E +999999999;
                    ///    return E;
                    }
                }
                tp.Travel(tp.currentState, root);
                E +=tp.alldaypass;
                // tp.showpastActs();
                newTP = tp;
                   ///      if(tp.alldaypass<350&&E< 22999999999)
                {
                    System.IO.StreamWriter file = new System.IO.StreamWriter("test"+E+".txt");

                    tp.showpastActs(file);
                    file.Close();
                }
                return E;
            }