## 2 Materials and Methods
### Problem Formalization and Proposed Method
In the following, to not clutter the notation, we will use_ \(m_{u,v}\) _to denote the time spent to move from_ \(\text{Pol}\ p_{u}\) _to_ \(\text{Pol}\ p_{v}\)_. Since the edges are bi-directional, we assume that_ \(m_{u,v}=m_{v,u}\ \forall(u,v)\in\mathcal{E}\)__
* \(e:\mathcal{E}\rightarrow\mathbb{N}^{+}\) _is the function that represents the energy required by the robot to move between two adjacent PoIs, i.e.,_ \(e_{u,v}\) _is the energy to be consumed to move from_ \(\text{Pol}\ p_{u}\) _to_ \(\text{Pol}\ p_{v}\)_. Since the edges are bi-directional, we assume that_ \(e_{u,v}=e_{v,u}\ \forall(u,v)\in\mathcal{E}\)__  
As an instance, Figure 5 reports the graph notation for the environment introduced in Figure 3. In particular, three charging PoIs can be identified (i.e., _poi\({}_{3}\)_,_ poi\({}_{5}\)_, and_ poi\({}_{7}\)_). The time required to reach each PoI from another one can be different (i.e., from 15 to 45 min), while the time to be spent in each PoI for measuring is 15 min. In this paper, we assume that the energy consumed to traverse an edge has been considered proportional to the travel time with a unitary coefficient so that its magnitude corresponds to the travel time. However, more complex formulations can be adopted without altering the notation. Given the definition of the environment graph, we can derive the definitions of _robot trajectory_, measurement trajectory_, and _charging trajectory_. **Definition 4** (Robot trajectory). : _Given an environment graph \(G=(V,E,\mathcal{L},\mathcal{E})\) built starting from a set of PoIs \(\mathcal{P}=\{p_{i}\}_{i=1}^{n}\) inside a greenhouse, we define a robot trajectory as the ordered sequence \(\gamma=\langle p_{1},\dots,p_{n}\rangle\) of PoIs in which the robot stops for performing a measurement of the climatic variables of interest (together with its farming tasks) or for charging._  
**Definition 5** (Measurement trajectory). : _Given a robot trajectory \(\gamma=\langle p_{1},\dots,p_{n}\rangle\), a measurement trajectory is a sub-sequence \(\mu=\langle p_{i},\dots,p_{k}\rangle\subseteq\gamma\) composed only of the PoIs in \(\gamma\) where the robot stops to perform only a measurement._  
**Definition 6** (Charging trajectory). : _Given a robot trajectory \(\gamma=\langle p_{1},\dots,p_{n}\rangle\), a charging trajectory is a sub-sequence \(\chi=\langle p_{j},\dots,p_{h}\rangle\subseteq\gamma\) composed only of the PoIs in \(\gamma\) where the robot stops for charging._  
Given a robot trajectory \(\gamma\) together with its related measurement \(\mu\) and charging \(\chi\) sub-sequences, the time \(\tau_{\gamma}\) required to complete the entire trajectory \(\gamma\) can be computed as:  
\[\tau_{\gamma}=\sum_{i\in\mu}t_{i}+\sum_{j\in\chi}c_{i}+\sum_{j\in\gamma}m_{ij} \tag{4}\]  
Figure 5: Example of environment represented through the labeled graph introduced in Definition 3. A generic value \(c_{i}\) denotes a capacity value greater than 0.  
where \(i\in\mu\) or \(i\in\chi\) identifies the index of a PoI inside the measurement or charging trajectory, respectively, while \(i,j\in\gamma\) identifies a pair of consecutive Pols in \(\gamma\). With reference to the example in Figure 2, a possible robot trajectory could be represented by the sequence \(\gamma=\langle p_{1},p_{2},p_{7},p_{5},p_{6}\rangle\), where the measuring trajectory \(\mu\) might correspond to \(\gamma\), since we may decide to take a measurement in each touched PoI, while the charging trajectory \(\chi\) might be composed of \(p_{7}\) only, since the robot might need only one charging operation to complete the whole trajectory. Given a set of Pols \(\mathcal{P}\) that the robot should periodically sample, the aim of this paper is to identify the optimal trajectory while considering the battery level of the robot. As already discussed in Section 1, the choice of the sequence of Pols to include in the robot trajectory \(\gamma\) is not fixed, and it can change depending on the particular conditions (i.e., context) in which the measurements are performed.