Beispiel #1
0
 /// <summary>
 ///     Clear agents between two iterations
 /// </summary>
 public void Clear()
 {
     State = AgentState.Starting;
     Agents.Clear();
     StoppedAgents.Clear();
     _agentsReference.ForEach(x => Agents.Add(x));
     //todo => _agentsReference.ForEach(x => Agents.Add(x.Clone())); and change SetAGents
 }
Beispiel #2
0
        /// <summary>
        ///     Stops the execution of the agent identified by name and removes it from the environment. Use the Remove method
        ///     instead of Agent.Stop
        ///     when the decision to stop an agent does not belong to the agent itself, but to some other agent or to an external
        ///     factor.
        ///     Don't call it directly, use WhitePages.RemoveAgent
        /// </summary>
        /// <param name="agent">The agent to be removed</param>
        public void RemoveAgent(ReactiveAgent agent)
        {
            if (agent == null)
            {
                throw new ArgumentNullException(nameof(agent));
            }

            //MetaNetwork.RemoveActor(agent.AgentId);
            Agents.Remove(agent.AgentId);
            StoppedAgents.Add(agent);
        }
Beispiel #3
0
 /// <summary>
 ///     Returns a list with the names of all the agents that contain a certain string.
 /// </summary>
 /// <returns>The name fragment that the agent names should contain</returns>
 public ushort FilteredStoppedAgentsByClassIdCount(IClassId classId)
 {
     return((ushort)StoppedAgents.Count(a => a.AgentId.Equals(classId)));
 }