# Transparent Task Delegation in Multi-Agent Systems Using the QuAD-V Framework
## 3 Delegation Model
### Explanation Generation Process  
The explanations produced by our delegation model are built based on Algorithm 1. This algorithm takes as input an answer argument and its supporting QuAD-V framework. It recursively evaluates the strength of arguments related to the answer argument to construct an explanation. The generated explanation consists of a decision (acceptance or rejection) and a set of arguments that justify such a decision. If the acceptance score of the answer argument is greater than or equal to 0.5, the argument is accepted along with supporting arguments; otherwise, it is rejected and opposing arguments are provided as justification [37]. Additionally, Algorithm 1 follows four main steps to generate explanations:  
* **Initialization** (lines 1-4): The algorithm initializes the necessary variables, including the sets of supporting arguments (_pros_) and opposing arguments (_cons_), as well as setting the acceptance threshold value (\(TH\)). Then, the children of the answer argument (_arg_) are retrieved from the QuAD-V framework. * **Processing supporting and opposing arguments** (lines 5-7): For each child argument, the algorithm calls the _GenerateExplanation_ function, which determines whether the child argument supports or opposes the answer argument. If the child is a supporting argument and has an acceptance score above the threshold, it is added to the set of supporting arguments (_pros_). If it is an opposing argument and has an acceptance score above the threshold, it is added to the set of opposing arguments (_cons_). * **Constructing the explanation** (lines 8-14): After evaluating all supporting and opposing arguments, the algorithm constructs the explanation. The explanation consists of the decision (accepted or rejected) followed by a structured justification. If the answer argument meets or exceeds the threshold (\(TH\)), the explanation includes its acceptance and the supporting arguments that reinforce this decision. Otherwise, the argument is rejected, and the opposing arguments are included to justify the rejection. * **Recursive propagation** (lines 17-25): The algorithm recursively processes the children of each argument, ensuring that all relevant arguments are considered when forming the explanation. ```
1:Input: Argument \(arg\), QuAD-V framework \(fw\)
2:Output: Explanation for acceptance or rejection
3: Initialize \(pros\leftarrow\emptyset\), \(cons\leftarrow\emptyset\), \(TH\gets 0.5\)
4:\(children\gets fw.childrenOf(arg)\)
5:for each \(child\in children\)do
6: Call GenerateExplanation(\(arg,child,TH,fw\))
7:endfor
8:if\(arg\_baseScore\geq TH\)then
9: Append (\(arg\_content\), \(ACCEPTED\)) to explanation
10: Append supporting arguments \(pros\) to explanation
11:else
12: Append (\(arg\_content\), \(REJECTED\)) to explanation
13: Append attacking arguments \(cons\) to explanation
14:endif
15: Return explanation
16:
17:Function GenerateExplanation(\(father,child,TH,fw\))
18:if\(fw.isProArgumentOf(father,child)\)then
19: Append \(child\) to \(pros\) if \(child.baseScore\geq TH\)
20:else if\(fw.isConArgumentOf(father,child)\)then
21: Append \(child\) to \(cons\) if \(child.baseScore\geq TH\)
22:endif
23:if\(fw.children(child)\) is not empty then
24:for each \(arg\in fw.children(child)\)do
25: Call GenerateExplanation(\(child,arg,TH,fw\))
26:endfor
27:endif
```  
**Algorithm 1** Generating Explanations based on QuAD-V Framework  
In particular, the explanations follow a structured format. Each explanation contains the following: (_i_) the final decision (ACCEPTED or REJECTED), (_ii_) supporting arguments that justify acceptance, and (_iii_) opposing arguments that justify rejection. Regarding the completeness of the explanation generation process, the algorithm always produces an explanation, as the acceptance decision is determined based on the predefined threshold (\(TH\)). Even in cases where there are no supporting or opposing arguments, the explanation will still contain a decision based on the acceptance score of the answer argument.