private void RunTasha(int householdIndex)
        {
            var hhld = Households[householdIndex];

            try
            {
                if (ModeChoice.Run(hhld))
                {
                    HouseholdEvaluation[householdIndex] = EvaluateHousehold(hhld);
                }
                else
                {
                    SetToMax(householdIndex, hhld);
                }
            }
            catch (Exception e)
            {
                if (e is XTMFRuntimeException)
                {
                    Console.WriteLine(e.Message);
                }
                else
                {
                    Console.WriteLine(e.Message + "\r\n" + e.StackTrace);
                }
                SetToMax(householdIndex, hhld);
            }
            Interlocked.Increment(ref ProcessedSoFar);
            Progress = ProcessedSoFar / (float)HouseholdEvaluation.Length;
        }
Exemple #2
0
        private void Run(int i, ITashaHousehold hhld)
        {
            if (!_ExitRequested)
            {
                var watch = System.Diagnostics.Stopwatch.StartNew();
                if (Scheduler != null)
                {
                    Scheduler.Run(hhld);
                    if (PostScheduler != null)
                    {
                        foreach (var module in PostScheduler)
                        {
                            module.Execute(hhld);
                        }
                    }
                }

                if (ModeChoice != null)
                {
                    if (!ModeChoice.Run(hhld))
                    {
                        Interlocked.Increment(ref FailedModeChoice);
                    }
                }

                if (PostHousehold != null)
                {
                    foreach (var module in PostHousehold)
                    {
                        module.Execute(hhld, i);
                    }
                }
                Interlocked.Increment(ref CurrentHousehold);
                if (CurrentHousehold % 1000 == 0)
                {
                    watch.Stop();
                    Console.WriteLine($"hhld#{hhld.HouseholdId} : {watch.ElapsedMilliseconds}");
                }
                if (RecycleHouseholdData)
                {
                    ReleaseModeData(hhld);
                    hhld.Recycle();
                }
            }
        }
Exemple #3
0
        private void Run(int i, ITashaHousehold hhld)
        {
            if (!_ExitRequested)
            {
                if (Scheduler != null)
                {
                    Scheduler.Run(hhld);
                    if (PostScheduler != null)
                    {
                        foreach (var module in PostScheduler)
                        {
                            module.Execute(hhld);
                        }
                    }
                }

                if (ModeChoice != null)
                {
                    if (!ModeChoice.Run(hhld))
                    {
                        Interlocked.Increment(ref FailedModeChoice);
                    }
                }

                if (PostHousehold != null)
                {
                    foreach (var module in PostHousehold)
                    {
                        module.Execute(hhld, i);
                    }
                }
                Interlocked.Increment(ref CurrentHousehold);

                if (RecycleHouseholdData)
                {
                    ReleaseModeData(hhld);
                    hhld.Recycle();
                }
            }
        }