Thanks Adam. BTW, I suspect there are some bugs in SPEA2: as part of
building the manual a few days ago I went over it and I don't like the
looks of fitness assignment in SPEA2MultiobjectiveFitness, it looks
wrong. We're going to go over it with a fine-toothed comb in a few
days so you may want to hold off any experiments. Or if you're
interested in being involved, let me know.
Sean
On Jul 7, 2010, at 5:51 AM, Adam Spalek wrote:
> Hi Sean,
>
> I have spent some time to improve the performance of the SPEA2 algo
> implemented in ECJ. I had a closer look at
>
> -> SPEA2Breeder.loadElites
> -> SPEA2Evaluator.computeAuxiliaryData
>
> mainly to parallelise the loops and sorts. The code is within my
> custom
> framework hence can't not just simply post the classes. But the key
> areas of
> improvement were
>
> (1) Parallelise the main loop into smaller chunks to calc the
> distances,
> (2) Parallelise the main loop to calc the fitness and
> (3) Use parallel qsort to obtain sortedIndex
>
> The last step add significantly performance by using the parallel Colt
> framework and its provided parallel Quick Sort algorithm. I replace
> your
> insert sort by
>
> for (int i = 0; i < nIndex; i++) {
> sortedIndex[i] = MathUtil.sequenceInt(0, nIndex-1);
> IntComparator c= new DistanceComparator(distances[i]);
> Sorting.parallelQuickSort( sortedIndex[i], 0, nIndex, c);
> }
>
> Where DistanceComparator extends the IntComparator within the
> ParallelColt
> framework. MathUtil is also a class within the same framework.
>
> class DistanceComparator implements IntComparator {
>
> protected double distances[];
>
> public DistanceComparator( double distances[] ) {
> this.distances = distances;
> }
>
> @Override
> public int compare(int o1, int o2) {
>
> if( distances[o1] > distances[o2] )
> return 1;
> else if( distances[o1] < distances[o2] )
> return -1;
> else
> return 0;
> }
>
> }
>
> Maybe worth adding this to the head of branch?
>
> PS: Let me know if you are interested so I can post you the
> individual classes.
|