23
The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through Dynamic Agents and XML-based Business Rules

The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

Embed Size (px)

Citation preview

Page 1: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

The Adaptive Agent Model

Liang Xiao and Des GreerSchool of Computer Science,Queen's University Belfast,

Northern Ireland, UK

Software Adaptivity through Dynamic Agents and XML-based

Business Rules

Page 2: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20052

Overview

Motivation

Other Approaches

Our Approach

Conclusions

Background

Example

Adapting Business Policy

Adapting Business Concepts

Adapting Business Collaboration

Page 3: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20053

Motivation

• Software maintenance is very expensive

• Much of Software Engineering research into making systems easily and economically adaptable

• Need to make change easier and cheaper!

• Better still is adaptive

– Systems change their behaviour according to their context

• Combining OO with Agent approach may provide a route to adaptivity

Page 4: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20054

Selected approaches to Adaptivity (i)

• Use of design pattern e.g. Strategy– Predict future behaviour and write code for it

– Later select new behaviour

– Relies on being able to predict behaviour

• Co-ordination Contract – externalise coordination as contracts– Evolve by adding/changing contracts

– Components still have to be recoded if functionality cannot be achieved via contracts

Page 5: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20055

Selected approaches to Adaptivity (ii)

• Adaptive (Active) Object Model (AOM)– Model system as metadata

– TypeObject, Property and Strategy patterns

– Create new classes at runtime

– Behaviour can be adapted if predicted

– BUT• Persistence of new objects requires object database• Hard coded classes do not represent business model• Adaptivity only if future behaviour has been predicted• No easily accessible of the ACTUAL system model

Page 6: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20056

Selected approaches to Adaptivity (iii)• Main concerns are cost

and time for maintenance

• Cheapest (ideal) solution is self-adaptivity

• Objects are passive

• Need new approach to move responsibility for change towards the user

Cost/T

ime

Users Engineers

Goal

Strategy P

attern

Recode

Starting point

Coordination

Contract

Adaptive O

bject M

odel

Page 7: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20057

What’s important?

• Important in OO: modularity, information hiding …

• These refer to easy redesign NOT adaptation during operation

• Much attention on intelligent/autonomous agents for adaptivity

– Agents capable of flexible, autonomous action to meet their own objectives

Page 8: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20058

Why Agents and Business Rules?

• Our Hypotheses:– system consisting of agents, where the behaviour

can be configured dynamically as policies or rules will provide better adaptivity

– Agents are active , unlike objects• Objects have static methods, agents have flexibility

– Requirements embedded in code are not easily adapted

– Rules can be externalised (as XML) and used by agents

• Externalisation means ease of change

Page 9: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 20059

Illustrative Example

• Retailer serves students/staff

• Policies include certain discounts– e.g. individual students/groups/departments

– Customers can become ‘premium’

– Goods ordered have different suppliers and discount may depend on that too

– Policies added/amended constantly

– Suppose a new attribute ‘credit’ is added later and new policies arise based on the value of that

Page 10: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200510

Simple example – change issues

• 3 categories of change

– New business policy e.g. new discount for a certain group

– New business concepts e.g ‘credit’

– New business architecture/ collaboration e.g. change to new supplier

• How can we allow these to be changed?

Page 11: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200511

Adapting Business Policy

• Business policies represented as rules

• Business rules traditionally often embedded in code / logic

• 2 categories

– Global = apply to whole business domain. These refer to business policy

– ( Local = apply to individual agents and refer to how they collaborate)

Page 12: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200512

Adapting business policy (ii)

•We use a simple template for global rules

IF objectName1.attribute1 op1 value1THEN objectName2.attribute2 op2 value 2Priority value3

- <rule> <id> ruleId </id> <condition> objectName1.attributeName1 op1 value1 </condition> <action> objectName2.attributeName2 op2 value2 </action> <priority> value3</priority> </rule>

Page 13: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200513

Adapting business policy (iii)

IF customer.type == premium

THEN customer.discount := 5%

Priority 5

Page 14: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200514

Adapting business policy (iii)

• Business Rules Manager Agent (BRMA) oversees the process

Customer Agent

Business Rules

Manager Agent

Customer discount

Customer type?

premium

discount = 5%

R

• BRMA gets top-priority rule

• Message sent to initialising agent for context (i.e. <condition>

• TRUE: <action. Executed

• FALSE: move to next rule

Page 15: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200515

Adapting Business Concepts

• New objects, new attributes may arise

• Metadata Editor allows these to be added

-<object> <name>customer</name>

- <attributes> <attribute>name</attribute> <attribute>type</attribute> <!-- … more attributes … --> <attribute>credit</attribute> </attributes> <behaviour/> </object>

Page 16: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200516

Adapting Business Concepts (ii)

• New attribute becomes available to business rules editor

Page 17: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200517

Adapting Collaboration

• Agent systems work via collaboration of agents

• For AAM collaboration should be adaptive

• Full architecture independence (two-way encapsulation) is the ideal case

– i.e. details of where objects will send messages is hidden

• Architecture Editor defines local rules– Adjusts who ‘talks’ to who and what happens when

Page 18: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200518

- <local-rule>

<name>saleProcessing</name>

<business-process>retailer business</business-process>

<owner-agent>Company</owner-agent>

Adapting Collaboration (ii) <condition>

order.isOrderAttractive() = true

</condition>

- <action> <type>send a message</type> - <message> <from>Company.saleProcessing</from> <to>Retailer.proposalProcessing</to> <title>Propose</title> - <content> …</content> </message></action>

<priority>5</priority>

- <event>

<type>receipt of message</type>

- <message>

<from>Retailer.orderProcessing</from>

<to>Company.saleProcessing</to>

<title>Call for proposal</title> - <content> … </content>

</message>

</event>

Page 19: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200519

Adapting Collaboration (iii)

• Rule definitions contain

– Causing trigger event

– The data content of the message being received

– A series of (condition, action, priority) triplets

• When an event occurs (usually receipt of a message)

– The agent looks at its local rule set and chooses which action to take

• Collaboration is dynamic

– Via the Architecture editor rules are changed and saved as XML and used immediately

Page 20: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200520

Belief: the agent that executes the rule updates its belief with the information received in the incoming message (business company interest, customer shopping habits, etc.)

Event: incoming request message

Processing: process the incoming message

Action: if one of the rule conditions is satisfied, then perform a corresponding action with an outgoing message

Rule

Outgoing message

a2

c1

c2

cn

Check Rule Condition (c1, c2, … , cn)

e

Message

a2

a1

an

Rule Specification

Page 21: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200521

EvaluationApproach

Area of Adaptivity

Strategy Design Pattern

Coordination Contract

AOM AAM

Business Concepts

No No Yes Yes

Business Policies

Yes, but only if all future policies can be predicted

Yes, built only if new policies can be expressed as contracts.

Yes, but only if all future policies can be predicted

Yes, additional text-based rules suffice

Business Architectures

No Yes Yes Yes

Page 22: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200522

Conclusion• Agents retrieve knowledge from business

rules

– New business concepts (Metadata editor)

– Change of business policy (Business Rules Editor)

– Change of business architectures (Architecture editor)

• Adaptivity achieved since the editors define the environment and the system reacts

Page 23: The Adaptive Agent Model Liang Xiao and Des Greer School of Computer Science, Queen's University Belfast, Northern Ireland, UK Software Adaptivity through

AAM – L. Xiao, D.Greer, SEKE 200523

End users

Business people (business infrastructure/architecture designer)

AAM CASE tool

Business Rules Document

(including UML models & rules)

Generation

Business people (business decision maker)

Agent System

Adaptive Information (behaviors)

Feedback

Adaptive Information (requirements)

Agent beliefs

Future vision

• Some Possibilities

– Priorities of rules are learned

– Alternative paths are taken as required