Exemple #1
0
        /**
         * Summarize results of the simulation for the Village
         *
         * @return a summary of the simulation results for the village
         */
        public Results getResults()
        {
            List <Results> fval = new List <Results> ();

            for (int i = 0; i < this.forward.Length; ++i)
            {
                Village v = this.forward [i];
                if (v != null)
                {
                    fval.Add(v.getResults());
                }
            }

            Results r = new Results();

            for (int i = 0; i < fval.Count; ++i)
            {
                r.totalHospitals = r.totalHospitals + fval [i].totalHospitals;
                r.totalPatients  = r.totalPatients + fval [i].totalPatients;
                r.totalTime      = r.totalTime + fval [i].totalTime;
            }

            for (int j = 0; j < this.returned.Count; ++j)
            {
                Patient p = this.returned [j];
                r.totalHospitals = r.totalHospitals + p.hospitalsVisited;
                r.totalTime      = r.totalTime + p.time;
                r.totalPatients  = r.totalPatients + 1;
            }
            return(r);
        }
Exemple #2
0
        /**
         * The main routnie which creates the data structures for the Columbian
         * health-care system and executes the simulation for a specified time.
         *
         * @param args the command line arguments
         */
        public static void Main(String[] args, ILog ilog)
        {
            logger = ilog;
            parseCmdLine(args);

            Village.initVillageStatic();

            Village top = Village.createVillage(maxLevel, 0, true, 1);

            if (printMsgs)
            {
                logger.InfoFormat("Columbian Health Care Simulator\nWorking...");
            }

            for (int i = 0; i < maxTime; i++)
            {
                top.simulate();
            }

            Results r = top.getResults();

            if (printResult)
            {
                logger.InfoFormat("# People treated: " + (int)r.totalPatients);
                logger.InfoFormat("Avg. length of stay: " + r.totalTime / r.totalPatients);
                logger.InfoFormat("Avg. # of hospitals visited: " + r.totalHospitals / r.totalPatients);
            }

            logger.InfoFormat("Done!");
        }