Displaying differences for changeset
 
display as  

src/main/java/ficus_transims/RoutingPlan.java

@@ -205,41 +205,41 @@ public class RoutingPlan {
             this.TimeLineEvents.put(t, new ArrayList());
         }
 
-        File input = new File(loc);
-        if (input.exists()){
-            InputStream inputFS = new FileInputStream(input);
-            BufferedReader br = new BufferedReader(new InputStreamReader(inputFS));
-            String line;
-            int count;
-            while((line = br.readLine()) != null){
-                String[] splitline = line.split(";");
-                int length = splitline.length - 1;
-                Integer key = Integer.parseInt(splitline[0]);
-                int[] temp = new int[5];
-                for (int j = 0; j < length; j++){
-                    count = 0;
-                    for (String s : splitline[j].split(",")){
-                        temp[count] = Integer.parseInt(s);
-                        count++;
-                    }
-                    if (key < time_line_length){
-                        ArrayList list = this.TimeLineEvents.get(key);
-                        list.add(temp);
-                        this.TimeLineEvents.put(key, list);
-                    }else{
-                        if (this.RemainWalkTrips.containsKey(key)){
-                            ArrayList list = this.RemainWalkTrips.get(key);
-                            list.add(temp);
-                            this.RemainWalkTrips.put(key, list);
-                        }else{
-                            ArrayList list = new ArrayList();
-                            list.add(temp);
-                            this.RemainWalkTrips.put(key, list);
-                        }
-                    }
-                }
-            }
-        }
+//        File input = new File(loc);
+//        if (input.exists()){
+//            InputStream inputFS = new FileInputStream(input);
+//            BufferedReader br = new BufferedReader(new InputStreamReader(inputFS));
+//            String line;
+//            int count;
+//            while((line = br.readLine()) != null){
+//                String[] splitline = line.split(";");
+//                int length = splitline.length - 1;
+//                Integer key = Integer.parseInt(splitline[0]);
+//                int[] temp = new int[5];
+//                for (int j = 0; j < length; j++){
+//                    count = 0;
+//                    for (String s : splitline[j].split(",")){
+//                        temp[count] = Integer.parseInt(s);
+//                        count++;
+//                    }
+//                    if (key < time_line_length){
+//                        ArrayList list = this.TimeLineEvents.get(key);
+//                        list.add(temp);
+//                        this.TimeLineEvents.put(key, list);
+//                    }else{
+//                        if (this.RemainWalkTrips.containsKey(key)){
+//                            ArrayList list = this.RemainWalkTrips.get(key);
+//                            list.add(temp);
+//                            this.RemainWalkTrips.put(key, list);
+//                        }else{
+//                            ArrayList list = new ArrayList();
+//                            list.add(temp);
+//                            this.RemainWalkTrips.put(key, list);
+//                        }
+//                    }
+//                }
+//            }
+//        }
 
         // build timeline events based on the traffic
         int o, d, t1, t2, traveler, outward_return, trip = 0, count = 0;
@@ -284,39 +284,43 @@ public class RoutingPlan {
                 origin_loc = U.AL.Location[o];
                 dest_loc = U.AL.Location[d];
                 walking_time = (int) (U.Infrastructure.computeDistance(origin_loc, dest_loc)/GE.AverageTravelSpeed);
-                t1 = (int) h.WalkDispatchTime[1] + walking_time;
-                t2 = (int) t1 + GE.StartReturnOffset + walking_time;
+                t1 = start_time + h.WalkDispatchTime[1] + walking_time;
+                t2 = t1 + GE.StartReturnOffset + walking_time;
                 if (t1 < time_line_length){
+                    System.out.println("T1 Time: " + Integer.toString(t1) + "Walk Dispatch Time: " + h.WalkDispatchTime[1]);
                     ls = this.TimeLineEvents.get(t1);
+//                        System.out.println("Line 291. If ls is empty: " + Boolean.toString(ls.isEmpty()) + "Trip : " + Integer.toString(trip) + " TRANSIMS_HHID : " + Integer.toString(h.TransimsHHID) +  " Origin: " + Integer.toString(o) + " Destination: " + Integer.toString(d));
                     ls.add(new int[]{trip, o, d, 1, h.TransimsHHID, 1});
                     this.TimeLineEvents.put(t1, ls);
-                }else{
-                    if (RemainWalkTrips.containsKey(t1)){
-                        ArrayList temp = RemainWalkTrips.get(t1);
-                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 1});
-                        RemainWalkTrips.put(t1, temp);
-                    }else{
-                        ArrayList temp = new ArrayList();
-                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 1});
-                        RemainWalkTrips.put(t1, temp);
-                    }
                 }
+//                else{
+//                    if (RemainWalkTrips.containsKey(t1)){
+//                        ArrayList temp = RemainWalkTrips.get(t1);
+//                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 1});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }else{
+//                        ArrayList temp = new ArrayList();
+//                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 1});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }
+//                }
                 t1 = t2;
                 if (t1 < time_line_length){
                     ls = this.TimeLineEvents.get(t1);
                     ls.add(new int[]{trip, o, d, 2, h.TransimsHHID, 1});
                     this.TimeLineEvents.put(t1, ls);
-                }else{
-                    if (RemainWalkTrips.containsKey(t1)){
-                        ArrayList temp = RemainWalkTrips.get(t1);
-                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 1});
-                        RemainWalkTrips.put(t1, temp);
-                    }else{
-                        ArrayList temp = new ArrayList();
-                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 1});
-                        RemainWalkTrips.put(t1, temp);
-                    }
                 }
+//                else{
+//                    if (RemainWalkTrips.containsKey(t1)){
+//                        ArrayList temp = RemainWalkTrips.get(t1);
+//                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 1});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }else{
+//                        ArrayList temp = new ArrayList();
+//                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 1});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }
+//                }
                 trip++;
             }
             if (HHwalk2Fuel.contains(h.ID) && h.Demand[2] > 0) {
@@ -326,45 +330,47 @@ public class RoutingPlan {
                 origin_loc = U.AL.Location[o];
                 dest_loc = U.AL.Location[d];
                 walking_time = (int) (U.Infrastructure.computeDistance(origin_loc, dest_loc)/GE.AverageTravelSpeed);
-                t1 = h.WalkDispatchTime[2] + walking_time;
+                t1 = start_time + h.WalkDispatchTime[2] + walking_time;
                 t2 = t1 + GE.StartReturnOffset + walking_time;
                 if (t1 < time_line_length){
                     ls = this.TimeLineEvents.get(t1);
                     ls.add(new int[]{trip, o, d, 1, h.TransimsHHID, 2});
                     this.TimeLineEvents.put(t1, ls);
-                }else{
-                    if (RemainWalkTrips.containsKey(t1)){
-                        ArrayList temp = RemainWalkTrips.get(t1);
-                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 2});
-                        RemainWalkTrips.put(t1, temp);
-                    }else{
-                        ArrayList temp = new ArrayList();
-                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 2});
-                        RemainWalkTrips.put(t1, temp);
-                    }
                 }
+//                else{
+//                    if (RemainWalkTrips.containsKey(t1)){
+//                        ArrayList temp = RemainWalkTrips.get(t1);
+//                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 2});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }else{
+//                        ArrayList temp = new ArrayList();
+//                        temp.add(new int[]{trip, o, d, 1, h.TransimsHHID, 2});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }
+//                }
                 t1 = t2;
                 if (t1 < time_line_length){
                     ls = this.TimeLineEvents.get(t1);
                     ls.add(new int[]{trip, o, d, 2, h.TransimsHHID, 2});
                     this.TimeLineEvents.put(t1, ls);
-                }else{
-                    if (RemainWalkTrips.containsKey(t1)){
-                        ArrayList temp = RemainWalkTrips.get(t1);
-                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 2});
-                        RemainWalkTrips.put(t1, temp);
-                    }else{
-                        ArrayList temp = new ArrayList();
-                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 2});
-                        RemainWalkTrips.put(t1, temp);
-                    }
                 }
+//                else{
+//                    if (RemainWalkTrips.containsKey(t1)){
+//                        ArrayList temp = RemainWalkTrips.get(t1);
+//                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 2});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }else{
+//                        ArrayList temp = new ArrayList();
+//                        temp.add(new int[]{trip, o, d, 2, h.TransimsHHID, 2});
+//                        RemainWalkTrips.put(t1, temp);
+//                    }
+//                }
                 trip++;
             }
         }
 //        System.out.println("**********************TIMELINE EVENT***************************");
         this.TripNumber = trip;
-        writeRemainWalk(write_loc);
+//        writeRemainWalk(write_loc);
     }
 
     public void writeRemainWalk(String loc) throws IOException {