/// <summary> /// Initialises the drive collection. /// /// The log domain is set to [AgentId].DC.[collection_name] /// /// If no goal is given (goal = None), then it can never be satisfied. /// </summary> /// <param name="agent">The collection's agent.</param> /// <param name="collectionName">The name of the drive collection.</param> /// <param name="priorityElements">The drive elements in order of their /// priority, starting with the highest priority.</param> /// <param name="goal">The goal of the drive collection.</param> public DriveCollection(Agent agent, string collectionType, string collectionName, DrivePriorityElement[] priorityElements, Trigger goal) : base(string.Format( "SDC.{0}", collectionName),agent) { name = collectionName; elements = priorityElements; this.goal = goal; type = collectionType; log.Debug("Created"); }
/// <summary> /// A POSH competence, containing competence priority elements. /// /// Initialises the competence. /// /// If no goal is given, then the goal will never be reached. /// /// The log domain is set to "[AgentId].C.[competence_name]". /// </summary> /// <param name="agent">The competence's agent.</param> /// <param name="competenceName">The name of the competence.</param> /// <param name="priorityElements">The priority elements of the competence, /// in their order of priority.</param> /// <param name="goal">The goal of the competence.</param> public Competence(Agent agent, string competenceName, CompetencePriorityElement[] priorityElements, Trigger goal) : base(string.Format("C.{0}",competenceName),agent) { this.name = competenceName; if (priorityElements.Length > 0 ) this.elements = new List<CompetencePriorityElement>(priorityElements); else this.elements = new List<CompetencePriorityElement>(); this.goal = goal; log.Debug("Created"); }
// TODO: replace root which should be a polymoph type (maybe create superclass) /// <summary> /// Initialises the drive element. /// /// The log domain is set to [AgentName].DE.[element_name] /// </summary> /// <param name="agent">The element's agent.</param> /// <param name="elementName">The name of the drive element.</param> /// <param name="trigger">The trigger of the element.</param> /// <param name="root">The element's root element. /// root is either POSH.strict.Action, POSH.strict.Competence or POSH.strict.ActionPattern /// </param> /// <param name="maxFreq">The maximum frequency at which is element is /// fired. The frequency is given in milliseconds between /// invocation. A negative number disables this feature.</param> public DriveElement(Agent agent, string elementName, Trigger trigger, CopiableElement root, long maxFreq) : base(string.Format("DE.{0}", elementName), agent) { this.name = elementName; this.trigger = trigger; this.root = root; this.element = root; this.maxFreq = maxFreq; // the timestamp when it was last fired this.lastFired = -100000L; log.Debug("Created"); this.agent = agent; this.isLatched = false; this.behaviours = new List<Behaviour>(); foreach (POSHSense sense in trigger.senses) this.behaviours.Add(sense.behaviour); }