/** * Creates the assignment tasks given the number of threads requested */ protected void createAssignmentTasks() { int numThreads = this.getNumThreads(); // if the number of requested components is less than 1, then ArrayList<ArrayList<DataType>> partitions = SequentialDataMultiPartitioner.create( this.getData(), numThreads ); this.assignmentTasks = new ArrayList<Callable<int[]>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { this.assignmentTasks.add( new AssignDataToCluster( partitions.get( i ) ) ); } // Create the tasks that will assign data point onto clusters to // re-estimate the cluster locations int numClusters = this.getNumClusters(); this.clusterCreatorTask = new ArrayList<Callable<ClusterType>>( numClusters ); for( int i = 0; i < numClusters; i++ ) { this.clusterCreatorTask.add( new CreateClustersFromAssignments() ); } }
/** * Creates the assignment tasks given the number of threads requested */ protected void createAssignmentTasks() { int numThreads = this.getNumThreads(); // if the number of requested components is less than 1, then ArrayList<ArrayList<DataType>> partitions = SequentialDataMultiPartitioner.create( this.getData(), numThreads ); this.assignmentTasks = new ArrayList<Callable<int[]>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { this.assignmentTasks.add( new AssignDataToCluster( partitions.get( i ) ) ); } // Create the tasks that will assign data point onto clusters to // re-estimate the cluster locations int numClusters = this.getNumClusters(); this.clusterCreatorTask = new ArrayList<Callable<ClusterType>>( numClusters ); for( int i = 0; i < numClusters; i++ ) { this.clusterCreatorTask.add( new CreateClustersFromAssignments() ); } }
/** * Creates the assignment tasks given the number of threads requested */ protected void createAssignmentTasks() { int numThreads = this.getNumThreads(); // if the number of requested components is less than 1, then ArrayList<ArrayList<DataType>> partitions = SequentialDataMultiPartitioner.create( this.getData(), numThreads ); this.assignmentTasks = new ArrayList<Callable<int[]>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { this.assignmentTasks.add( new AssignDataToCluster( partitions.get( i ) ) ); } // Create the tasks that will assign data point onto clusters to // re-estimate the cluster locations int numClusters = this.getNumClusters(); this.clusterCreatorTask = new ArrayList<Callable<ClusterType>>( numClusters ); for( int i = 0; i < numClusters; i++ ) { this.clusterCreatorTask.add( new CreateClustersFromAssignments() ); } }
/** * Splits the data across the numComponents cost functions */ protected void createPartitions() { int numThreads = this.getNumThreads(); ArrayList<ArrayList<InputOutputPair<? extends Vector, Vector>>> partitions = SequentialDataMultiPartitioner.create( this.getCostParameters(), numThreads ); this.evaluationComponents = new ArrayList<Callable<Object>>( numThreads ); this.gradientComponents = new ArrayList<Callable<Object>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { ParallelizableCostFunction subcost = (ParallelizableCostFunction) this.getCostFunction().clone(); subcost.setCostParameters( partitions.get(i) ); this.evaluationComponents.add( new SubCostEvaluate( subcost, null ) ); this.gradientComponents.add( new SubCostGradient( subcost, null ) ); } }
/** * Splits the data across the numComponents cost functions */ protected void createPartitions() { int numThreads = this.getNumThreads(); ArrayList<ArrayList<InputOutputPair<? extends Vector, Vector>>> partitions = SequentialDataMultiPartitioner.create( this.getCostParameters(), numThreads ); this.evaluationComponents = new ArrayList<Callable<Object>>( numThreads ); this.gradientComponents = new ArrayList<Callable<Object>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { ParallelizableCostFunction subcost = (ParallelizableCostFunction) this.getCostFunction().clone(); subcost.setCostParameters( partitions.get(i) ); this.evaluationComponents.add( new SubCostEvaluate( subcost, null ) ); this.gradientComponents.add( new SubCostGradient( subcost, null ) ); } }
/** * Splits the data across the numComponents cost functions */ protected void createPartitions() { int numThreads = this.getNumThreads(); ArrayList<ArrayList<InputOutputPair<? extends Vector, Vector>>> partitions = SequentialDataMultiPartitioner.create( this.getCostParameters(), numThreads ); this.evaluationComponents = new ArrayList<Callable<Object>>( numThreads ); this.gradientComponents = new ArrayList<Callable<Object>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { ParallelizableCostFunction subcost = (ParallelizableCostFunction) this.getCostFunction().clone(); subcost.setCostParameters( partitions.get(i) ); this.evaluationComponents.add( new SubCostEvaluate( subcost, null ) ); this.gradientComponents.add( new SubCostGradient( subcost, null ) ); } }
/** * Creates the evaluation tasks to execute in parallel. * * @param population * The population to create tasks for. */ protected void createEvaluationTasks( Collection<GenomeType> population ) { if( this.getThreadPool() == null ) { this.setThreadPool( ParallelUtil.createThreadPool() ); } int numThreads = this.getNumThreads(); ArrayList<ArrayList<GenomeType>> partitions = SequentialDataMultiPartitioner.create( population, numThreads ); this.evaluateTasks = new ArrayList<Callable<ArrayList<EvaluatedGenome<GenomeType>>>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { this.evaluateTasks.add( new EvaluateGenome( partitions.get( i ) ) ); } }
/** * Creates the evaluation tasks to execute in parallel. * * @param population * The population to create tasks for. */ protected void createEvaluationTasks( Collection<GenomeType> population ) { if( this.getThreadPool() == null ) { this.setThreadPool( ParallelUtil.createThreadPool() ); } int numThreads = this.getNumThreads(); ArrayList<ArrayList<GenomeType>> partitions = SequentialDataMultiPartitioner.create( population, numThreads ); this.evaluateTasks = new ArrayList<Callable<ArrayList<EvaluatedGenome<GenomeType>>>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { this.evaluateTasks.add( new EvaluateGenome( partitions.get( i ) ) ); } }
/** * Creates the evaluation tasks to execute in parallel. * * @param population * The population to create tasks for. */ protected void createEvaluationTasks( Collection<GenomeType> population ) { if( this.getThreadPool() == null ) { this.setThreadPool( ParallelUtil.createThreadPool() ); } int numThreads = this.getNumThreads(); ArrayList<ArrayList<GenomeType>> partitions = SequentialDataMultiPartitioner.create( population, numThreads ); this.evaluateTasks = new ArrayList<Callable<ArrayList<EvaluatedGenome<GenomeType>>>>( numThreads ); for( int i = 0; i < numThreads; i++ ) { this.evaluateTasks.add( new EvaluateGenome( partitions.get( i ) ) ); } }