Examples of TaskGroup


Examples of org.encog.util.concurrency.TaskGroup

    this.totalError = 0;

    if (this.workers.length > 1) {

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

      for (final GradientWorker 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

Examples of org.encog.util.concurrency.TaskGroup

        this.workers[0].getNetwork().clearContext();
      }

      if (this.workers.length > 1) {

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

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

        group.waitForComplete();
      } else {
        this.workers[0].setOutputNeuron(outputNeuron);
        this.workers[0].run();
      }
     
View Full Code Here

Examples of org.encog.util.concurrency.TaskGroup

    this.totalError = 0;

    if (this.workers.length > 1) {

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

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

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

    this.setError(this.totalError / this.workers.length);
View Full Code Here

Examples of org.encog.util.concurrency.TaskGroup

     * Internal method for the iteration of the swarm.
     *
     * @param init  true if this is an initialisation iteration.
     */
    protected void iterationPSO(boolean init) {
        final TaskGroup group = EngineConcurrency.getInstance().createTaskGroup();

        for (int i = 0; i < m_populationSize; i++) {
            NeuralPSOWorker worker = new NeuralPSOWorker(this, i, init);
            if (!init && this.isMultiThreaded()) {
                EngineConcurrency.getInstance().processTask(worker, group);
            } else {
                worker.run();
            }
        }
        if (this.isMultiThreaded()) {
            group.waitForComplete();
        }
        updateGlobalBestPosition();
    }
View Full Code Here

Examples of org.encog.util.concurrency.TaskGroup

    EngineConcurrency.getInstance().setThreadCount(this.threadCount);

    this.running = true;
    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();
    this.running = false;
    EngineConcurrency.getInstance().checkError();   
  }
View Full Code Here

Examples of org.libreplan.business.planner.entities.TaskGroup

        Order order = project.order;

        TaskSource taskSource = TaskSource.createForGroup(order
                .getCurrentSchedulingDataForVersion());

        TaskGroup taskGroup = taskSource
                .createTaskGroupWithoutDatesInitializedAndLinkItToTaskSource();

        BaseCalendar calendar = configurationDAO.getConfiguration()
                .getDefaultCalendar();

        taskGroup.setCalendar(calendar);

        List<TaskElement> taskElements = new ArrayList<TaskElement>();

        for (OrderElementDTO importTask : project.tasks) {

            taskElements.add(createTask(importTask, importCalendar));

        }

        for (MilestoneDTO milestone : project.milestones) {

            taskElements.add(createTaskMilestone(milestone));

        }

        for (TaskElement taskElement : taskElements) {
            taskGroup.addTaskElement(taskElement);
        }

        return taskGroup;

    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.TaskGroup

    @Transactional
    public void taskIsBlockedIfHasAnUnfinishedEndStartDependencyUsingGroup() {
         Task task1 = createValidTaskWithFullProgress();
         Task task2 = createValidTask();
         task2.setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
         TaskGroup taskGroup = new TaskGroup();
         taskGroup.addTaskElement(task1);
         taskGroup.addTaskElement(task2);
         mockDependency(taskGroup, this.task, Type.END_START);
         assertFalse(task.isFinished());
         assertFalse(task.isInProgress());
         assertTrue(task.getTaskStatus() == TaskStatusEnum.BLOCKED);
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.TaskGroup

    @Transactional
    public void taskDependenciesDontMatterIfProgressIsNotZero() {
         Task task1 = createValidTaskWithFullProgress();
         Task task2 = createValidTask();
         task2.setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
         TaskGroup taskGroup = new TaskGroup();
         taskGroup.addTaskElement(task1);
         taskGroup.addTaskElement(task2);
         mockDependency(taskGroup, this.task, Type.END_START);
         task.setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
         assertFalse(task.isFinished());
         assertTrue(task.getTaskStatus() == TaskStatusEnum.IN_PROGRESS);
         task.setAdvancePercentage(BigDecimal.ONE);
View Full Code Here

Examples of org.libreplan.business.planner.entities.TaskGroup

        }

        @Override
        protected TaskElement apply(List<TaskElement> children,
                IOptionalPersistence persistence) {
            TaskGroup result = TaskGroup.create(taskSource);
            for (TaskElement taskElement : children) {
                result.addTaskElement(taskElement);
            }
            taskSource.setTask(result);
            persistence.save(taskSource);
            return result;
        }
View Full Code Here

Examples of org.libreplan.business.planner.entities.TaskGroup

        }

        @Override
        protected TaskElement apply(List<TaskElement> children,
                IOptionalPersistence persistence) {
            TaskGroup taskGroup = (TaskGroup) taskSource.getTask();
            taskGroup.setTaskChildrenTo(children);
            updateTaskWithOrderElement(taskGroup, taskSource.getOrderElement());
            persistence.save(taskSource);
            return taskGroup;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.