Example #1
0
        static void Main(String[] args)
        {
            Stopwatch Global = new Stopwatch();

            Global.Start();
            Console.WriteLine("Start");
            //do not check the distributions.
            Control.CheckDistributionParameters = false;

            String ParamPath  = "D:/Documents/ECK";
            String OutputPath = "D:/Documents/ECK";

            String[] ParamFiles = Utils.GetValidParams(ParamPath);

            //Prepare naming Scheme
            string Tag = Utils.GetTag(ParamFiles[0]);

            SimParams Par = new SimParams(reload: true, path: ParamFiles[0]);
            //int x = 1000000;
            //float[] sampler = new float[6]{.8f,.8f,.9f,.5f,.4f,.2f};
            //int[] lol = Par.RandomSampleUnequal(sampler,x,true);

            WriteData Full = Simulations.Basic(Par);

            /* WriteData Temp;
             * WriteData Full = Simulations.Interval(Par, 200, false);
             * for(int j=1;j<2;j++){
             *  Temp = Simulations.Interval(Par, 200, false);
             *  Full.ConCat(Temp, Par);
             * }*/
            Full.Output(Par, OutputPath, Tag, true);

            Console.WriteLine(Global.ElapsedMilliseconds);
            Console.WriteLine("All simulations completed.");
        }
Example #2
0
        static void Main(String[] args)
        {
            Stopwatch Global = new Stopwatch();

            Global.Start();
            Console.WriteLine("Start");
            //do not check the distributions.
            Control.CheckDistributionParameters = false;

            String ParamPath  = "D:/Documents/R/AgentBasedModel/Comparison/";
            String OutputPath = "C:/Users/Karar/Desktop/Output";

            String[] ParamFiles = Utils.GetValidParams(ParamPath);

            //Prepare naming Scheme
            string Tag = Utils.GetTag(ParamFiles[0]);

            SimParams Par  = new SimParams(localBreeding: true);
            WriteData Full = Simulations.Basic(Par);

            /* WriteData Temp;
             * WriteData Full = Simulations.Interval(Par, 200, false);
             * for(int j=1;j<2;j++){
             *  Temp = Simulations.Interval(Par, 200, false);
             *  Full.ConCat(Temp, Par);
             * }*/
            Full.Output(Par, OutputPath, Tag, true);

            Console.WriteLine(Global.ElapsedMilliseconds);
            Console.WriteLine("All simulations completed.");
        }
Example #3
0
        static void Run(string fileName, int repeats, int frequency, string outputPath,
                        bool repAll, bool matchAll, bool ageAll, bool lrnThrshAll, bool accAll,
                        bool chanForAll, bool chanInvAll)
        {
            Stopwatch Local = new Stopwatch();

            Local.Start();
            //Get Parameters and run appropriate Simulation
            SimParams Par = new SimParams(reload: true, path: fileName);
            WriteData Temp;
            WriteData Full = Simulations.Interval(Par, frequency, repAll,
                                                  matchAll, ageAll, lrnThrshAll, accAll, chanForAll, chanInvAll);

            for (int j = 1; j < repeats; j++)
            {
                Temp = Simulations.Interval(Par, frequency, repAll,
                                            matchAll, ageAll, lrnThrshAll, accAll, chanForAll, chanInvAll);
                Full.ConCat(Par, Temp);
            }

            //Save data
            string Tag = Utils.GetTag(fileName);

            Full.Output(Par, outputPath, Tag, true);
            Console.WriteLine("{0}-{1}", fileName, Local.ElapsedMilliseconds);
        }
        static void Main(String[] args) //do not change this line!
        //Starts a timer.  You can omit this.
        {
            Stopwatch Global = new Stopwatch();

            Global.Start();
            //warns that the simulation has started.  You can omit this.
            Console.WriteLine("Start");

            //prevents checks on the distributions; delete if you are changing the library, otherwise leave it alone.
            //I have internal checks to ensure distributions have appropriate boundaries, so this just wastes time.
            Control.CheckDistributionParameters = false;



            //assign arguments that are passed in the console into the right data types.
            //Add more arguments and assignments or deleted unwanted ones as needed.

            String ParamPath  = args[0];                                               //Required argument!
            String OutputPath = args[1];                                               //Required argument!
            int    Optional   = args.Length > 2 ? System.Convert.ToInt32(args[2]) : 4; //optional argument with a default!



            //get the .SEMP files

            //Use the next two lines if you want to change the params here rather than load .SEMPs,
            //and comment out the following three lines.
            //SimParams Par = new SimParams();
            //string Tag = 'new';

            String[] ParamFiles = Utils.GetValidParams(ParamPath);
            //for(int i = 0; i < ParamFiles.length; i++){
            SimParams Par = new SimParams(reload: true, path: ParamFiles[0]); //i instead of 0
            string    Tag = Utils.GetTag(ParamFiles[0]);                      //i instead of 0



            //Basic is not the only simulation option, but should cover most of your needs
            WriteData Full = Simulations.Basic(Par);

            //Writes the data files (.SEMP and .csvs)
            Full.Output(Par, OutputPath, Tag, true);
            //}

            //Note that this code will only run one parameter file.  To do all .SEMPS in a folder,
            //uncomment the for loop and its end bracket and change marked the 0's to i.
            //Also notice that parallelization is absent.  See the IntervalSim program an example of code that parallelizes.



            //Warns how much time has ellasped and that the simulation is over.  you can omit this.
            Console.WriteLine(Global.ElapsedMilliseconds);
            Console.WriteLine("All simulations completed.");
        }
Example #5
0
        static void Run(string fileName, int repeats, int frequency, string outputPath,
                        bool repAll, bool matchAll, bool ageAll, bool lrnThrshAll, bool accAll,
                        bool chanForAll, bool chanInvAll)
        {
            Stopwatch Local = new Stopwatch();

            Local.Start();
            Console.WriteLine("Begin-{0}", fileName);
            //Get Parameters and run appropriate Simulation
            SimParams Par  = new SimParams(reload: true, path: fileName);
            WriteData Full = new WriteData();
            WriteData Temp;
            int       Success = 0;

            while (Success == 0)
            {
                try{
                    Full = Simulations.Interval(Par, frequency, repAll,
                                                matchAll, ageAll, lrnThrshAll, accAll, chanForAll, chanInvAll);
                    Success += 1;
                }catch { Console.WriteLine("Fail-{0}, {1}", fileName, Success); }
            }
            while (Success < repeats)
            {
                try{
                    Temp = Simulations.Interval(Par, frequency, repAll,
                                                matchAll, ageAll, lrnThrshAll, accAll, chanForAll, chanInvAll);
                    Full.ConCat(Par, Temp);
                    Success += 1;
                }catch { Console.WriteLine("Fail-{0}, {1}", fileName, Success); }
            }

            //Save data
            string Tag = Utils.GetTag(fileName);

            Full.Output(Par, outputPath, Tag, true);
            Console.WriteLine("{0}-{1}", fileName, Local.ElapsedMilliseconds);
        }