Multiagent systems a practical approach to MAS construction in Java (using Boris) Simon Lynch...

Post on 20-Dec-2015

222 views 6 download

Tags:

Transcript of Multiagent systems a practical approach to MAS construction in Java (using Boris) Simon Lynch...

multiagent systems

a practical approach toMAS construction in Java

(using Boris)

Simon Lynch s.c.lynch@tees.ac.uk

software architecture

SpeechRecognition

LanguageEngine Pragmatic

Integration

DialogManager

ExpertSystem

SpeechSynthesis

W orkingKn Base

LTMKn Base

LanguageGeneration

GUIModels

Visualiser

W igitInput

synchronisation

synchronisation

•distributed•mixed language•concurrent

Boris agents – why?

MultiAgent Systems...

• advanced s/w architecturesdynamic, distributeddecentralised controlsocial, goal-based

• mobility, platform independence• design-time autonomy• reuse

Boris agents – what?

• independent software(?) entities– send & receive messages

like objects but...– distributed– autonomous at design & execution– have their own process thread– tighter encapsulation & interfaces– task oriented

Boris agents – types?

various types...• web based, brokered• small & mobile• larger scale / intelligent...etc...

Boris agents - how?

in Java with Boris(because you can also use C#, Lisp...)

analogy...• agents & GUI components• GUI events & message events

Boris example

Portal p = new Portal( portal-name );Agent a = new Agent( agent-name );a.addMessageListener(new MessageListener(){ public void messageReceived(String from, String to, String msg, MsgId

id) { ...code body... }});p.addAgent( a );

Panel p = new Panel();Button b = new Button( text );b.addActionListener( new ActionListener(){ public void actionPerformed( ActionEvent event ) { ...code body... }});p.add( b );

Sending messagesPortal p = new Portal( portal-name );Agent sue = new Agent( "sue" );sue.addMessageListener(new MessageListener(){ public void messageReceived(String from, String to, String msg, MsgId id) { ...code body... }});p.addAgent( sue );Agent sam = new Agent( "sam" );p.addAgent( sam );

...sam.sendMessage( "sue", "hello sue" );...

Virtual Networks

normally, agents are distributed across• multiple VMs• multi-language VMs• multiple machines

Boris uses network concept based on...• Portals• Routers

agents, portals, routers & VMs

agent

agent

agent

agent

agent

MAS design...

a collection of communicating agents

agents, portals & routers

• agents communicate via portals

• portals communicate via router(s)

agent

agentpor t al

agent

agentpor t al

shar ed VM

agent

agent

agent

por t alr out er

agents, portals & routers

• agents who share a portal communicate directly

• routers not necessary for single-portal MASs

agent

agentpor t al

agent

agentpor t al

shar ed VM

agent

agent

agent

por t alr out er

agents, portals & routers

• cross-portal communication requires a router even if portals share a VM

agent

agentpor t al

agent

agentpor t al

shar ed VM

agent

agent

agent

por t alr out er

connecting portals to routers

portal methods• void connectToGrid( InetAddress host, int portNo

)• void connectToGrid( int portNo )• void connectToGrid( InetAddress host )• void connectToGrid( )

NB:• connection in separate thread• may take few seconds over internet

using the console

loading agentsimport boris.kernel.*;.....public class MyClass{ public MyClass( Portal portal, String cmdLine )

{ //--- set up agent ----final Agent agent = new Agent( name );portal.addAgent( agent );.....

}.....}

tracking activity