## Multi-agent design patterns
| Design pattern | Description | classification | real-life analogy |
| --- | --- | :---: | --- |
| Blackboard Pattern | agents write, read, and work with the information on a shared data centre (blackboard) | :handshake: | experts collaborating around a blackboard |
| Contract Net Protocol | leader agent launches auction and determines the winner(s) to assign tasks, while the winner will report the results after done | :handshake: | frealancers bid for cases |
| Market-Based Pattern | agents cope with the mission as per market mechanism regarding their resource | :handshake: | capitalism |
| Hierarchical Organisation | agents work in super-subordinate relationship | :classical_building: | traditional company structure |
| Flat Organisation | agents work in equal colleagues relationship | :classical_building: | a teacher (leader) and students (peers) |
| Holonic Organisation | agents dynamically form sub-groups, and sub-groups coordinate as a big individual for certain goal | :classical_building: | _Dictyostelium discoideum_ |
| Federated Organisation | agents form groups and groups form ferderation | :classical_building: | relationship between state governments |
| Coalition organisation | agents form temporal and dynatic groups for common goal | :classical_building: | artistes under the same management company |
| Role assignment pattern | agents play and\/or switch their roles as per predefined pattern to conduct assigned tasks | :performing_arts: | cosplayer |
| Teamwork Pattern | agents team up by predefined rules for specialisation | :performing_arts: | Straw Hat Pirates |
| Belief-Desire-Intention (BDI) Architecture | belief-driven agents scheme their plan to achieve desires (assigned missions) | :thought_balloon: | sweet-craving kids |
Legend:
* :handshake:: Coordination-based
* :classical_building: Organisation-based
* :performing_arts: Role-based
* :thought_balloon: Cognition-based
* _The last column is the analogy to [organisational structure in business](https://hackmd.io/QoAugV3oTcC-sEncEBNaGg?both#Organisational-structure-in-business)_
---
### Classification
#### Coordination-Based:
* blackboard pattern:
all agents use the same blackboard to collaborate and share information
* blackboard is a shared data centre
* agents conduct tasks via reading and writing with the blackboard
* blackboard will be dynamically updated until problem solved
* Contract Net Protocol
An agent manager launches a mission (contract), and all agents bid for it based on their own resource and expertise --`auction raiser`-> judges and assigns the task --`executor`-> does the work and reports results
* contract: the mission to be dealt with
* agent manager: raises auctions (contract) and assigns tasks to the most suitable agent to perform
* executor: the competent agent wins the contract
* Market-Based Pattern
agents are traders in free market, buying and selling resources to achieve tasks
* market mechanism
* high abstract level
* Contract Net Protocol is a low-level implementation
* e.g.
* Auction (Contract Net Protocol)
* Bargaining
* Coalition Formation
#### Organisation-Based:
* Hierarchical Organisation
just like a company, some agents manage others in order-control relationship
* some are superordinates
* some are subordinates ~~to be bullied~~
* Flat Organisation
agents are at similar or same level, no obvious superordinate or subordinate
* colleagues without affiliation
* Holonic Organisation
agents **dynamically** form holons while holons form holarchy, holon can be flat or hierarchical, while holarchy is hierarchical
* holon: a group of agents
* holarchy: the collection of holons
* Federated Organisation
agents communicate with their facilitator (manager) within the same group, while the groups form decentralised federation
* facilitator: superordinate
* agent: subordinate, and they won't talk to each other (communication is facilitated by facilitators instead)

<span style='font-size: 0.64em;'>Shehory, Onn. (1999). Architectural Properties of Multi-Agent Systems.</span>
* Coalition organisation
agents **dynamically** and **temporarily** form coalition to share information and resources for common goal
* coalition: **temporary** team of agents with shared goal
* agents share resource and cooperate in a coalition
* agents abide by predefined rules (e.g. game theory) to group up or leave a coalition, and coalition can also be long-term

* (a) centralised
* (b) decentralised
* \(c\) hierarchical
* (d) holonic
* (e) coalition
<span style='font-size: 0.64em;'>Izmirlioglu, Y., Pham, L., Son, T. C., & Pontelli, E. (2024). A Survey of Multi-Agent Systems for Smartgrids. Energies, 17(15), 3620. https://doi.org/10.3390/en17153620 </span>
#### Role-based:
* role assignment pattern
define the role-play and role-switching rules for agents to perform
* agents will switch/play their role by predefined rules

<span style='font-size: 0.64em;'>Ghazal, Rubina & Malik, Ahmad & Raza, Basit & Qadeer, Nauman & Qamar, Nafees & Bhatia, Sajal. (2021). Agent-Based Semantic Role Mining for Intelligent Access Control in Multi-Domain Collaborative Applications of Smart Cities. Sensors. 21. 4253. 10.3390/s21134253. </span>
* Teamwork Pattern
define the **specialised** team-organising rules for agents to perform
* agents will team up as per predefined rules
* emphasise **specialisation**
#### Cognition-Based
* Belief-Desire-Intention (BDI) Architecture
agents have desire based on their belief, and choose some desires to fulfil by intent actions
* agents perceive their environment to generate **B**elief
* choose goal(s), i.e. desires to achieve
* scheme some plans (intention) to perform in order to reach the goals

<span style='font-size: 0.64em;'>Ghazouani, Mohamed & Medromi, Hicham & Boulafdour, Brahim & Sayouti, Adil. (2013). A model for an Information security management system (ISMS Tool) based multi agent system.</span>
<br>
---
<br>
The content below is a brief introduction for common organisational structures in business
### Organisational structure in business

<span style='font-size: 0.64em;'>Microsoft Overhauls, the Apple Way, NICK WINGFIELD, NYT, July 11, 2013 http://www.nytimes.com/2013/07/12/technology/microsoft-revamps-structure-and-management.html</span>
* Amazon: Hierarchical
* Google: Matrix
* Facebook: Network
* Microsoft: ~~Rivalry~~ Divisional
* Apple: ~~Jobs-cored~~ Circular
* Oracle: ~~Suing~~ Functional
---
#### Commom organisational structure:
* Hierarchical
literally a structure with affiliative hierarchy

<span style='font-size: 0.64em;'>source: Ibi, i.e. me</span>
* Functional
organised by function

<span style='font-size: 0.64em;'>source: Ibi, i.e. me</span>
* Divisional
organised by orientation (e.g. product, service or market, etc.)
* Matrix
cross-functional teams occasionally work for other projects
* Line
small sized organisation only having vertical structure
* Horizontal (or flat)
flat structure with or without a superordinate

<span style='font-size: 0.64em;'>source: Ibi, i.e. me</span>
* Network
core member \+ satellite offices and cooperators
_open communication rather than hierarchy_

<span style='font-size: 0.64em;'>source: Ibi, i.e. me</span>
* Circular
leader in the centre instead of top, passing message outwards but not downwards the people chain
_more efficient than hierarchical one_
* Process-based
organised by sequential process

<span style='font-size: 0.64em;'>source: Ibi, i.e. me</span>
* Team-based
organised as a team, focus on problem-solving and goal-achieving
* tiger team
expert team for certain objective
* Scrum team
one-sprint-one-goal iterative progression
`for sprint in goals: sprint.yield(increment)`
* Product owner:
* formulate the project direction
* list product backlog
* Scrum master:
* facilitate teamwork
* supervision and consultation
* Developer (s):
* project execution
* self-organisation
* activities:
* Sprint Planning: scheme goal and backlog
* Daily Scrum: **Daily Stand-up Meeting** for progress and issues report
* Sprint Review: feedback request to product owner and stakeholders
* Sprint Retrospective: reflection
---
#### building organisational structures with multi-agent system design patterns:
_Not all structures are able to be constructed with multi-agent design patterns_
| Organisational structure in business | Multi-agent design patterns | Notes |
| --- | --- | --- |
| Hierarchical structure | Hierarchical Organisation | direct match |
| Functional Structure | Hierarchical Organisation | function-departmented hierarchical structure |
| Divisional Structure | Hierarchical Organisation | orientation-departmented hierarchical structure |
| Matrix Structure | Hierarchical Organisation \+ blackboard | matrix structure still has hierarchy, while criss-cross info sharing resembling the blackboard |
| Line Structure | Hierarchical Organisation | the simplest hierarchical structure |
| Horizontal \/ Flat Structure | Flat Organisation | direct match |
| Network Structure | Federated Organisation \+ Market-Based Pattern \+ hierarchical structure | satellite offices $\approx$ federation in market, while the core is hierarchical structure |
| Circular Structure | Flat Organisation \+ Blackboard Pattern | central leader with flat structure, while the leader serves as the info centre resembling the blackboard |
| Process-based Structure | role assignment pattern \+ Blackboard Pattern | specialised roles for different processes, and the shared info can be deemed the blackboard |
| Team-based Structure | Teamwork Pattern | direct match |
| Tiger Team | Teamwork Pattern | goal-oriented teamwork pattern |
| Scrum Team | Teamwork Pattern \+ role assignment pattern \+ Belief-Desire-Intention (BDI) Architecture | team with assigned roles, while continual feedback mechanism matches BDI |
Reference:
* [Lucidchart organisational structures](https://www.lucidchart.com/blog/types-of-organizational-structures)
* [Whatfix organisation architecture](https://whatfix.com/blog/organizational-structure/)
* [Business Thinking Academy](https://bizthinking.com.tw/2021/07/01/organization-architecture/)