Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intelligent Architectures for Electronic Commerce Prolog/JADE Tutorial.

Similar presentations


Presentation on theme: "Intelligent Architectures for Electronic Commerce Prolog/JADE Tutorial."— Presentation transcript:

1 Intelligent Architectures for Electronic Commerce Prolog/JADE Tutorial

2 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 2 Overview 1.JADE 2.CIAO Prolog 3.Prolog and JADE

3 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 3 1. JADE Standard platform for agent communication Provides useful services: –Visualisation of messages; –Sending/receiving messages manually; –GUI, etc. We need to use some such platform to run our agents, otherwise how would we test them?

4 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 4 1. JADE Container Agent

5 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 5 2. CIAO Prolog Efficient, free implementation of Prolog Higher-level than Java, C++, Delphi: –Allows symbolic reasoning –Terse syntax Common complaints: –Non-intuitive and outlandish –Difficult to understand –Inefficient –Odd choice for a programming language (if it is not Java it is simply not cool…)

6 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 6 3. Prolog and JADE Means to “agentify” Prolog programs Prolog programs may then: –Send messages to other agents –Receive messages from other agents Prolog can then “talk” to any other languages –Current examples are all Prolog agents Our Prolog agents were isolated from the rest of the world!

7 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 7 3.1 Connecting Prolog/Jade JADE is for Java, not Prolog…. One solution: –Prolog process has a “proxy” Java agent in JADE –Prolog process sends and receives messages via proxy agent –Diagrammatically JADE Ag 1 Ag 2 Ag 4 PrologAg 3

8 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 8 3.2 Proxy Agent Proxy agent is a simple Java program Reads from/writes to a socket open on a port Prolog program sends a message via proxy: –Writes term onto socket –Term must be in a specific format (more later…) Proxy agent reads in Prolog term (message to be sent) and translates it onto FIPA-ACL Creation and registration of proxy agents is performed via StarterAgent

9 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 9 3.3 StarterAgent (1) Each Prolog process needs a proxy agent Prolog cannot start an agent in JADE Solution: an agent inside JADE who is responsible for starting up proxy agents! This is what StarterAgent is

10 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 10 3.3 StarterAgent (2) Started up manually using JADE’s service:

11 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 11 3.3 StarterAgent (3) Then you should type on the pop-up window: Name of the Starter AgentJAVA Class Parameters: Port Number and “verbose” option

12 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 12 3.3 StarterAgent (4) Look!!

13 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 13 3.3 StarterAgent (5) How to get hold of StarterAgent: 1.Copy folder JADE-InterAgent into your jade folder 2.Add c:\jade\JADE-InterAgent to your CLASSPATH You can now start up your StarterAgent as before Choose a port which is not being used to use as a parameter when starting the agent

14 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 14 3.4 The Prolog Part (1) Download file agent.pl Load it in CIAO Prolog Type in ?- connect_to_jade(1450,ag1,starterAgentCool).

15 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 15 3.4 The Prolog Part (3) 1.Prolog connects to port 1450 2.Sends a request to the StarterAgent in the form request(Me,[StarterAg],register(Me))) 3.Receives a message with the port of the Proxy agent inform(StarterAg,[Me],registered(Me,NewPort))) 3.Connects to the NewPort port 4.And that’s all!

16 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 16 3.4 The Prolog Part (5)

17 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 17 3.4 The Prolog Part (6) Look!!

18 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 18 3.4 The Prolog Part (7) After process connects to the port, it can send and receive messages via its proxy agent in JADE. You can, for instance, send a message using the JADE service, in order to test your Prolog agent.

19 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 19

20 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 20 3.4 The Prolog Part (10)

21 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 21 3.4 The Prolog Part (11) There are predicates defined to send and receive messages. Messages must be in the format  perf-name  (  id-sender ,ListOfRecs,  contents  ) where ListOfRecs is a list of recipients’s id Please read the documentation in the file agent.pl

22 Intelligent Architectures for Electronic Commerce Timothy J Norman and Wamberto Vasconcelos 22 4. Final Words No standard connection: –We’re free to create and propose solutions –How would you connect Prolog to JADE? This is state-of-the-practice stuff –There might be problems… –Let me know and I will try to help! Enjoy it!


Download ppt "Intelligent Architectures for Electronic Commerce Prolog/JADE Tutorial."

Similar presentations


Ads by Google