protected virtual LGPRegisterSet CreateRegisterSet() { LGPRegisterSet reg_set = new LGPRegisterSet(); int reg_count = mPop.RegisterCount; for (int i = 0; i < reg_count; ++i) { reg_set.AddRegister(new LGPRegister()); } return(reg_set); }
public LGPRegisterSet Clone() { LGPRegisterSet clone = new LGPRegisterSet(); clone.mWeightSum = mWeightSum; foreach (KeyValuePair <LGPRegister, double> point in mRegisters) { clone.mRegisters.Add(new KeyValuePair <LGPRegister, double>(point.Key.Clone(), point.Value)); } return(clone); }
public void Copy(LGPProgram rhs) { mSetup = rhs.mSetup; mFitness = rhs.mFitness; mObjectiveValue = rhs.mObjectiveValue; mIsFitnessValid = rhs.mIsFitnessValid; mRegisterSet = rhs.mRegisterSet.Clone(); mOperatorSet = rhs.mOperatorSet.Clone(); mConstantSet = rhs.mConstantSet.Clone(); mPop = rhs.mPop; for (int i = 0; i < rhs.mInstructions.Count; ++i) { mInstructions.Add(rhs.mInstructions[i].Clone()); mInstructions[i].Program = this; } }
public void Setup() { mRegisterSet = CreateRegisterSet(); mConstantSet = CreateConstantSet(); mSetup = true; }