333658ad3da0b1fa77d0e7cbd0249aed.ppt
- Количество слайдов: 26
Jinni: Intelligent Mobile Agent Programming at the Intersection of Java and Prolog Paul Tarau University of North Texas & Bin. Net Corporation Copyright © 1999, Bin. Net Corp.
other talk: Blackboard Constraints in Jinni http: //www. binnetcorp. com Paul Tarau University of North Texas & Bin. Net Corporation Copyright © 1999, Bin. Net Corp.
What is Jinni? JINNI: Java INference engine and Networked Interactor • lightweight, multi-threaded • Prolog-style agent scripting language • knowledge processing components • high level, distributed, Java based: alternative to RMI, CORBA, KQML
Motivation • paradigm shift towards networked, mobile, ubiquitous computing • increasingly complex patterns of interaction • reactive and mobile agents • inference capabilities, autonomy and selfreliance.
BASIC ONTOLOGY: THE USERS' VIEW • Things: represented as Prolog terms • Places: server component listening on a port + Linda blackboard • Agents: collections of mobile threads • running a set of goals at set of Places • transporting and processing Things
A typical Jinni application • a hierarchy of Places and Agents • Agent threads moving between Places • wait for/produce Things satisfying constraints • sensing changes of state, produce and react to events
THE ARCHITECTURE OF JINNI • operatorless syntactic subset of Prolog • multiple engines running on separate threads, • blackboards to communicate between engines • Linda coordination, associative search
Architecture of Jinni - details • high level networking operations: code and compoutation mobility, remote execution • Jinni-to-Java translator • ability to load code directly from the Web • hyothetical reasoning, backtrackable assumptions, Assumption Grammars
The Jinni Kernel: Basic Linda + Remote Predicate Calls • out(X): puts X on the blackboard • in(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 blackboard • the(Pattern, Goal, Answer): runs Goal to produce the(Answer) or no => here/there switch =>local/remote
Assertional Constraints vs. Binding Constrains • when nonvar(X). . . • when proven(X) … • when a_fact(X)… more realistic • lower granularity • arguably: more appropriate 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 blackboard • notify_about(Pattern): notifies about this Pattern one of the blocked threads which waits for it with a matching constraint
Coordination with Blackboard Constraints • ? - notify_about(stock_offer(nscp, 29)). • ? -wait_for(stock_offer(nscp, Price), less(Price, 30)).
wait_for(Pattern, Constr) wait_for(P, C): if(take_pattern(available_for(P), C), true, and(local_out(waiting_for(P, C)), local_in(holds_for(P, C)) ) ).
notify_about(Pattern, Constr) notify_about(P): if(take_pattern(waiting_for(P, C), local_out(holds_for(P, C)), local_out(available_for(P)) ).
take_pattern/2 take_pattern(Pattern, Constraint): local_all(Pattern, Ps), member(Pattern, Ps), Constraint, local_cin(Pattern, _).
Mobile thread operations • run_server/0, here/0, there/0, where/1 • set_this_host/1, set_this_port/1 • set_that_host/1, set_that_port/1 • move/0, return/0 • bg/1, bg/2, thread_clone/1
BUILDING BEHAVIORS: BASIC AGENT PROGRAMMING CONSTRUCTS • a reactive channel listener • ? -listen(fun(_)). • selective channel publisher • ? -talk(fun(jokes)). • will not match: • ? -talk(stocks(quotes, nasdaq))
Example: a stock market trader agent • sell(Who, Stock, Ask. Price) : notify_about(offer(Who, Stock, Ask. Price)). • buy(Who, Stock, Selling. Price) : bg(try_to_buy(Who, Stock, Selling. Price)). • try_to_buy(Me, Stock, Limit. Price) : wait_for(offer(You, Stock, Your. Price), ……….
Examples of Mobile Computations • Window 1: a mobile thread • ? - there, move, println(on_server), member(X, [1, 2, 3]), return, println(back). • Window 2: a server • ? - run_server.
Mobile code vs. RPCs: move once, compute many times • ? -for(I, 1, 1000), remote_run(println(I)), eq(I, 1000). • ? -there, move, for(I, 1, 1000), println(I), eq(I, 1000).
Mobile code: WHY? • Large database, small agent • Speed-up: move to a fast processor and back, transparently • here/there switch: same code can be run localy or remotely • fault tolerance - move->run->come back
Emulating multiple answer computations • ? - there, move, findall(X, for(I, 1, 3), Xs), return, member(X, Xs). • X=1; • X=2; • X=3
Reflective Meta Interpreter • solve(G): -once(reduce(G, New. G)), New. G. • reduce(G, G): -is_builtin(G). • reduce(', '(A, B), ', '(solve(A), solve(B))). • reduce(G, ', '(clause(G, Gs), solve(Gs))).
MUTUAL AGENT/HOST SECURITY: THE BRING YOUR OWN WINE PRINCIPLE • reflective meta-interpreter: a few lines of Prolog - can be mobile - bring your own! • a sandbox can protect the Host against the Agent • undecidability of a Turing equivalent meta-interpreter protects the Agent against the Host
Ongoing Work • Day trader: reactive agent, using Internet data mining for quotes and user defined rules beyond conventional limit/stop/market transactions • Network monitoring: new Internet 2 infrastructure at UNT, experiments with mobile agents on Gigabit networks • Visual Jinni, educational agents
Conclusion • Synergy between Logic Programming and Java based distributed programming • Integrated infrastructure for builting Internet aware, GUI-eanbled, networked Agent components • High level software patterns for productivity, reusabilty, quick prototyping
333658ad3da0b1fa77d0e7cbd0249aed.ppt