Package org.encog.engine.concurrency

Examples of org.encog.engine.concurrency.TaskGroup


  public void process() {
    Object task;

    this.totalTasks = loadWorkload();
    int currentTask = 0;
    TaskGroup group = EngineConcurrency.getInstance().createTaskGroup();

    while (((task = requestNextTask()) != null) && !shouldStop) {
      currentTask++;
      final JobUnitContext context = new JobUnitContext();
      context.setJobUnit(task);
      context.setOwner(this);
      context.setTaskNumber(currentTask);

      final JobUnitWorker worker = new JobUnitWorker(context);
      EngineConcurrency.getInstance().processTask(worker, group);
    }

    group.waitForComplete();

    EngineConcurrency.getInstance().checkError();
  }
View Full Code Here


    this.workers[0].getNetwork().clearContext();
    this.totalError = 0;

    if (this.workers.length > 1) {

      final TaskGroup group = EngineConcurrency.getInstance()
          .createTaskGroup();

      for (final FlatGradientWorker worker : this.workers) {
        EngineConcurrency.getInstance().processTask(worker, group);
      }

      group.waitForComplete();
    } else {
      this.workers[0].run();
    }

    this.currentError = this.totalError / this.workers.length;
View Full Code Here

TOP

Related Classes of org.encog.engine.concurrency.TaskGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.