Almost the same as Divide_Main, but only allows for one mutation on divde and resamples reverted offspring. RESAMPLING ONLY WORKS CORRECTLY WHEN ALL MUTIONS OCCUR ON DIVIDE!! AWC - 07/28/06 */
| 1949 | AWC - 07/28/06 |
| 1950 | */ |
| 1951 | bool cHardwareCPU::Divide_Main1RS(cAvidaContext& ctx, const int div_point, |
| 1952 | const int extra_lines, double mut_multiplier) |
| 1953 | { |
| 1954 | |
| 1955 | //cStats stats = m_world->GetStats(); |
| 1956 | const int child_size = m_memory.GetSize() - div_point - extra_lines; |
| 1957 | |
| 1958 | // Make sure this divide will produce a viable offspring. |
| 1959 | const bool viable = Divide_CheckViable(ctx, div_point, child_size); |
| 1960 | if (viable == false) return false; |
| 1961 | |
| 1962 | // Since the divide will now succeed, set up the information to be sent |
| 1963 | // to the new organism |
| 1964 | InstructionSequencePtr offspring_seq(new InstructionSequence(m_memory.Crop(div_point, div_point + child_size))); |
| 1965 | HashPropertyMap props; |
| 1966 | cHardwareManager::SetupPropertyMap(props, (const char*)m_inst_set->GetInstSetName()); |
| 1967 | Genome offspring(GetType(), props, offspring_seq); |
| 1968 | |
| 1969 | m_organism->OffspringGenome() = offspring; |
| 1970 | |
| 1971 | // Cut off everything in this memory past the divide point. |
| 1972 | m_memory.Resize(div_point); |
| 1973 | |
| 1974 | int totalMutations = 0; |
| 1975 | int mutations = 0; |
| 1976 | // RScount = 0; |
| 1977 | |
| 1978 | bool fitTest = false; |
| 1979 | |
| 1980 | // Handle Divide Mutations... |
| 1981 | /* |
| 1982 | Do mutations until one of these conditions are satisified: |
| 1983 | we have resampled X times |
| 1984 | we have an offspring with the same number of muations as the first offspring |
| 1985 | that is not reverted |
| 1986 | the parent is steralized (usually means an implicit mutation) |
| 1987 | */ |
| 1988 | |
| 1989 | mutations = totalMutations = Divide_DoMutations(ctx, mut_multiplier,1); |
| 1990 | for (int i = 0; i < 100; i++) { |
| 1991 | if (i > 0) { |
| 1992 | mutations = Divide_DoExactMutations(ctx, mut_multiplier,1); |
| 1993 | m_world->GetStats().IncResamplings(); |
| 1994 | } |
| 1995 | |
| 1996 | fitTest = Divide_TestFitnessMeasures1(ctx); |
| 1997 | //if (mutations > 1 ) cerr << "Too Many mutations!!!!!!!!!!!!!!!" << endl; |
| 1998 | if (fitTest == false && mutations >= totalMutations) break; |
| 1999 | |
| 2000 | } |
| 2001 | // think about making this mutations == totalMuations - though this may be too hard... |
| 2002 | /* |
| 2003 | if (RScount > 2) |
| 2004 | cerr << "Resampled " << RScount << endl; |
| 2005 | */ |
| 2006 | //org could not be resampled beneath the hard cap -- it is then steraalized |
| 2007 | if (fitTest/*RScount == 11*/) { |
| 2008 | m_organism->GetPhenotype().ChildFertile() = false; |
nothing calls this directly
no test coverage detected