Ejemplo n.º 1
0
 private static void getExperiments(VertexSystem v, int numJobs, int expID)
 // getExperiments - loads the network instances into experiments.
 {
     jobs = new List <Experiment>(numJobs);
     for (int i = 0; i < numJobs; i++)
     {
         jobs.Add(new Experiment(v, expID));
     }
 }
Ejemplo n.º 2
0
        public static async void PerformExperiment(VertexSystem vs,
                                                   double varMin, double varStep, string varName,
                                                   int numRuns, int numIntervals,
                                                   double initialCondition, double stopCondition,
                                                   int maxIterations, int numJobs, int expID)
        // varNames: R, Gamma, Beta, G, cZero
        {
            DateTime startTime = DateTime.Now;

            getExperiments(vs, numJobs, expID, initialCondition, stopCondition, maxIterations, varName, varMin, varStep);

            if (numRuns > 1)                           //numRuns has to be >= to numJobs
            {
                for (int i = 0; i < numIntervals; i++) //step through the variable parameter.
                {
                    FileIO file = jobs[0].SetFile(i);  //get file name all jobs are just copies of eachother so it doesn't metter which one the method is called on.
                    if (numRuns > numJobs)
                    {
                        for (int j = 0; j < numRuns; j += numJobs)     // this loop runs the jobs on parallel threads. All same work.
                        {
                            await ParallelJobExecutor(numJobs, expID); // releases the main thread until done.

                            WriteResultsToFile(file, expID);
                            SendStatusUpdate(numIntervals, numRuns, i, j + numJobs, startTime);
                        }
                    }
                    else
                    {
                        await ParallelJobExecutor(numRuns, expID);

                        WriteResultsToFile(file, expID);
                        SendStatusUpdate(numIntervals, numRuns, i, numRuns, startTime);
                    }
                    IncrementVarForAllJobs(i);
                    file.CloseFile();
                }
            }
            else
            {
                int      k     = 0;
                FileIO[] files = new FileIO[numJobs];
                for (int i = 0; i < numIntervals; i++) //step through the variable parameter.
                {
                    jobs[k].ExpPars.IncrementVar(i);
                    files[k] = jobs[k].SetFile(i);
                    if (++k >= numJobs)
                    {
                        await ParallelJobExecutor(files, expID);

                        SendStatusUpdate(numIntervals, numRuns, i, 0, startTime); // update GUI status bar.
                        k = 0;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private static void getExperiments(VertexSystem v, int numJobs, int expID,
                                    double initialCondition, double threshold, double maxItr,
                                    string varName, double varMin, double varStep)
 // getExperiments - loads the network instances into experiments.
 {
     jobs = new List <Experiment>(numJobs);
     for (int i = 0; i < numJobs; i++)
     {
         jobs.Add(new Experiment(v, expID, initialCondition, threshold, maxItr, varName, varMin, varStep));
     }
 }
Ejemplo n.º 4
0
        public VertexSystem(VertexSystem v)
        {
            systemState     = DataTools.listCopy(v.systemState);
            systemState_tm1 = DataTools.listCopy(v.systemState);
            adjMat          = DataTools.listCopy(v.adjMat);
            adjList         = DataTools.listCopy(v.adjList);

            parameters = new SystemParameters(v.parameters);

            this.rdn = new Random();
            //this.background = background;

            sysSize = adjMat.Count;

            //ApplyR(1); // reset non-zero entries to 1.



            ready = true;
        }
Ejemplo n.º 5
0
 public Experiment(VertexSystem vState, int expID,
                   double initialCondition, double threshold, double maxItr,
                   string varName, double varMin, double varStep) : this(vState, expID)
 {
     ExpPars = new ExperimentParameters(this.parameters, initialCondition, threshold, maxItr, varName, varMin, varStep);
 }
Ejemplo n.º 6
0
 public Experiment(VertexSystem vState, int expID) : this(vState)
 {
     experimentIndex = expID;
 }
Ejemplo n.º 7
0
        public static event EventHandler <ExperimentCompleteEventArgs> ExperimentComplete; //this event is fired when the experiment is complete.

        public Experiment(VertexSystem vState) : base(vState)
        {
            Results         = new ExperimentResults(1000);
            Results.Success = false;
            //vertState = vState;
        }