문제

Assume that we have a canonical island genetic algorithm with the ring topology. I use C++,PPL and MS Visual Studio 2010.

It is convenient to work with parallel_for from PPL library. What program primitives should I use if the island must get the best current individual from its neighbour when the stagnation flag is on? I don't want to check the array of stagnation flags after parallel_for cycle finalization, I want to feed the "hungry" islands on-the-fly. Does PPL have means for this purpose? Each island has a pointer to its neihbour. I need some sort of critical section within Evolve() method for blocking GetBestIndividual() method. Evolve() is called in parallel (parallel_for cycle for islands).

도움이 되었습니까?

해결책

You can use critical_section object. It's a part of PPL library.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top