Beispiel #1
0
        public Agent Clone(AgentArchitecture arch)
        {
            Agent a = new Agent();

            //a.setLogger(arch);
            if (this.GetReasoner().GetSettings().Verbose() >= 0)
            {
                //a.logger.setLevel(this.getTS().getSettings().logLevel());
            }

            //synchronized(GetBB().GetLock()) {
            a.bb = bb.Clone();
            //}
            a.pl = pl.Clone();
            try
            {
                FixAgInIAandFunctions(a);
            }
            catch (Exception e)
            {
                //e.printStackTrace();
            }
            a.aslSource       = aslSource;
            a.internalActions = new Dictionary <string, InternalAction>();
            a.SetReasoner(new Reasoner(a, GetReasoner().GetCircumstance().Clone(), arch, GetReasoner().GetSettings()));
            if (a.GetPL().HasMetaEventPlans())
            {
                a.GetReasoner().AddDesireListener(new Desire(a.GetReasoner()));
            }

            a.InitAg(); //for initDefaultFunctions() and for overridden/custom agent
            return(a);
        }
Beispiel #2
0
 private void SetFirstAgArch(AgentArchitecture agArch)
 {
     firstArch = agArch;
     if (successor != null)
     {
         successor.SetFirstAgArch(agArch);
     }
 }
Beispiel #3
0
 public void InsertAgentArchitecture(AgentArchitecture agArch)
 {
     if (agArch != GetFirstAgentArchitecture())
     {
         agArch.successor = GetFirstAgentArchitecture();
     }
     if (reasoner != null)
     {
         agArch.SetReasoner(this.GetReasoner());
         GetReasoner().SetAgArch(agArch);
     }
     SetFirstAgArch(agArch);
 }
Beispiel #4
0
        public List <string> GetAgentArchitectureClassesChain()
        {
            List <string>     all = new List <string>();
            AgentArchitecture a   = GetFirstAgentArchitecture();

            while (a != null)
            {
                all.Insert(0, a.GetType().ToString());
                a = a.GetNextAgentArchitecture();
            }

            return(all);
        }
Beispiel #5
0
        public static Agent Create(AgentArchitecture agArch, string asSrc, Settings stts)
        {
            try
            {
                Agent      ag = new Agent();
                Reasoner   r  = new Reasoner(ag, null, agArch, stts);
                BeliefBase bb = null;
                bb = new BeliefBase();


                ag.SetBB(bb);
                ag.InitAg();

                //bb.Init(ag);

                ag.Load(asSrc);
                return(ag);
            }
            catch (Exception e)
            {
                throw new JasonityException(e.Message);
            }
        }
Beispiel #6
0
 public AgentArchitecture()
 {
     firstArch = this;
 }