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

Method GetTaskProbability

avida-core/source/main/cEnvironment.cc:1580–1606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1578
1579
1580double cEnvironment::GetTaskProbability(cAvidaContext& ctx, cTaskContext& taskctx,
1581 const tList<cReactionProcess>& req_proc, bool& force_mark_task) const
1582{
1583 force_mark_task = false;
1584 if (ctx.GetTestMode()) { //If we're in test-cpu mode, do not do this.
1585 return -1.0;
1586 }
1587
1588 double task_prob = -1.0;
1589 tLWConstListIterator<cReactionProcess> proc_it(req_proc);
1590 cReactionProcess* cur_proc;
1591 bool test_plasticity = false;
1592 while ( (cur_proc = proc_it.Next()) != NULL){ //Determine whether or not we need to test for plastcity
1593 ePHENPLAST_BONUS_METHOD pp_meth = cur_proc->GetPhenPlastBonusMethod();
1594 if (pp_meth != DEFAULT){ //DEFAULT doesn't modify bonuses
1595 test_plasticity = true;
1596 if (pp_meth == FULL_BONUS || pp_meth == FRAC_BONUS) //These will require us to force a task to be marked
1597 force_mark_task = true;
1598 }
1599 }
1600 if (test_plasticity){ //We have to test for plasticity, so try to get it
1601 int task_id = taskctx.GetTaskEntry()->GetID();
1602 task_prob = cPhenPlastUtil::GetTaskProbability(ctx, m_world, taskctx.GetOrganism()->SystematicsGroup("genotype"), task_id);
1603 }
1604 force_mark_task = force_mark_task && (task_prob > 0.0); //If the task isn't demonstrated, we don't need to worry about marking it.
1605 return task_prob;
1606}
1607
1608
1609

Callers

nothing calls this directly

Calls 7

GetTestModeMethod · 0.80
GetTaskEntryMethod · 0.80
SystematicsGroupMethod · 0.80
NextMethod · 0.45
GetIDMethod · 0.45
GetOrganismMethod · 0.45

Tested by

no test coverage detected