当前位置: 首页>>代码示例>>C#>>正文


C# Population.SetMaxPopulationSize方法代码示例

本文整理汇总了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;
 }
开发者ID:eaclou,项目名称:ANNTrainerProject,代码行数:14,代码来源:Population.cs

示例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();
        }
    }
开发者ID:eaclou,项目名称:ANNTrainerProject,代码行数:33,代码来源:TrainerNewPopulationUI.cs

示例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();
		
	}
开发者ID:eaclou,项目名称:Master_CreatureTrainer01,代码行数:37,代码来源:TrainerNewPopulationUI.cs

示例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;
	}
开发者ID:eaclou,项目名称:Master_CreatureTrainer01,代码行数:18,代码来源:Population.cs


注:本文中的Population.SetMaxPopulationSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。