# Artificial Punishment Signals for Guiding the Decision-Making Process of an Autonomous System
## 3 Materials and Methods
### Tolerance to Risk, Loss, and Accumulated Loss, and Performance Evaluation  
Risk tolerance, loss tolerance, and cumulative loss tolerance are time-varying dimensions, according to Equations (11), (12), and (13), respectively:  
\[TolRisk_{t}= \begin{cases}\alpha\beta^{punishment_{t}}+C,&\text{if }SIndex_{t}\geq MaxSIndex\\ TolRisk_{t}&\text{otherwise},\end{cases}  \tag{11}\]  
\[TolLoss_{t}= \begin{cases}\gamma\sigma^{punishment_{t}},&\text{if }SIndex_{t}\geq MaxSIndex\\ TolLoss_{t}&\text{otherwise},\end{cases}  \tag{12}\]  
\[TolCumLoss_{t}= \begin{cases}\delta\omega^{punishment_{t}},&\text{if }SIndex_{t}\geq MaxSIndex\\ TolCumLoss_{t}&\text{otherwise},\end{cases}  \tag{13}\]  
where \(\alpha\), \(\gamma\), and \(\delta\) correspond to constants that define the initial tolerance of the autonomous system to risk, loss, and accumulated loss, respectively. On the other hand, \(\beta^{si}\), \(\varphi^{si}\), and \(\omega^{si}\) correspond to a factor that represents the sensitivity of the autonomous system against the risk, loss, and accumulated loss, which vary as the autonomous system reaches the \(MaxSIndex\) threshold. All these parameters must be calibrated for each experimental scenario to ensure the stability of the system. For all periods \(t\), the values of the factors \(\beta^{\pi_{t}}\), \(\varphi^{\pi_{t}}\), and \(\omega^{\pi_{t}}\) are between \([0,1]\). To measure the performance of the described model, we can generate an indicator that can be compared with a benchmark. In this sense, we can use the economic literature to generate an evaluation of the level of utility, which we describe as follows:  
\[TotPerformance_{T}=\frac{\int_{0}^{T}Utility_{AA,t}e^{-\kappa t}dt}{\int_{0}^{T} Utility_{Bench,t}e^{-\kappa t}dt}=\frac{TotUt_{AA,T}}{TotUt_{Bench,T}}, \tag{14}\]  
where \(\int_{0}^{T}Utility_{AA,t}e^{-\kappa t}dt\) and \(\int_{0}^{T}Utility_{Bench,t}e^{-\kappa t}dt\) correspond to the integrals that generate the utility of the autonomous system model and a benchmark between an initial period \(0\) and a period \(T\), respectively. Note that the utility for any moment in time is multiplied by \(e^{-\kappa t}\), where \(\kappa\) corresponds to the intertemporal discount rate which the autonomous system faces and is strongly related to the market interest rates existing at that moment in time. This approximation allows us to compare the outcome of the autonomous system with a passive alternative, which in turn allows us to find the best alternative calibration of the model, considering the time effects of an investment decision. On the other hand, an algorithmic sequence of the investment decision-making process is presented below. A graphical representation of this algorithm is depicted by Figure 1. Meanwhile, Figure 2 shows a representation of the general process, including the following system components: Domain Manager, Market Analyzer, Index Analyzer, Tolerance Analyzer, and Somatic Engine. Figure 1: Graphical representation of Algorithm 1. ```
0: updated market data. 0: an investment decision; updated tolerance level to risk, loss, and accumulated loss. 1: Get market data
2: Update market indicators: profitability and risk [using Equations (1) and (2)]
3: Update accumulated wealth [using Equation (3)]
4: Update utility [using Equation (4)]
5: Determine \(RIndext\) [using Equation (6)]
6: Determine \(LossIndext\) [using Equation (7)]
7: Determine \(CLossIndext\) [using Equation (8)]
8: Get somatic reaction [using Equation (9)]
9:if \(SIndex_{t}\geq MaxSIndex\)then
10:\(Punishment_{t}=Punishment_{t}+1\)
11: Update (portfolio)
12:else
13: [Maintain \(Punishment_{t}\) value]
14:endif
15: Determine risk tolerance [using Equation (11)]
16: Determine loss tolerance [using Equation (12)]
17: Determine [using Equation (13)]
18: Inform to market (investment decision)
```  
**Algorithm 1** General decision-making process for an autonomous system  
The algorithm requires obtaining updated market data.