本文整理汇总了C#中Population.SetMaxPopulationSize方法的典型用法代码示例。如果您正苦于以下问题:C# Population.SetMaxPopulationSize方法的具体用法?C# Population.SetMaxPopulationSize怎么用?C# Population.SetMaxPopulationSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Population
的用法示例。
在下文中一共展示了Population.SetMaxPopulationSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyPopulationSettings
public Population CopyPopulationSettings()
{
// returns a copy of the current Population instance calling the function i.e. Population newPop = new Population(); newPop = sourcePop.CopyPopulation();
Population populationCopy = new Population();
populationCopy.SetMaxPopulationSize(populationMaxSize);
populationCopy.brainType = brainType;
populationCopy.templateBrain = templateBrain;
populationCopy.numInputNodes = numInputNodes;
populationCopy.numOutputNodes = numOutputNodes;
populationCopy.numAgents = numAgents;
populationCopy.InitializeMasterAgentArray();
//populationCopy = this;
return populationCopy;
}
示例2: ClickCreateNewPopulation
public void ClickCreateNewPopulation()
{
DebugBot.DebugFunctionCall("TNewPopUI; ClickCreateNewPopulation(); ", debugFunctionCalls);
if(populationRef.brainType != Population.BrainType.None) { // BrainType needs to BE something
Trainer trainer = trainerModuleScript.gameController.masterTrainer;
if(trainer.PlayerList != null) { // if there is a valid PlayerList
int curPlayer = trainer.CurPlayer;
if(trainer.PlayerList[curPlayer-1] != null) { // If Current Player exists
populationRef = trainer.PlayerList[curPlayer-1].masterPopulation; // grab current player's population -- this might not be needed
populationRef.SetMaxPopulationSize(pendingPopulationSize);
populationRef.numInputNodes = pendingNumInputs;
populationRef.numOutputNodes = pendingNumOutputs;
// !!!!!!! Transfer over specific Brain-Type Options!
// Or Do I simply change these values in real-time as they are selected by UI?
//===================================================
// CREATE AGENT ARRAY!!!!!!! :
populationRef.InitializeMasterAgentArray();
trainer.PlayerList[curPlayer-1].hasValidPopulation = true;
}
else {
DebugBot.DebugFunctionCall("TNewPopUI; ClickCreateNewPopulation(); Null Player Ref!", debugFunctionCalls);
}
}
trainerModuleScript.ClickPopulation(); // switches to Population Panel -- might not be necessary?
trainer.PlayerList[trainer.CurPlayer-1].graphKing.BuildTexturesCurAgentPerAgent(trainer.PlayerList[trainer.CurPlayer-1], 0);
trainerModuleScript.SetAllPanelsFromTrainerData();
}
}
示例3: ClickCreateNewPopulation
public void ClickCreateNewPopulation() {
DebugBot.DebugFunctionCall("TNewPopUI; ClickCreateNewPopulation(); ", debugFunctionCalls);
Trainer trainer = trainerModuleScript.gameController.masterTrainer; // ?? why only set up reference here???
if(trainer.PlayerList != null) { // if there is a valid PlayerList
int curPlayer = trainer.CurPlayer;
if(trainer.PlayerList[curPlayer-1] != null) { // If Current Player exists
populationRef = trainer.PlayerList[curPlayer-1].masterPopulation; // grab current player's population -- this might not be needed
populationRef.SetMaxPopulationSize(pendingPopulationSize);
if (toggleZeroedWeights.isOn) {
populationRef.initRandom = false;
}
else {
populationRef.initRandom = true;
}
populationRef.initNumHiddenNodes = pendingNumHiddenNodes;
populationRef.initConnectedness = pendingConnectedness;
// CREATE AGENT ARRAY!!!!!!! :
CritterGenome genomeToLoad = ES2.Load<CritterGenome>(pendingBodyTemplateFilename);
CrossoverManager.nextNodeInnov = genomeToLoad.savedNextNodeInno;
CrossoverManager.nextAddonInnov = genomeToLoad.savedNextAddonInno;
populationRef.InitializeMasterAgentArray(genomeToLoad, trainer.PlayerList[curPlayer - 1].masterCupid.useSpeciation);
trainer.PlayerList[curPlayer-1].hasValidPopulation = true;
}
else {
DebugBot.DebugFunctionCall("TNewPopUI; ClickCreateNewPopulation(); Null Player Ref!", debugFunctionCalls);
}
}
trainerModuleScript.ClickPopulation(); // switches to Population Panel -- might not be necessary?
trainer.PlayerList[trainer.CurPlayer-1].graphKing.BuildTexturesCurAgentPerAgent(trainer.PlayerList[trainer.CurPlayer-1], 0);
trainerModuleScript.SetAllPanelsFromTrainerData();
}
示例4: CopyPopulationSettings
public Population CopyPopulationSettings() { // returns a copy of the current Population instance calling the function i.e. Population newPop = new Population(); newPop = sourcePop.CopyPopulation();
Population populationCopy = new Population();
populationCopy.SetMaxPopulationSize(populationMaxSize);
//populationCopy.brainType = brainType;
//populationCopy.templateBrain = templateBrain;
populationCopy.templateGenome = templateGenome;
populationCopy.numInputNodes = numInputNodes;
populationCopy.numOutputNodes = numOutputNodes;
populationCopy.numAgents = numAgents;
//populationCopy.InitializeMasterAgentArray(templateGenome); // CONFIRM THIS SHOULD BE USED!! MIGHT WANT TO JUST COPY AGENTS!!!!
// ^ ^ ^ Looks like this is used in the CrossoverManager to break the reference connection to the AgentArray when copying the main Population
// .... Seems like this is just needed to assign new memmory for the swapPopulation agentArray, to allow for proper data transfer
// .... between the sourcePopulation and the new Copy (which will hold the next generation). New agents are setup at birth time.
//populationCopy.masterAgentArray = masterAgentArray;
//populationCopy = this;
return populationCopy;
}