/// <summary> /// Used from regulation modules to add a new local output neuron connected /// to the regulatory neuron of the module we are adding. Also creates /// connections from local inputs to the new local output. /// </summary> public void AskAddModuleToRegModule(UIvariables uiVar, newLink localOutInfo) { _ea.GenomeList[0].GenomeFactory.AddModuleToRegModule( _ea.GenomeList, baseFilesPath, experiment_name, uiVar, localOutInfo); UpdateChampion(); SimpleSavePopulation(); }
/// <summary> /// This is used to clone a module. Note two things: /// 1) The cloned module will never be the active module! (It will be placed /// immediately before.) /// TODO: 2) Complex modules (such as regulation modules) will need some further /// work to make sure the connexions among modules are correct. /// </summary> public void AskCloneModule(UIvariables uiVar, int whichModule) { _ea.GenomeList[0].GenomeFactory.CloneModule( _ea.GenomeList, baseFilesPath, experiment_name, uiVar, whichModule); UpdateChampion(); SimpleSavePopulation(); }
/// <summary> /// Used from UImanager to update the pandemonium state of modules /// without having to add a new module. /// </summary> public void AskUpdatePandem(UIvariables uiVar) { // This method does not require to pass the genome list (it will use // the variable for Optimizer from Factory, as we could do for the // rest of these AskSomething methods). _ea.GenomeList[0].GenomeFactory.UpdatePandem(uiVar); UpdateChampion(); }
/// <summary> /// Sets "whichModule" as active: clones the current champion and moves /// "whichModule" to the end of the genome, then (from UImanager) produces mutations. /// </summary> public void AskSetActive(UIvariables uiVar, int whichModule) { _ea.GenomeList[0].GenomeFactory.SetModuleActive( _ea.GenomeList, baseFilesPath, experiment_name, uiVar, whichModule); // Sets whichModule as the current module in the factory! _ea.GenomeList[0].GenomeFactory.CurrentModule = whichModule; }
/// <summary> /// Used from UImanager to finally proceed with the creation of the /// new module (once we have all the details!) /// </summary> public void AskCreateModule(UIvariables uiVar) { _ea.GenomeList[0].GenomeFactory.AddNewModule( _ea.GenomeList, baseFilesPath, experiment_name, uiVar); UpdateChampion(); SimpleSavePopulation(); // TODO: IMPORTANT NOTICE! // There seems to be a bug here: when a population is loaded the ID // generator is reset to the last value used + 1. Then, only the FIRST // time AskCreateModule is called, even if at the very end of AskCreateModule // the ID generator is more advanced (because elements have been created) // the ID at the exit of AddNewModule is again the original value used // after loading the population. Why? Problems with references? // This is not usually relevant (apparently AddNewModule will find the // correct value again if called a second time, and for some reason in new // calls the problem does not happen again). But AskMutateOnce will // not correct the problem, and it may try to add elements with repeated // IDs, which creates genomes that fail the integrity check. // Easy patch: update the ID generator here. _ea.GenomeList[0].GenomeFactory.InitializeGeneratorAfterLoad(_ea.GenomeList); }
/// <summary> /// Used from UImanager to change the input that goes to a regulatory /// neuron (but not for the new module in AddModule, which is done normally /// with AskCreateModule). /// </summary> public void AskUpdateInToReg(UIvariables uiVar) { _ea.GenomeList[0].GenomeFactory.UpdateInToReg(_ea.GenomeList, uiVar); _ea.GenomeList[0].GenomeFactory.UpdateStatistics(_ea.GenomeList[0]); UpdateChampion(); }
/// <summary> /// Used from UImanager to change only the local output targets of a /// module in the genome population. /// </summary> public void AskChangeTargets(UIvariables uiVar, int whichModule) { _ea.GenomeList[0].GenomeFactory.ChangeTargets(_ea.GenomeList, uiVar, whichModule); UpdateChampion(); }
/// <summary> /// Used from UImanager to change only the protected weights in the /// genome population. /// </summary> public void AskChangeWeights(UIvariables uiVar) { _ea.GenomeList[0].GenomeFactory.ChangeWeights(_ea.GenomeList, uiVar); UpdateChampion(); }