Holds basic configuration information for an Encog job.
Esempio n. 1
0
        /// <summary>
        /// Start the job, block until its done.
        /// </summary>
        public virtual void Process()
        {
            Object task;

            TaskGroup group = EngineConcurrency.Instance.CreateTaskGroup();

            this.totalTasks = LoadWorkload();
            int currentTask = 0;

            while ((task = RequestNextTask()) != null)
            {
                currentTask++;
                JobUnitContext context = new JobUnitContext();
                context.JobUnit    = task;
                context.Owner      = this;
                context.TaskNumber = currentTask;

                JobUnitWorker worker = new JobUnitWorker(context);
                EngineConcurrency.Instance.ProcessTask(worker, group);
            }

            group.WaitForComplete();
        }
Esempio n. 2
0
    /// <summary>
    /// Construct a job unit worker to execute the specified job.
    /// </summary>
    /// <param name="context">The context of the job to execute.</param>
	public JobUnitWorker(JobUnitContext context)
	{
		this.context = context;
	}
Esempio n. 3
0
 /// <summary>
 /// Recieve status reports.
 /// </summary>
 /// <param name="context">The context for this job.</param>
 /// <param name="status">The current status for this job.</param>
 public void ReportStatus(JobUnitContext context, String status)
 {
     this.report.Report(totalTasks, context.TaskNumber, status);
 }
Esempio n. 4
0
 /// <summary>
 /// Perform the actual workload.
 /// </summary>
 /// <param name="context">The workload to execute.</param>
 public abstract void PerformJobUnit(JobUnitContext context);
        /// <summary>
        /// Evaluate one network.
        /// </summary>
        /// <param name="context">The job context.</param>
        public override void PerformJobUnit(JobUnitContext context)
        {

            BasicNetwork network = (BasicNetwork)context.JobUnit;

            // train the neural network
            ITrain train = new ResilientPropagation(network, this.training);

            for (int i = 0; i < this.iterations; i++)
            {
                train.Iteration();
            }

            double error = train.Error;

            if ((error < this.bestResult) || (this.bestNetwork == null))
            {
#if logging
                if (this.logger.IsDebugEnabled)
                {
                    this.logger.Debug("Prune found new best network: error="
                            + error + ", network=" + network);
                }
#endif
                this.bestNetwork = network;
                this.bestResult = error;
            }
            this.currentTry++;

            this.ReportStatus(context,
                    "Current: " + PruneIncremental.NetworkToString(network)
                    + ", Best: "
                    + PruneIncremental.NetworkToString(this.bestNetwork));

        }
        /// <summary>
        /// Start the job, block until its done.
        /// </summary>
        public virtual void Process()
        {
            Object task;

            TaskGroup group = EngineConcurrency.Instance.CreateTaskGroup();

            this.totalTasks = LoadWorkload();
            int currentTask = 0;

            while ((task = RequestNextTask()) != null)
            {
                currentTask++;
                JobUnitContext context = new JobUnitContext();
                context.JobUnit = task;
                context.Owner = this;
                context.TaskNumber = currentTask;

                JobUnitWorker worker = new JobUnitWorker(context);
                EngineConcurrency.Instance.ProcessTask(worker, group);
            }

            group.WaitForComplete();
        }
 /// <summary>
 /// Perform the actual workload.
 /// </summary>
 /// <param name="context">The workload to execute.</param>
 public abstract void PerformJobUnit(JobUnitContext context);
 /// <summary>
 /// Recieve status reports.
 /// </summary>
 /// <param name="context">The context for this job.</param>
 /// <param name="status">The current status for this job.</param>
 public void ReportStatus(JobUnitContext context, String status)
 {
     this.report.Report(totalTasks, context.TaskNumber, status);
 }
Esempio n. 9
0
 /// <summary>
 /// Construct a job unit worker to execute the specified job.
 /// </summary>
 /// <param name="context">The context of the job to execute.</param>
 public JobUnitWorker(JobUnitContext context)
 {
     this.context = context;
 }