# Framework for Incorporating Artificial Somatic Markers in the Decision-Making of Autonomous Agents
## 4 Design of Artificial Somatic Markers for Decision-Making of Autonomous Agents
### Designing Algorithms for the Decision-Making of Autonomous Agents
In the case of a \"neutral\" stimulus, a general list of past actions is given, a list of goals, also indicating the type of stimulus and that a \"normal priority\" response is required. On the other hand, algorithm 3 divides its scope of action in three senses. If the decision scenario has a \"high priority\" level and the type of stimulus is a \"threat\", a subselection of options is generated from both the list of actions and the list of goals, considering those oriented to maximize the sense of trust in the autonomous agent. Meanwhile, if the decision scenario has a \"high priority\" level and the type of stimulus is an \"opportunity\", the particular subselection of options is generated considering those oriented to maximize the feeling of joy in the autonomous agent. In both of the previous cases, algorithm 4 \"Decision Selection and Performing\" is quickly called, providing the reduced list of possible options, the list of agent goals, and the priority level associated with the detected stimulus. In another case, if the decision scenario has a \"normal priority\" level, based on the type of stimulus detected, and for each option that could be followed by the autonomous agent, possible conflicts between the particular option are checked, as well as the list of (specific) goals and global goals of the agent, that is, those fundamental objectives or guidelines that structurally define the work of the autonomous agent. Then, possible emotional effects are obtained from following the option under analysis. Subsequently, somatic associations recorded in the long-term memory of the autonomous agent are searched for. If the somatic association is positive, then the option under evaluation is labeled \"positive\" and loaded into an updated list of options. Similarly, if the somatic association is negative, then the option under evaluation is labeled \"negative\" and loaded into an updated list of options. In another case, the option under evaluation is labeled \"neutral\". Finally, algorithm 4 \"Decision Selection and Performing\" is called. ```
1:\(\{decision\_options\_list,\_goal\_list,\_priority\_level\}\)
2:Begin
3:If (priority_level = '_high priority'_)
4:\(\{final\_decision\}\) = apply Fast Decision Rules to \(\{decision\_options\_list\}\)
5:elseIf (priority_level = '_normal priority'_)
6:For each \(\{option\}\in\{decision\_options\_list\}\)
7:decision_reward = determine Somatic Reward (\(option\), \(goal\_list\), \(global\_goals\))
8:decision_punishment = determine Somatic Punishment (\(option\), \(goal\_list\), \(global\_goals\))
9:decision_selectivity_index = apply Decision Rules to \(\{option\), \(decision\_reward\), \(decision\_punishment\}\)
10:Add (\(option\); \(decision\_reward\); \(decision\_punishment\); \(decision\_selectivity\_index\)) in \(\{candidate\_decision\_list\}\)
11:End For
12:Sort [\(candidate\_decision\_list\)] by \(\{decision\_selectivity\_index\}\)
13:\(\{final\_decision\}\) = get \(\{option\}\) by Max \(\{decision\_selectivity\_index\}\) from \(\{candidate\_decision\_list\}\)
14:End If
15:Get \(\{actions\}\) associated to \(\{final\_decision\}\)
16:Activate [\(executive\_processes\)] to perform \(\{actions\}\)
17:Memory Management (\(final\_decision\), \(option\_selectivity\_index\), \(actions\), \(option\_reward\), \(option\_punishment\)) End Algorithm 4
```  
**Algorithm 4** Decision Selection and Performing  
Algorithm 4 guides the selection of a decision and its execution. If the priority to decide is high, then a specific set of decision rules geared towards scenarios that require urgent attention is applied. Conversely, if the priority to decide is normal, then for each candidate option to be chosen, a \"somatic reward\" and a \"somatic punishment\" are determined, corresponding to positive or negative sensations that may remain latent in the working memory of the autonomous agent, and which try to emulate a feeling of \"well-being\" when a satisfactory decision is made, and to emulate a feeling of \"regret or discomfort\" when a partially (or totally) unsatisfactory decision is made.