Esempio n. 1
0
 public void Start()
 {
     CurrentIteration = 0;
     Status           = "Running Model System Setup";
     GetCurrentStatus = (() => NetworkAssignment.ToString());
     GetProgress      = (() => NetworkAssignment.Progress);
     NetworkAssignment.RunModelSystemSetup();
     if (ExitRequested)
     {
         return;
     }
     LoadZoneData();
     if (ExitRequested)
     {
         return;
     }
     Status           = "Running Initial Network Assignment";
     GetCurrentStatus = (() => NetworkAssignment.ToString());
     GetProgress      = (() => NetworkAssignment.Progress);
     NetworkAssignment.RunInitialAssignments();
     GetCurrentStatus = (() => "");
     if (ExitRequested)
     {
         return;
     }
     LoadNetworkData();
     if (ExitRequested)
     {
         return;
     }
     InitializePopulation();
     if (ExitRequested)
     {
         return;
     }
     for (int iteration = 0; iteration < TotalIterations; iteration++)
     {
         if (ExitRequested)
         {
             return;
         }
         foreach (var module in PreIteration)
         {
             Status      = String.Concat("Running Iteration ", (iteration + 1), " of ", TotalIterations, " : ", module.ToString());
             GetProgress = (() => module.Progress);
             module.Start();
         }
         if (iteration == 0)
         {
             TellModesWeAreStartingNewIteration();
             ReProcessWorkSchoolZones();
         }
         var purposeLength = Purpose.Count;
         for (int i = 0; i < purposeLength; i++)
         {
             Status      = String.Concat("Running Iteration ", (iteration + 1), " of ", TotalIterations, " : ", Purpose[i].PurposeName);
             GetProgress = (() => Purpose[i].Progress);
             Purpose[i].Run();
             if (ExitRequested)
             {
                 return;
             }
         }
         GetCurrentStatus = (() => NetworkAssignment.ToString());
         GetProgress      = (() => NetworkAssignment.Progress);
         Status           = String.Concat("Running Network Assignment (", (iteration + 1), " of ", TotalIterations, ")");
         UnloadNetworkData();
         NetworkAssignment.RunNetworkAssignment();
         GetCurrentStatus = (() => "");
         TellModesWeAreEndingIteration();
         // if it isn't the last iteration reprocess the locations that people work and go to school
         if (iteration < TotalIterations - 1)
         {
             CurrentIteration++;
             LoadNetworkData();
             TellModesWeAreStartingNewIteration();
             ReProcessWorkSchoolZones();
         }
     }
     CurrentIteration = TotalIterations;
     if (ExitRequested)
     {
         return;
     }
     GetCurrentStatus = (() => NetworkAssignment.ToString());
     GetProgress      = (() => NetworkAssignment.Progress);
     Status           = "Running Final Network Assignment";
     NetworkAssignment.RunPostAssignments();
     GetCurrentStatus = (() => "");
     if (ExitRequested)
     {
         return;
     }
     Status = "Running Post Run Modules";
     RunPostRunModules();
     GetProgress = (() => 1f);
     Status      = "Shutting Down";
     Population  = null;
     Demographics.UnloadData();
     ZoneSystem.UnloadData();
 }