A Logic Programming Based Software Architecture for Reactive Intelligent Mobile Agents - DIPLCL’99 Copyright © 1999, BinNet Corp. Paul Tarau University.

Slides:



Advertisements
Similar presentations
Mobile Agents Mouse House Creative Technologies Mike OBrien.
Advertisements

Threads, SMP, and Microkernels
A component- and message-based architectural style for GUI software
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 9 Distributed Systems Architectures Slide 1 1 Chapter 9 Distributed Systems Architectures.
On Coordinating Information Agents and Mobility 컴퓨터공학과 김상태.
A Scalable Virtual Registry Service for jGMA Matthew Grove CCGRID WIP May 2005.
Virtual Ticketing Agents using Web Services and J2EE Advisor: Dr. Chung-E-Wang Date: 05/06/03 Naveen Repala.
Objektorienteret Middleware Presentation 2: Distributed Systems – A brush up, and relations to Middleware, Heterogeneity & Transparency.
Notes to the presenter. I would like to thank Jim Waldo, Jon Bostrom, and Dennis Govoni. They helped me put this presentation together for the field.
2 Object-Oriented Analysis and Design with the Unified Process Objectives  Explain how statecharts can be used to describe system behaviors  Use statecharts.
Rheeve: A Plug-n-Play Peer- to-Peer Computing Platform Wang-kee Poon and Jiannong Cao Department of Computing, The Hong Kong Polytechnic University ICDCSW.
Distributed Systems Architectures
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
Advanced Topics COMP163: Database Management Systems University of the Pacific December 9, 2008.
Concurrency CS 510: Programming Languages David Walker.
Software Frameworks for Acquisition and Control European PhD – 2009 Horácio Fernandes.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
An Introduction to Internetworking. Why distributed systems - Share resources (devices & CPU) - Communicate people (by transmitting data)
Ch 12 Distributed Systems Architectures
© Lethbridge/Laganière 2001 Chap. 3: Basing Development on Reusable Technology 1 Let’s get started. Let’s start by selecting an architecture from among.
.NET Mobile Application Development Introduction to Mobile and Distributed Applications.
Course Instructor: Aisha Azeem
Fundamentals of Python: From First Programs Through Data Structures
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
Introduction SOAP History Technical Architecture SOAP in Industry Summary References.
Chapter 2 Architectural Models. Keywords Middleware Interface vs. implementation Client-server models OOP.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 12 Slide 1 Distributed Systems Architectures.
Institute of Computer and Communication Network Engineering OFC/NFOEC, 6-10 March 2011, Los Angeles, CA Lessons Learned From Implementing a Path Computation.
M i SMob i S Mob i Store - Mobile i nternet File Storage Platform Chetna Kaur.
Honeypot and Intrusion Detection System
1 MSCS 237 Communication issues. 2 Colouris et al. (2001): Is a system in which hardware or software components located at networked computers communicate.
1 HKU CSIS DB Seminar: HKU CSIS DB Seminar: Web Services Oriented Data Processing and Integration Speaker: Eric Lo.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Architecting Web Services Unit – II – PART - III.
1 A Logic Programming Based Mobile Agent Infrastructure January 19, 2001 Copyright © 2000, Paul Tarau Paul Tarau University of North Texas & BinNet Corporation.
Reactive Mobile Agent Programming with Jinni Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas & BinNet Corporation.
Jinni: Intelligent Mobile Agent Programming at the Intersection of Java and Prolog Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas.
Advanced Computer Networks Topic 2: Characterization of Distributed Systems.
1 MSCS 237 Communication issues. 2 Colouris et al. (2001): Is a system in which hardware or software components located at networked computers communicate.
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
CSC 480 Software Engineering Lecture 18 Nov 6, 2002.
Transparent Mobility of Distributed Objects using.NET Cristóbal Costa, Nour Ali, Carlos Millan, Jose A. Carsí 4th International Conference in Central Europe.
Distributed Information Systems. Motivation ● To understand the problems that Web services try to solve it is helpful to understand how distributed information.
Introduction to Java Beans CIS 421 Web-based Java Programming.
ECI – electronic Commerce Infrastructure “ An application to the Shares Market ” Demetris Zeinalipour ( Melinos Kyriacou
Shuman Guo CSc 8320 Advanced Operating Systems
1 Object Oriented Logic Programming as an Agent Building Infrastructure Oct 12, 2002 Copyright © 2002, Paul Tarau Paul Tarau University of North Texas.
CSIT 220 (Blum)1 Remote Procedure Calls Based on Chapter 38 in Computer Networks and Internets, Comer.
Agent Based Transaction System CS790: Dr. Bruce Land Sanish Mondkar Sandeep Chakravarty.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 1: Characterization of Distributed & Mobile Systems Dr. Michael R.
1 BBN Technologies Quality Objects (QuO): Adaptive Management and Control Middleware for End-to-End QoS Craig Rodrigues, Joseph P. Loyall, Richard E. Schantz.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Institute for Visualization and Perception Research 1 © Copyright 1999 Haim Levkowitz Java-based mobile agents.
Chapter 9: Web Services and Databases Title: NiagaraCQ: A Scalable Continuous Query System for Internet Databases Authors: Jianjun Chen, David J. DeWitt,
Problem On a regular basis we use: –Java applets –JavaScript –ActiveX –Shockwave Notion of ubiquitous computing.
Design Patterns for Multi-Threaded Logic Programming Languages Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas & BinNet Corporation.
Today Threading, Cont. Multi-core processing. Java Never Ends! Winter 2016CMPE212 - Prof. McLeod1.
Mary Ganesan and Lora Strother Campus Tours Using a Mobile Device.
Principles of Network Applications
Software Design and Architecture
Client-Server Interaction
University of North Texas
IDSS Lab – research directions Sept 6, 2002
Bina Ramamurthy Chapter 9
Bina Ramamurthy Chapter 9
Bina Ramamurthy Chapter 9
An Introduction to Internetworking
Presentation transcript:

A Logic Programming Based Software Architecture for Reactive Intelligent Mobile Agents - DIPLCL’99 Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas & BinNet Corporation

Summary –Introduction/Motivation –Kernel Prolog = Horn Clauses + Engines –Threads as First-Order Objects –Blackboard Operations –Mobile Threads and Remote Execution –Key Agent Programming Patterns –Case Studies, Examples, Applications –Conclusion

Motivation –paradigm shift towards networked, mobile, ubiquitous computing with increasingly complex patterns of interaction –threads: needed for programming reactive/proactive mobile agents –back to pure LP - a good thing - but let’s give it an expressiveness lift:-) –Hilbert’s approach => reusable design patterns through an axiomatic reconstruction of frequently used components!

Ontology Places: blackboards + a server thread listening on a portPlaces: blackboards + a server thread listening on a port Things: Prolog terms, in particular Prolog clausesThings: Prolog terms, in particular Prolog clauses Agents:Agents: –a set of mobile threads initiated by a unique goal at a given Place –coordination: through blackboards - some local, some remote

Orthogonal Execution Mechanisms enginesengines threadsthreads blackboard operationsblackboard operations –basic Linda coordination, associative search –blackboard constraints - –blackboard constraints - react when something becomes true mobile threads operations

Engines as Generalized Iterators (Fluents): keep state minimal Engine = an LD Resolution Interpreter with first order control: constructor+iterator –new_engine(Goal,AnswerPattern, Handle): creates a new interpreter Handle solving Goal –new_answer(Handle,AnswerInstance): If AnswerInstance is no then stops the engine, otherwise either returns a new answer, of the form the(AnswerInstance) or returns no if there are no more answers.

findall/3 –findall(X,G,Xs):- new_engine(G,X,E), new_answer(E,Answer), collect_all_answers(Answer,E,Xs). –collect_all_answers(no,_,[]). collect_all_answers(the(X),E,[X|Xs]):- new_answer(E,Answer), collect_all_answers(Answer,E,Xs).

Reflective Meta Interpreter solve(G):- once(reduce(G,NewG)), call(NewG).solve(G):- once(reduce(G,NewG)), call(NewG). reduce(G,G):-is_builtin(G). reduce(','(A,B),','(solve(A),solve(B))). reduce(G,','(clause(G,Gs),solve(Gs))).reduce(G,G):-is_builtin(G). reduce(','(A,B),','(solve(A),solve(B))). reduce(G,','(clause(G,Gs),solve(Gs))).

Thread Operations: minimal! bg(Goal,ThreadHandle): runs a thread initiated by Goal and returns a handlebg(Goal,ThreadHandle): runs a thread initiated by Goal and returns a handle thread_clone(CloneThreadHandle)thread_clone(CloneThreadHandle) thread_join(T): wait for T to finishthread_join(T): wait for T to finish thread_sleep(Duration), thread_this(ThisThreadHandle)thread_sleep(Duration), thread_this(ThisThreadHandle) thread_resume/1, thread_suspend/1thread_resume/1, thread_suspend/1

Basic Linda Operations out(X): puts X on the blackboardout(X): puts X on the blackboard in(X): waits until it can take an object matching X from the blackboardin(X): waits until it can take an object matching X from the blackboard all(X,Xs): reads the list Xs matching X currently on the blackboardall(X,Xs): reads the list Xs matching X currently on the blackboard derived operations: cin/1, rd/1derived operations: cin/1, rd/1

Implementing in/1, out/1 with suspend and resume in Jinni and BinProlog this is in the implementation language but, in fact, it could be at source levelin Jinni and BinProlog this is in the implementation language but, in fact, it could be at source level in(X): if X is on the blackboard take it, if not add waiting(X,ThisThread) and do suspend(ThisThread)in(X): if X is on the blackboard take it, if not add waiting(X,ThisThread) and do suspend(ThisThread) out(X): if waiting(X,T) matches, take it and call resume(T)out(X): if waiting(X,T) matches, take it and call resume(T)

Assertional Constraints vs. Binding Constrains From: when nonvar(X)...From: when nonvar(X)... => when provable(X) … re-execution=> when provable(X) … re-execution => when a_fact(X)… more realistic=> when a_fact(X)… more realistic constraints on variable bindings are too fine-grained for distributed programming!constraints on variable bindings are too fine-grained for distributed programming!

Beyond Linda: Blackboard Constraint Operations wait_for(Pattern,Constraint): waits for a Pattern on the blackboard, such that Constraint holds, and when this happens, it removes the result of the match from the blackboardwait_for(Pattern,Constraint): waits for a Pattern on the blackboard, such that Constraint holds, and when this happens, it removes the result of the match from the blackboard notify_about(Pattern): notifies about this Pattern one of the blocked threads which waits for it with a matching constraintnotify_about(Pattern): notifies about this Pattern one of the blocked threads which waits for it with a matching constraint

Coordination with Blackboard Constraints Two threads: T1 (prod) and T2 (cons)Two threads: T1 (prod) and T2 (cons) ?-notify_about(stock_offer(aol,91)). %T1?-notify_about(stock_offer(aol,91)). %T1 ?-notify_about(stock_offer(aol,89)). %T1?-notify_about(stock_offer(aol,89)). %T1 % action triggered in T2 => Price=89% action triggered in T2 => Price=89 ?-wait_for(stock_offer(aol,Price), %T2 less(Price,90)).?-wait_for(stock_offer(aol,Price), %T2 less(Price,90)).

wait_for(Pattern,Constr) wait_for(P,C):- if(take_pattern(available_for(P),C), if(take_pattern(available_for(P),C), true, true, and(out(waiting_for(P,C)), and(out(waiting_for(P,C)), in(holds_for(P,C)) in(holds_for(P,C)) ) ). ) ).

notify_about(Pattern,Constr) notify_about(P):- if(take_pattern(waiting_for(P,C),C), if(take_pattern(waiting_for(P,C),C), out(holds_for(P,C)), out(holds_for(P,C)), out(available_for(P)) out(available_for(P)) ). ).

take_pattern/2 take_pattern(Pattern,Constraint):- all(Pattern,Ps), all(Pattern,Ps), member(Pattern,Ps), member(Pattern,Ps), Constraint, Constraint, cin(Pattern,_). % non-blocking in/1 cin(Pattern,_). % non-blocking in/1

The Reactive Agent Pattern sell(Who,Stock,AskPrice) :- notify_about(offer(Who,Stock,AskPrice)).sell(Who,Stock,AskPrice) :- notify_about(offer(Who,Stock,AskPrice)). buy(Who,Stock,SellingPrice) :- bg(try_to_buy(Who,Stock,SellingPrice)).buy(Who,Stock,SellingPrice) :- bg(try_to_buy(Who,Stock,SellingPrice)). try_to_buy(Me,Stock,LimitPrice) :- wait_for(offer(You,Stock,YourPrice), less(YourPrice,LimitPrice)),……….try_to_buy(Me,Stock,LimitPrice) :- wait_for(offer(You,Stock,YourPrice), less(YourPrice,LimitPrice)),……….

mobile threads with First Order AND-continuations a:-b,c,d.a:-b,c,d. binarization: a(C)::-b(c(d(C))).binarization: a(C)::-b(c(d(C))). get_cont(C,C)::-true(C). % binarizedget_cont(C,C)::-true(C). % binarized mobile threads algorithm:mobile threads algorithm: –move/0: get continuation, send over the net, resume execution on target –return/0: send back new continuation, resume execution back home

A Simple API for mobile threads run_server/0, here/0, there/0, where/1: => local or remote focusrun_server/0, here/0, there/0, where/1: => local or remote focus set_this_host/1, set_this_port/1, set_that_host/1,set_that_port/1set_this_host/1, set_this_port/1, set_that_host/1,set_that_port/1 move/0, return/0 vs. remote_run/1move/0, return/0 vs. remote_run/1 the(Pattern,Goal,Answer): runs Goal to produce the(Answer) or no => here/there switch =>local/remotethe(Pattern,Goal,Answer): runs Goal to produce the(Answer) or no => here/there switch =>local/remote

Examples of mobile threads Window 1: a mobile threadWindow 1: a mobile thread ?- there, move, println(on_server), member(X,[1,2,3]), return, println(back).?- there, move, println(on_server), member(X,[1,2,3]), return, println(back). Window 2: a serverWindow 2: a server ?- run_server.?- run_server.

mobile threads vs. RPCs: move once, compute many times ?-for(I,1,1000), remote_run(println(I)), eq(I,1000).?-for(I,1,1000), remote_run(println(I)), eq(I,1000). ?-there, move, for(I,1,1000), println(I), eq(I,1000).?-there, move, for(I,1,1000), println(I), eq(I,1000).

mobile threads: WHY? Large database, small agentLarge database, small agent Speed-up: move to a fast processor and back, transparentlySpeed-up: move to a fast processor and back, transparently here/there switch: same code can be run locally or remotelyhere/there switch: same code can be run locally or remotely fault tolerance - move->run->come backfault tolerance - move->run->come back

Emulating multiple answer computations ?- there, move, findall(X,for(I,1,3),Xs), return, member(X,Xs).?- there, move, findall(X,for(I,1,3),Xs), return, member(X,Xs). X=1;X=1; X=2;X=2; X=3X=3

A Classic Design Pattern, Publish/Subscribe: with mobile threads + Linda operations a reactive channel listener: in/1 loopa reactive channel listener: in/1 loop ?-listen(fun(_)).?-listen(fun(_)). selective channel publisher: out/1 loopselective channel publisher: out/1 loop ?-talk(fun(jokes)).?-talk(fun(jokes)). will not match:will not match: ?-talk(stocks(quotes,nasdaq))?-talk(stocks(quotes,nasdaq))

The (Pseudo) Server in The Client Pattern a client thread emulates server functionality (works behind a firewall!):a client thread emulates server functionality (works behind a firewall!): –pseudo_sever:- in(todo(X)),call(X),pseudo_server. –?- there,pseudo_server. the real client: there,out(todo(…))the real client: there,out(todo(…)) communication: through a blackboard on a (shared) real servercommunication: through a blackboard on a (shared) real server

The Octopus Agent Pattern branch out multiple Reactive Agent threads to various places using RPCs or mobile threadsbranch out multiple Reactive Agent threads to various places using RPCs or mobile threads watch for patterns containing returned results on the local blackboardwatch for patterns containing returned results on the local blackboard failure or non-termination of one thread have minimal effect: fault tolerancefailure or non-termination of one thread have minimal effect: fault tolerance

Designing Jinni Agent Classes Java layer:Java layer: –code and type inheritance –reaction to events –libraries: Java3D, XML, special devices etc. Prolog layer Prolog layer –knowledge processing –reaction to blackboard constraints –mobile threads

Design Patterns in Visual Jinni drives Java objects through handlesdrives Java objects through handles meta-programming is essentialmeta-programming is essential Java events interoperate with blackboard coordinationJava events interoperate with blackboard coordination easy extension to incorporate access to Java2D and Java3d librarieseasy extension to incorporate access to Java2D and Java3d libraries

jdialog/2: a Jinni Visual Component –jdialog(Q,A):- new_frame('Jinni Dialog',2,1,F), set_layout(F,border), new_label(F,Q,_),new_panel(F,flow,P), new_button(P,'Ok',out(bchoice(P,ok)),_), new_button(P,'Cancel', out(bchoice(P,cancel))), show(F), in(bchoice(P,A)), remove_all(F), destroy(F).

Shared Virtual Worlds set-up a registration mechanism for agents on serverset-up a registration mechanism for agents on server publish state changes to shared blackboard on server with out/1publish state changes to shared blackboard on server with out/1 one thread for each “ghost” (remote client) - too expensive!one thread for each “ghost” (remote client) - too expensive! => shared update loop: get each ghost’s state with in/1 from server and update=> shared update loop: get each ghost’s state with in/1 from server and update

Shared Virtual Reality Agents Web based: browser+EAI+Java+JinniWeb based: browser+EAI+Java+Jinni Jinni Server + Thin Jinni Applet ConnectorJinni Server + Thin Jinni Applet Connector NEXT: Java 3D virtual worlds connected in a peer-to-peer Jinni networkNEXT: Java 3D virtual worlds connected in a peer-to-peer Jinni network new transport layers: Corba, RMI, HLAnew transport layers: Corba, RMI, HLA

Stock Market Agents reactive agents, user defined rulesreactive agents, user defined rules Internet data mining for stock quotesInternet data mining for stock quotes expressiveness far beyond the usual limit/stop/market transactionsexpressiveness far beyond the usual limit/stop/market transactions Octopus Agent Pattern: wait for triggers on multiple stocks, analyst info, indexesOctopus Agent Pattern: wait for triggers on multiple stocks, analyst info, indexes

Educational Agents chat, self organizing groupschat, self organizing groups alerts triggered by blackboard constraintsalerts triggered by blackboard constraints reusable agent hierarchiesreusable agent hierarchies student progress evaluationstudent progress evaluation Wizard of Oz help desk: combined human and programmed agentsWizard of Oz help desk: combined human and programmed agents

Mutual Agent/Host Security: the BRING YOUR OWN WINE PRINCIPLE reflective meta-interpreter: a few lines of Prolog - can be mobile - bring your own!reflective meta-interpreter: a few lines of Prolog - can be mobile - bring your own! can act as a sandbox protecting the Host against the Agent -statically checkedcan act as a sandbox protecting the Host against the Agent -statically checked undecidability of a Turing equivalent meta-interpreter protects the Agent against the Hostundecidability of a Turing equivalent meta-interpreter protects the Agent against the Host

Conclusion expressiveness of LP + a few simple, orthogonal concepts: engines, threads, blackboards, mobile threadsexpressiveness of LP + a few simple, orthogonal concepts: engines, threads, blackboards, mobile threads LP is ready for GUI-enabled, networked applications interoperating with mainstream software artifactsLP is ready for GUI-enabled, networked applications interoperating with mainstream software artifacts