Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jinni: Intelligent Mobile Agent Programming at the Intersection of Java and Prolog Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas.

Similar presentations


Presentation on theme: "Jinni: Intelligent Mobile Agent Programming at the Intersection of Java and Prolog Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas."— Presentation transcript:

1 Jinni: Intelligent Mobile Agent Programming at the Intersection of Java and Prolog Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas & BinNet Corporation

2 other talk: Blackboard Constraints in Jinni http://www.binnetcorp.com Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas & BinNet Corporation

3 What is Jinni? JINNI: Java INference engine and Networked Interactor lightweight, multi-threadedlightweight, multi-threaded Prolog-style agent scripting languageProlog-style agent scripting language knowledge processing componentsknowledge processing components high level, distributed, Java based: alternative to RMI, CORBA, KQMLhigh level, distributed, Java based: alternative to RMI, CORBA, KQML

4 Motivation paradigm shift towards networked, mobile, ubiquitous computingparadigm shift towards networked, mobile, ubiquitous computing increasingly complex patterns of interactionincreasingly complex patterns of interaction reactive and mobile agentsreactive and mobile agents inference capabilities, autonomy and self- reliance.inference capabilities, autonomy and self- reliance.

5 BASIC ONTOLOGY: THE USERS' VIEW Things: represented as Prolog termsThings: represented as Prolog terms Places: server component listening on a port + Linda blackboardPlaces: server component listening on a port + Linda blackboard Agents: collections of mobile threadsAgents: collections of mobile threads running a set of goals at set of Placesrunning a set of goals at set of Places transporting and processing Thingstransporting and processing Things

6 A typical Jinni application a hierarchy of Places and Agentsa hierarchy of Places and Agents Agent threads moving between PlacesAgent threads moving between Places wait for/produce Things satisfying constraintswait for/produce Things satisfying constraints sensing changes of state, produce and react to eventssensing changes of state, produce and react to events

7 THE ARCHITECTURE OF JINNI operatorless syntactic subset of Prologoperatorless syntactic subset of Prolog multiple engines running on separate threads,multiple engines running on separate threads, blackboards to communicate between enginesblackboards to communicate between engines Linda coordination, associative searchLinda coordination, associative search

8 Architecture of Jinni - details - high level networking operations: code and compoutation mobility, remote executionhigh level networking operations: code and compoutation mobility, remote execution Jinni-to-Java translatorJinni-to-Java translator ability to load code directly from the Webability to load code directly from the Web hyothetical reasoning, backtrackable assumptions, Assumption Grammarshyothetical reasoning, backtrackable assumptions, Assumption Grammars

9 The Jinni Kernel: Basic Linda + Remote Predicate Calls 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 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

10 Assertional Constraints vs. Binding Constrains when nonvar(X)...when nonvar(X)... when proven(X) …when proven(X) … when a_fact(X)… more realisticwhen a_fact(X)… more realistic lower granularitylower granularity arguably: more appropriate for distributed programmingarguably: more appropriate for distributed programming

11 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

12 Coordination with Blackboard Constraints ?- notify_about(stock_offer(nscp,29)).?- notify_about(stock_offer(nscp,29)). ?-wait_for(stock_offer(nscp,Price), less(Price,30)).?-wait_for(stock_offer(nscp,Price), less(Price,30)).

13 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(local_out(waiting_for(P,C)), and(local_out(waiting_for(P,C)), local_in(holds_for(P,C)) local_in(holds_for(P,C)) ) ). ) ).

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

15 take_pattern/2 take_pattern(Pattern,Constraint):- local_all(Pattern,Ps), local_all(Pattern,Ps), member(Pattern,Ps), member(Pattern,Ps), Constraint, Constraint, local_cin(Pattern,_). local_cin(Pattern,_).

16 Mobile thread operations run_server/0, here/0, there/0, where/1run_server/0, here/0, there/0, where/1 set_this_host/1, set_this_port/1set_this_host/1, set_this_port/1 set_that_host/1,set_that_port/1set_that_host/1,set_that_port/1 move/0, return/0move/0, return/0 bg/1, bg/2, thread_clone/1bg/1, bg/2, thread_clone/1

17 BUILDING BEHAVIORS: BASIC AGENT PROGRAMMING CONSTRUCTS a reactive channel listenera reactive channel listener ?-listen(fun(_)).?-listen(fun(_)). selective channel publisherselective channel publisher ?-talk(fun(jokes)).?-talk(fun(jokes)). will not match:will not match: ?-talk(stocks(quotes,nasdaq))?-talk(stocks(quotes,nasdaq))

18 Example: a stock market trader agent 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), ……….try_to_buy(Me,Stock,LimitPrice) :- wait_for(offer(You,Stock,YourPrice), ……….

19 Examples of Mobile Computations 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.

20 Mobile code 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).

21 Mobile code: 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 localy or remotelyhere/there switch: same code can be run localy or remotely fault tolerance - move->run->come backfault tolerance - move->run->come back

22 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

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

24 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! a sandbox can protect the Host against the Agenta sandbox can protect the Host against the Agent 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

25 Ongoing Work Day trader: reactive agent, using Internet data mining for quotes and user defined rules beyond conventional limit/stop/market transactionsDay trader: reactive agent, using Internet data mining for quotes and user defined rules beyond conventional limit/stop/market transactions Network monitoring: new Internet2 infrastructure at UNT, experiments with mobile agents on Gigabit networksNetwork monitoring: new Internet2 infrastructure at UNT, experiments with mobile agents on Gigabit networks Visual Jinni, educational agentsVisual Jinni, educational agents

26 Conclusion Synergy between Logic Programming and Java based distributed programmingSynergy between Logic Programming and Java based distributed programming Integrated infrastructure for builting Internet aware, GUI-eanbled, networked Agent componentsIntegrated infrastructure for builting Internet aware, GUI-eanbled, networked Agent components High level software patterns for productivity, reusabilty, quick prototypingHigh level software patterns for productivity, reusabilty, quick prototyping


Download ppt "Jinni: Intelligent Mobile Agent Programming at the Intersection of Java and Prolog Copyright © 1999, BinNet Corp. Paul Tarau University of North Texas."

Similar presentations


Ads by Google