1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hadrons: more verbose genetic parameters

This commit is contained in:
Antonin Portelli 2016-12-07 08:59:58 +09:00
parent c56707e003
commit 49c3eeb378

View File

@ -76,7 +76,6 @@ Application::Application(const std::string parameterFileName)
void Application::setPar(const Application::GlobalPar &par) void Application::setPar(const Application::GlobalPar &par)
{ {
par_ = par; par_ = par;
LOG(Message) << par_.seed << std::endl;
env_.setSeed(strToVec<int>(par_.seed)); env_.setSeed(strToVec<int>(par_.seed));
} }
@ -143,11 +142,20 @@ void Application::schedule(void)
return memPeak; return memPeak;
}; };
// constrained topological sort using a genetic algorithm // build module dependency graph
LOG(Message) << "Scheduling computation..." << std::endl; LOG(Message) << "Building module graph..." << std::endl;
unsigned int k = 0, gen, prevPeak, nCstPeak = 0;
auto graph = env_.makeModuleGraph(); auto graph = env_.makeModuleGraph();
auto con = graph.getConnectedComponents(); auto con = graph.getConnectedComponents();
// constrained topological sort using a genetic algorithm
LOG(Message) << "Scheduling computation..." << std::endl;
LOG(Message) << " #module= " << graph.size() << std::endl;
LOG(Message) << " population size= " << par_.genetic.popSize << std::endl;
LOG(Message) << " max. generation= " << par_.genetic.maxGen << std::endl;
LOG(Message) << " max. cst. generation= " << par_.genetic.maxCstGen << std::endl;
LOG(Message) << " mutation rate= " << par_.genetic.mutationRate << std::endl;
unsigned int k = 0, gen, prevPeak, nCstPeak = 0;
std::random_device rd; std::random_device rd;
GeneticScheduler<unsigned int>::Parameters par; GeneticScheduler<unsigned int>::Parameters par;
@ -162,6 +170,7 @@ void Application::schedule(void)
gen = 0; gen = 0;
do do
{ {
LOG(Debug) << "Generation " << gen << ":" << std::endl;
scheduler.nextGeneration(); scheduler.nextGeneration();
if (gen != 0) if (gen != 0)
{ {
@ -174,13 +183,14 @@ void Application::schedule(void)
nCstPeak = 0; nCstPeak = 0;
} }
} }
LOG(Debug) << "generation " << gen << ":\n" << scheduler;
prevPeak = scheduler.getMinValue(); prevPeak = scheduler.getMinValue();
if (gen % 10 == 0) if (gen % 10 == 0)
{ {
LOG(Iterative) << "Generation " << gen << ": " LOG(Iterative) << "Generation " << gen << ": "
<< MEM_MSG(scheduler.getMinValue()) << std::endl; << MEM_MSG(scheduler.getMinValue()) << std::endl;
} }
gen++; gen++;
} while ((gen < par_.genetic.maxGen) } while ((gen < par_.genetic.maxGen)
and (nCstPeak < par_.genetic.maxCstGen)); and (nCstPeak < par_.genetic.maxCstGen));