Menu

Jadex

Help
yanet
2016-06-16
2016-06-21
  • yanet

    yanet - 2016-06-16

    Hi, I am new in Jadex, and I have a problem, the class BDIAgent is not solve as a type....i look in side the BDIv3 package is there is not BDIAgent class, only BDIAgentFactory, and BDIAgentFeature, Iam following the BDIv3 tutorial on the jadex web, i have jadex 3.0 RC51 installed.........please my english is not so good, forgive my mistakes...

    Thanks

     
  • Julian

    Julian - 2016-06-16

    Hi yanet,
    to implement a BDIv3 Agent, you do not need to extend any type (like "BDIAgent").
    Just make sure your class is named "<yourname>BDI" and has the @Agent annotation:</yourname>

    @Agent
    @Description("The translation agent A1. <br> Empty agent that can be loaded and started.")
    public class MyBDI
    {
    

    You may also follow this tutorial:
    https://download.actoron.com/docs/releases/jadex-3.0.0-RC51/jadex-mkdocs/BDI%20V3%20Tutorial/02%20Starting%20an%20Agent/#exercise-a3-create-first-simple-jadex-agent

    If you need access to Agent Features (such as the IBDIAgentFeature), use @AgentFeature to inject them:

    @AgentFeature
    protected IBDIAgentFeature bdi;
    

    Using this feature, you can work with goals and adopt plans etc.

     
  • yanet

    yanet - 2016-06-16

    Hi, I sorry , I have another question

    I am following
    https://download.actoron.com/docs/releases/latest/jadex-mkdocs/BDI%20V3%20Tutorial/05%20Using%20Goals/
    i can´t find
    dispatchTopLevelGoal method , I think the problem is that a declare the agent field as Agent of jadex.micro.anotation.Agent, and the cast is wrong in

    Translate goal = (Translate)agent.dispatchTopLevelGoal(new Translate(eword)).get();

    but I don´t know where I can find the Agent class where the dispatchTopLevelGoal method
    belong

    please I know my english is veryyyy bad , but help meee

    Thanks

     
  • yanet

    yanet - 2016-06-16

    Hi??????

     
  • Julian

    Julian - 2016-06-16

    The Documentation may be outdated - which is the primary reason, our jadex 3.0.0 releases are marked as "RC" (Release Candidate).
    Jadex components are now feature-based, which means, depending on the internal architecture (bdi, micro, bpmn), different "Features" can be injected into agent classes.
    The IBDIAgentFeature provides everything necessary for BDI implementation.

    The dispatchTopLevelGoal method can then be found in the IBDIAgentFeature:

    @AgentFeature
    protected IBDIAgentFeature bdi;
    
    ...
    bdi.dispatchTopLevelGoal(...
    

    Please have some patience regarding the documentation, we are working on it :)

     
  • yanet

    yanet - 2016-06-16

    Thanks you !!!!!.....

     
  • yanet

    yanet - 2016-06-16

    Hi again, :-).........there is a way for following the ejecution , i mean breakpoint, ????.......

     
  • yanet

    yanet - 2016-06-16

    Hi, I would like you help me to understand, how jadex implements, the deliberative behavior of the BDI architecture, I know that Jade is an inference engine, by rules......but jadex????.... I am sorry I am traying to understand .........thanks

     
  • yanet

    yanet - 2016-06-17

    Hi, it was very helpul the links......but I can´t find the debugger in jadex 3.00, I leave you an attachments.

     
  • Lars Braubach

    Lars Braubach - 2016-06-17

    The debugger is a plugin that can be activated on the top right (not shown in your screenshot). It is the button with a gear wheel on it. Best Lars

     
  • yanet

    yanet - 2016-06-20

    Hello, thanks , I found it
    I have a problem in this code , that I can´t find, There i a nullpointer Exception on line 86, and other cuestion where I can find the description of the dispatchTopLevelGoal method?......which is it function?......thanks again for your patience

    package a4;

    import java.util.Collection;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.logging.Logger;

    import jadex.bdiv3.IBDIAgent;
    import jadex.bdiv3.annotation.Belief;
    import jadex.bdiv3.annotation.Goal;
    import jadex.bdiv3.annotation.Plan;
    import jadex.micro.annotation.Agent;
    import jadex.micro.annotation.AgentBody;
    import jadex.micro.annotation.AgentCreated;
    import jadex.bdiv3.annotation.Trigger;
    import jadex.bdiv3.features.IBDIAgentFeature;
    import jadex.bdiv3.runtime.IBeliefListener;
    import jadex.bdiv3.runtime.IGoal;
    import jadex.bridge.IComponentIdentifier;
    import jadex.bridge.IExternalAccess;
    import jadex.bridge.modelinfo.IModelInfo;
    import jadex.bridge.service.types.cms.IComponentDescription;
    import jadex.commons.IParameterGuesser;
    import jadex.commons.IValueFetcher;
    import jadex.commons.future.IFuture;

    @Agent
    public class OtherTransBDI {

    IBDIAgentFeature agent;
    
    @Belief
    protected Map<String, String> wordtable;
    
    
    @AgentCreated
    
    public void init () {
    
        wordtable = new HashMap<String, String>();
        wordtable.put("ojo", "eye");
        wordtable.put("mesa", "table");
        wordtable.put("1", "Flegel");
    
    
    }
    
    @Goal 
    class Translate {
    
      protected String eword;
    
      protected String gword;
    
      public Translate(String eword)
      {
        this.eword = eword;
      }
    
      public String getEWord()
      {
        return eword;
      }
    
      public String getGWord()
      {
        return gword;
      }
    
      public void setGWord(String gword)
      {
        this.gword = gword;
      }
    }
    
    @Plan(trigger=@Trigger(goals=Translate.class))
    protected void translatep(Translate goal)
    {
      String eword = goal.getEWord();
      String gword = wordtable.get(eword);
      System.out.println("Translated: "+ gword);
      goal.setGWord(gword); 
    }
    
    @AgentBody
    public void body()
    {
      String eword = "ojo"; 
      Translate goal = new Translate(eword);
      goal = (Translate)agent.dispatchTopLevelGoal(goal);
      System.out.println("Translated: "+ eword +" "+ goal.getGWord());
    }
    

    }

     
  • yanet

    yanet - 2016-06-20

    Sorry there is something wrong in agnet body

    public void body()
    {
    String eword = "ojo";

     Translate goal = (Translate)agent.dispatchTopLevelGoal(new Translate (eword)).get();
      System.out.println("Translated: "+ eword +" "+ goal.getGWord());
    }
    
    but don´t work neither
    
     
  • yanet

    yanet - 2016-06-20

    The 86 line is
    Translate goal = (Translate)agent.dispatchTopLevelGoal(new Translate (eword)).get();

     
  • Lars Braubach

    Lars Braubach - 2016-06-21

    Because you forgot the @AgentFeature annotation necessary for dependecy injection:

    IBDIAgentFeature agent;

    ->

    @AgentFeature
    IBDIAgentFeature agent;

    You can use also the normal Java debugger with Jadex.

    Best
    Lars

     

    Last edit: Lars Braubach 2016-06-21
  • yanet

    yanet - 2016-06-21

    hello, thanks , you are very patience with me....thanks again

     
  • yanet

    yanet - 2016-06-21

    Hi, I have another question
    If i have a belief who has a @Plan(trigger=@Trigger(factchangeds="sana")) and I have a mantain goal which change de same belife for keeping always in true, which one is the firts in execute?

    I mean it is posible??

    @Goal(excludemode=ExcludeMode.Never)
    class VivirGoal{
    @GoalMaintainCondition(beliefs="sana")
    protected boolean maintain()
    {
    return sana=true;
    }

          @GoalTargetCondition(beliefs="sana")
          protected boolean target()
          {
            return sana=false;
          }
    }
    
    @Plan(trigger=@Trigger(goals=VivirGoal.class))
    public void Verif(){
    
            do something                    
    }
    
     

Log in to post a comment.

MongoDB Logo MongoDB