// use an agentfactory to create the population public IPopulation create(IAgentFactory afact, int size) { IPopulation pop = new Population(); if (LoggerDiags.Enabled) { SingletonLogger.Instance().InfoLog(typeof(PopulationFactory), "PopulationFactory creating " + size + " agents using IAgentFactory = " + afact.ToString()); } afact.Distribution.setTotalSamples(size); for (int i = 0; i < size; i++) { IAgent ag = afact.create(); if (LoggerDiags.Enabled) { SingletonLogger.Instance().DebugLog(typeof(PopulationFactory), "PopulationFactory created Agent # " + i + " : " + ag); } pop.addAgent(ag); } return(pop); }
void ChangeCurrentAgentFactory(IAgentFactory newAgentFactory) { Debug.Log("Agent changed" + newAgentFactory.ToString()); agentFactory = newAgentFactory; }