1 logic programming school of informatics, university of edinburgh building larger systems a case...

13
1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: • Development of a task-specific language • Term transformation • Term unfolding • Meta-interpretation • Connection to an asynchronous environment Domain: Peer to peer coordination This lecture: Overview of task and language Next lecture: Automation

Upload: alvin-hart

Post on 14-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

1

Logic ProgrammingSchool of Informatics, University of Edinburgh

Building Larger Systems

A case study requiring:• Development of a task-specific language• Term transformation• Term unfolding• Meta-interpretation• Connection to an asynchronous environment

Domain: Peer to peer coordination

This lecture: Overview of task and languageNext lecture: Automation

Page 2: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

2

Logic ProgrammingSchool of Informatics, University of Edinburgh

out

Overview

Agent a1 Agent a2inMedia

Constraintsolver

Protocolinterpreter

Transporton media

Global state ofthis interaction

Page 3: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

3

Logic ProgrammingSchool of Informatics, University of Edinburgh

Basic Example

Agent a1

Agent a2

Agent a3

ask(p(Y))

tell(p(a))

ask(q(Y))

query_from(p(Y), a2)query_from(q(Y), a3)

know(p(a))

Page 4: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

4

Logic ProgrammingSchool of Informatics, University of Edinburgh

A requester will ask about something from an informer then get an answer from it then continue as a requester

An informer will be asked by a requester then should tell the requester if it knows

a(requester, A) ::= ask(X) => a(informer, B) query_from(X, B) then tell(X) <= a(informer, B) then a(requester, A)

a(informer, B) ::= ask(X) <= a(requester, A) then tell(X) => a(requester, A) know(X)

Role Message out

Message in

Constraint

Recursive role

Example Protocol

Page 5: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

5

Logic ProgrammingSchool of Informatics, University of Edinburgh

Operator Declarations for Protocol

:- op(900, xfx, '::='), op(800, xfx, '=>'), op(800, xfx, '<='), op(830, xfx, ‘'), op(820, xfy, and), op(850, xfy, par), op(850, xfy, then), op(850, xfy, or).

a(informer, B)

::=

know(X)

tell(X)

a(requester, A)ask(X)

<=

=>

a(requester, A)

then

a(informer, B) ::= ask(X) <= a(requester, A) then tell(X) => a(requester, A) know(X)

Page 6: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

6

Logic ProgrammingSchool of Informatics, University of Edinburgh

Agent a1

a(requester, A) ::= ask(X) => a(informer, B) query_from(X, B) then tell(X) <= a(informer, B) then a(requester, A)

a(informer, B) ::= ask(X) <= a(requester, A) then tell(X) => a(requester, B) know(X)

Agent a2

a(requester, a1) ::= ask(p(Y)) => a(informer, a2) then tell(p(Y)) <= a(informer, a2) then a(requester, a1)

ask(p(Y))

General Specific

query_from(p(Y), a2)

Interaction Example

Page 7: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

7

Logic ProgrammingSchool of Informatics, University of Edinburgh

a(requester, A) ::= ask(X) => a(informer, B) query_from(X, B) then tell(X) <= a(informer, B) then a(requester, A)

a(informer, B) ::= ask(X) <= a(requester, A) then tell(X) => a(requester, B) know(X)

Agent a1 Agent a2

a(requester, a1) ::= ask(p(Y)) => a(informer, a2) then tell(p(Y)) <= a(informer, a2) then a(requester, a1)

a(informer, a2) ::= ask(p(Y)) <= a(requester, a1) then tell(p(Y)) => a(requester, a1) know(p(Y))

ask(p(Y))

General Specific

Interaction Example

Page 8: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

8

Logic ProgrammingSchool of Informatics, University of Edinburgh

Agent a1 Agent a2tell(p(a))

General Specific

a(requester, A) ::= ask(X) => a(informer, B) query_from(X, B) then tell(X) <= a(informer, B) then a(requester, A)

a(informer, B) ::= ask(X) <= a(requester, A) then tell(X) => a(requester, B) know(X)

a(requester, a1) ::= ask(p(Y)) => a(informer, a2) then tell(p(Y)) <= a(informer, a2) then a(requester, a1)

a(informer, a2) ::= ask(p(a)) <= a(requester, a1) then tell(p(a)) => a(requester, a1)

know(p(a))

Interaction Example

Page 9: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

9

Logic ProgrammingSchool of Informatics, University of Edinburgh

Agent a1 Agent a2tell(p(a))

General Specific

a(requester, A) ::= ask(X) => a(informer, B) query_from(X, B) then tell(X) <= a(informer, B) then a(requester, A)

a(informer, B) ::= ask(X) <= a(requester, A) then tell(X) => a(requester, B) know(X)

a(requester, a1) ::= ask(p(a)) => a(informer, a2) then tell(p(a)) <= a(informer, a2) then a(requester, a1) ::= ask(X) => a(informer, B) query_from(X, B) then tell(X) <= a(informer, B) then a(requester, a1)

a(informer, a2) ::= ask(p(a)) <= a(requester, a1) then tell(p(a)) => a(requester, a1)

Interaction Example

Page 10: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

10

Logic ProgrammingSchool of Informatics, University of Edinburgh

And so on…

Agent a1 Agent a3

General Specific

q(Y)

Agent a2

a(requester, A) ::= ask(X) => a(informer, B) need(X) and source(B) then tell(X) <= a(informer, B) then a(requester, A)

a(informer, B) ::= ask(X) <= a(requester, A) then tell(X) => a(requester, B) know(X)

a(requester, a1) ::= ask(p(a)) => a(informer, a2) then tell(p(a)) <= a(informer, a2) then a(requester, a1) ::= ask(q(Y)) => a(informer, a3) then tell(q(Y)) <= a(informer, a3) then a(requester, a1)

a(informer, a2) ::= ask(p(a)) <= a(requester, a1) then tell(p(a)) => a(requester, a1)

query_from(q(Y), a3)

Page 11: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

11

Logic ProgrammingSchool of Informatics, University of Edinburgh

Agents Determining Peers

HeadhunterHeadhunter

FinderFinderPersonPerson

Ask for best peopleAsk for best peopleSuggest best peopleSuggest best people

OrganiserOrganiserAsk for agent of a personAsk for agent of a person

Inform his/her agentInform his/her agent

Available?Available?

Confirm/disconfirmConfirm/disconfirm

Page 12: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

12

Logic ProgrammingSchool of Informatics, University of Edinburgh

For Example…

HeadhunterHeadhunter

FinderFinder PersonPerson

Ask for best peopleAsk for best peopleSuggest [nick_jennings,mike_wooldridge]

OrganiserOrganiser

Agent for mike_wooldridge?Agent for mike_wooldridge?

Agent is n_jenningsAgent is n_jenningsAvailable?Available?

ConfirmConfirm

d_robertson

w_hall

d_sleeman

PersonPerson

n_jennings

m_wooldridge

Available?

Confirm

DEMO

Agent is m_wooldridge

Agent for nick_jennings?

Page 13: 1 Logic Programming School of Informatics, University of Edinburgh Building Larger Systems A case study requiring: Development of a task-specific language

13

Logic ProgrammingSchool of Informatics, University of Edinburgh

An organiser service on some topic will ask a headhunter service for the best people on that topic, then it will be informed by the headhunter who those people are, then it will change role to be a locator for these people, then it will become a time coordinator for these people

A locator for a set of people will ask a finder service for an address for a person in the set, then it will be informed by the finder of the address, then it will continue to locate all the other people in the set until it finishes at the end

An organiser service on some topic will ask a headhunter service for the best people on that topic, then it will be informed by the headhunter who those people are, then it will change role to be a locator for these people, then it will become a time coordinator for these people

A locator for a set of people will ask a finder service for an address for a person in the set, then it will be informed by the finder of the address, then it will continue to locate all the other people in the set until it finishes at the end

a(organiser(Topic,H,F), O) ::= ask(best_people(Topic)) => a(headhunter, H) then inform(best_people(Topic, People)) <= a(headhunter, H) then a(locator(F,People,Locations), O) then a(time_coordinator(People,Locations,Topic,Times,Time), O) times(Times)

a(locator(F,People,Locations), L) ::= ( ask(locate(Person)) => a(finder, F) People = [Person|Rp] and Locations = [Loc|Rl] then inform(located(Person, Loc)) <= a(finder, F) then a(locator(F,Rp, Rl), L) ) or null People = [] and Locations = []

a(organiser(Topic,H,F), O) ::= ask(best_people(Topic)) => a(headhunter, H) then inform(best_people(Topic, People)) <= a(headhunter, H) then a(locator(F,People,Locations), O) then a(time_coordinator(People,Locations,Topic,Times,Time), O) times(Times)

a(locator(F,People,Locations), L) ::= ( ask(locate(Person)) => a(finder, F) People = [Person|Rp] and Locations = [Loc|Rl] then inform(located(Person, Loc)) <= a(finder, F) then a(locator(F,Rp, Rl), L) ) or null People = [] and Locations = []

Protocol for Example