Exemplo n.º 1
0
        void runThread(object o)
        {
            stopWatch = new Stopwatch();
            stopWatch.Start();

            Job currentJob;
            epochHandler = new NeuronDotNet.Core.TrainingEpochEventHandler(Network_EndEpochEvent);
            // Thread.CurrentThread.Name = o.ToString();
            while (Thread.CurrentThread.IsAlive)
            {

                //Thread.CurrentThread.Name = o.ToString();
                Job job = null;
                lock (jobs)
                {
                    if (jobs.Count > 0)
                    {
                        job = jobs.Dequeue();
                    }
                    Utils.Logger.Log("Jobs left: {0}", jobs.Count);
                }
                if (job == null)
                {
                    changeThreadProgress(Int32.Parse(Thread.CurrentThread.Name), -1, -1, "No more jobs!");
                    return;
                }

                currentJob = job;

                Optimiser optimiser = new Optimiser(job.Filename);

                optimiser.Network.EndEpochEvent += epochHandler;

                double mes = 1;

                mes = optimiser.Optimise();
                optimiser.Network.EndEpochEvent -= epochHandler;

            }
            changeThreadProgress(Int32.Parse(Thread.CurrentThread.Name), -1, -1, "No more jobs!");
        }
Exemplo n.º 2
0
        private static void runThread(object o)
        {
            Job currentJob;

            // Thread.CurrentThread.Name = o.ToString();
            while (Thread.CurrentThread.IsAlive)
            {

                //Thread.CurrentThread.Name = o.ToString();
                Job job = null;
                lock (jobs)
                {
                    if (jobs.Count > 0)
                    {
                        job = jobs.Dequeue();
                    }
                }
                if (job == null)
                {
                    Utils.Logger.Log("Jobs done!");
                    return;
                }

                currentJob = job;
                Utils.Logger.Log("Optimising job: " + job.Filename);

                Optimiser optimiser = new Optimiser(job.Filename);

                double mes = 1;

                mes = optimiser.Optimise();
            }
        }