Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modelling Agent Knowledge with Business Rules Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, UK.

Similar presentations


Presentation on theme: "Modelling Agent Knowledge with Business Rules Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, UK."— Presentation transcript:

1 Modelling Agent Knowledge with Business Rules Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, UK

2 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Overview Introduction and motivation Agent/Rule/Class (ARC) Framework –Rule Specification –Structural model –Behavioral model ARC Benefits Implementation –Business rules –Tool Support Deployment Related Work, Conclusions and Future Work

3 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Software Engineers make changes Introduction – traditional approach Software System {Knowledge} Code Software Engineers Requirements models Design Models … E.g. UML models

4 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Make changes Introduction – current thinking (MDA) Software System {Knowledge} Auto-generate Models E.g. UML models Models are reused

5 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Introduction – Agent Systems Agent Software System translate Models are reused Business Rules Make changes CASE tool

6 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Belief: the agent that executes the rule updates its beliefwith the information received in the incoming message (business company interest, customer shopping habits, etc.) Event: incoming request message Processing: process the incoming message Action: ifone ofthe rule conditions is satisfied, then perform a corresponding action with an outgoing message Rule Outgoing message a 2 c 1 c 2 c n Check Rule Condition (c 1, c 2, …, c n ) e Message a 2 a 1 a n Agent Rule Class Framework - Rules Is the rule applicable? Decode incoming message, construct business objects Check condition If c i is true, take action a i,, otherwise do (c i +1,a i +1) etc Agent adds new knowledge

7 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Agent + Business Rules = agents with a higher abstraction over objects –For each task the agent has a dedicated rule –A rule uses classes to perform the task –Rules can invoke classes and use them –Added feature is that the rules are configurable Rules can be made for agent collaboration –Partners can be changed –Actions and reactions to rules can be changed Agent Rule Class Framework – Rules (ii)

8 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE ARC - Structural Model Structural Models are built through Agent Diagrams (cf Class Diagrams in UML) The models show agents, business rules, business classes and their relationship Agents manage rules and rules manage the invocation of business classes Agent/Rule/Class hierarchy is established

9 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE In OO messages are method invocations. In ARC models they are rule collaborations between agents One rule responsible for an agents behavior in for a particular situation. Rules use Business objects to do the tasks. ARC - Structural Model Agent Symbol Classes/ objects managed Rules for behaviour Agent Name association indicates message passing Classes (as per UML) Message path

10 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE ARC - Behavioural Model Behavioural Models are built through Agent Communication Diagrams (cf UML Sequence diagrams) Models show business processes using –Agents –rules and –messages Models show agent collaborations –Agents have rules –Rule elements to form a flow of decision making, process by process one decision at each connection point Visualizes system function as sequence of agent actions dictated by rules

11 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE ARC - Structural Model

12 Captures behavioural scenarios (cf UML Sequence diagrams) Rules are event driven Shows a sequence of actions determined by (condition, action) couplets A rule in Agent1 sends a message picked up by a rule in Agent 2 Check the incoming rule condition using methods of o4, o5 Is the condition met? Response (in this case) sent back to initiating agent

13 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE ARC Framework Benefits Higher level of abstraction over OO Achieves full architecture independence (two-way encapsulation) –i.e. details of where objects will send messages is hidden Agent collaboration is not hard-coded but is configurable via the ARC behaviour model diagram Agent Collaboration can be changed at run-time as requirements change –Business rules sit between agents and classes –Business rules hold the system knowledge Major benefit is ADAPTIVITY

14 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE event message Agent 3 e Rule 3 Agent 2 e Rule 2 Agent 1 Rule 1 action message c1c1 c2c2 e Class 1Class 2Class 3 M M M IF condition 1 THEN action 1 {call business class 1 and business class 2}, send the result to Rule 2 in Agent 2} ELSE IF condition 2 THEN action 2 {call business class 2 and business class 3}, send the result to Rule 3 in Agent 3} ELSE IF condition 3 THEN action 3 {……} …… Adaptive internally – since different behaviour allowed depending on condition Adaptive externally –rules edited via tools

15 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE ARC Framework Benefits + Middleware –Suppose java classes 1/2/3 used by Agent 1 –Agent 2/3 use C++ classes –Agent layer allows inter-operation event message Agent 3 e Rule 3 Agent 2 e Rule 2 Agent 1 Rule 1 action message c1c1 c2c2 e Class 1Class 2Class 3 M M M Crosscutting concerns –Some agents can be dedicated to concerns e.g. authorisation rules, logging, and so on

16 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Illustrative Example Retailer serves students/staff using goods from various suppliers Retailer-Retailer, Customer-Retailer, Retailer-Supplier… relationships can change at any time Business classes already developed but new versions can be added later Decision making in order processing must be flexible E.g retailers may accept and order, reject it or forward it depending on different conditions

17 Agent collaborations in UML diagrams used to generate the inter-agent part of the rules definition, in XML Via these rules agent systems are adapted both in collaborations and internally without re- code or regeneration. Behavioural Model for Illustrative Example

18 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Business Rule definition in XML (context) A rule named saleProcessing is defined as a rule that controls the behaviour of CompanyAgent while the agent participates in the retailer business process.

19 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Rule definition (data) Business classes Order and Proposal will be used by the rule saleProcessing with their instantiation order and proposal.

20 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Rule definition (event) The rule will fire if its owner agent receives a Call for proposal message from the RetailerAgent.

21 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Rule definition ( processing and condition ) Construct an order object using the information contained in the incoming message. Check if isOrderAttractive () method of the created object returns TRUE.

22 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Rule definition in XML ( action section ) If TRUE, then generate a proposal object (including price for the order, order dispatch time, etc) using the constructed order, encode it into a message and send it to RetailerAgent.

23 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Business Rule Processing XML stores data to complement the ARC (UML) model Each agent –Gets a list of its own managed rules (via tag –Filters these using –Gets highest priority rule using –Checks applicability of that rule using (i.e. Inside ) –If applicable – decode the message and build required objects –Check –If TRUE, perform

24 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Business Rule Processing 1.Get a list of its managed rules using section. 2.Filter rules - retain applicable ones as per current business process using section. 3.Get rule with highest priority using 4.Check the applicability of rule using –In other words, check the section of the in matches triggering agent etc. If that is not the case, remove rule from set and go to step 3). 5.Decode the message received and build business objects from it following the instructions. –Constructor methods of existing classes will be involved. –Global variables declared in the section will be used to save the results.

25 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Business Rule Processing 6.Check current condition satisfied using Constructed business objects involved, and their methods invoked to assist. If not satisfied go to Step 9. 7.Execute section. involves encoding constructed business objects that refer to into a message. Send the message to the agent which is specified in the section of the in. 8.Analyse the business object which has been decoded from the message received and update the agents beliefs with the new information available. 9.Remove this selected rule from the rules set obtained in Step 2 and if not the last rule, go to Step Wait for the next event.

26 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Illustration of model adaptivity Example 1 – new Business class Order replaced by NewOrder with a new isOrderAttractive() method –Only need to edit some xml (via tool) – Intra Agent adaptivity Example 2 – different collaborations may be required An order is attractive, so the company agent returns a proposal with price, delivery time etc to the retailer agent But if the customer has bad credit, the company agetn may reject the proposal Alternatively, the retailer may forward it to other company agents for a better price –Using … … tags the destiantion can be easily changed in XML (or via tool) – Inter Agent adaptivity

27 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Tool Support

28 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Tool Support UML style diagrams are good at showing collaborations among agents XML shows precise definition of agent behaviors Rules can be defined either in XML text or using a more user-friendly tree structure in the left panel of the tool XML code is finally generated from the completed tree structure and saved in a rules document

29 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Implementation and deployment Agent systems are automatically generated such that each rule maps to an agent behavior XML-based rules are plugged in and are subsequently translated by agents at run- time While the system is running, rules can be updated through the tool, so that agent behaviors are continuously updated

30 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Agent behaviour pseudo code (R2) if (order. isOrderAttractive ()) { /* the condition of the rule is satisfied */ proposal = order. createProposal (); Message m2 = new Message (); m2. setContentObject (proposal); Agent toAgent = thisRule. getAction ().getMessage (). getToAgent (); m2. addReceiverAgent (toAgent); thisAgent. send (m2); /* update this agents beliefs */ thisAgent. addBelief (System. getCurrentTime (), fromAgent, m); } m = thisAgent. receiveMessage (); } thisAgent. addBehaviour (Rule thisRule) { thisBehaviour. setPriority (thisRule. getPriority ()); Order order; Proposal proposal; Message m = thisAgent. receiveMessage (); while (m != null) { Agent fromAgent = m. getSenderAgent (); if (fromAgent. equals (thisRule. getEvent (). getMessage (). getFromAgent())) { /* the rule is applicable to the received message */ BusinessInfo businessInfo = (BusinessInfo) m.getContentObject (); order = new Order (businessInfo); Provided by Rule code – gets the xml values

31 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Deployment of agent systems (ARC) Agent system generated initially System runs using Jade, reading XML rules XML repository updated immediately Rules updated via tool ARC models specified along with XML rules

32 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Alternative approaches to Adaptivity –Strategy Design Pattern –Coordination Contract –Adaptive Object Model Why ARC approach –All of the above are OO –Agents are by definition active –Agents now proven technology –ARC uses business rules – original objects kept intact –ARC allows agents to change the way they use the object and also to change the agent collaboration Related Work

33 Modelling Agent Knowledge with Business Rules – L. Xiao, D.Greer, SEKE Conclusion Building agent systems on top of OO systems using the ARC framework achieves adaptivity i) by configuring host system components collaboration ii) Inter-operability is achieved by enabling the collaboration between cross platform components that are written in different languages, in a distributed environment. iii) Easy maintenance is facilitated by separating crosscutting concerns in dedicated agents. Benefits of the OO paradigm are not abandoned Features of CORBA and aspect-oriented programming can be introduced via an agent layer coupled with knowledge in business rules. The ARC framework will be made more powerful, but work so far indicates that it assists the achievement of adaptivity in systems.


Download ppt "Modelling Agent Knowledge with Business Rules Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, UK."

Similar presentations


Ads by Google