MCPcopy Create free account
hub / github.com/devosoft/avida / GetNextID

Method GetNextID

avida-core/source/tools/cProbDemeProbSchedule.cc:39–52  ·  view source on GitHub ↗

get the next CPU cycle, awarded probabistically to a deme based on population with non-zero merits

Source from the content-addressed store, hash-verified

37
38//get the next CPU cycle, awarded probabistically to a deme based on population with non-zero merits
39int cProbDemeProbSchedule::GetNextID()
40{
41 //choose a deme to schedule
42 curr_deme = demeChart.FindPosition(m_rng->GetDouble(demeChart.GetTotalWeight()));
43
44 //calculate the offset
45 int offset = curr_deme * deme_size;
46
47 // get the within postion of the node whos corresponding cell will get the CPU cycle
48 const double position = m_rng->GetDouble(chart[curr_deme]->GetTotalWeight());
49
50 // return the adjusted ID of the cell to get the CPU cycle
51 return chart[curr_deme]->FindPosition(position) + offset;
52}
53
54
55//adjust the weight of an org within deme -- adjust the weighting for scheduling that deme

Callers

nothing calls this directly

Calls 3

FindPositionMethod · 0.45
GetDoubleMethod · 0.45
GetTotalWeightMethod · 0.45

Tested by

no test coverage detected