NNgTL: Neural Network Guided Optimal Temporal Logic Task Planning for
  Mobile Robots
In this work, we investigate task planning for mobile robots under linear
temporal logic (LTL) specifications. This problem is particularly challenging
when robots navigate in continuous workspaces due to the high computational
complexity involved. Sampling-based methods have emerged as a promising avenue
for addressing this challenge by incrementally constructing random trees,
thereby sidestepping the need to explicitly explore the entire state-space.
However, the performance of this sampling-based approach hinges crucially on
the chosen sampling strategy, and a well-informed heuristic can notably enhance
sample efficiency. In this work, we propose a novel neural-network guided
(NN-guided) sampling strategy tailored for LTL planning. Specifically, we
employ a multi-modal neural network capable of extracting features concurrently
from both the workspace and the B\"{u}chi automaton. This neural network
generates predictions that serve as guidance for random tree construction,
directing the sampling process toward more optimal directions. Through
numerical experiments, we compare our approach with existing methods and
demonstrate its superior efficiency, requiring less than 15% of the time of the
existing methods to find a feasible solution.
Ruijia Liu, Shaoyuan Li, Xiang Yin
# NNgTL: Neural Network Guided Optimal Temporal Logic

###### Abstract

In this work, we investigate task planning for mobile robots under linear temporal logic (LTL) specifications. This problem is particularly challenging when robots navigate in continuous workspaces due to the high computational complexity involved. Sampling-based methods have emerged as a promising avenue for addressing this challenge by incrementally constructing random trees, thereby sidestepping the need to explicitly explore the entire state-space. However, the performance of this sampling-based approach hinges crucially on the chosen sampling strategy, and a well-informed heuristic can notably enhance sample efficiency. In this work, we propose a novel _neural-network guided_ (NN-guided) sampling strategy tailored for LTL planning. Specifically, we employ a multi-modal neural network capable of extracting features concurrently from both the workspace and the Buchi automaton. This neural network generates predictions that serve as guidance for random tree construction, directing the sampling process toward more optimal directions. Through numerical experiments, we compare our approach with existing methods and demonstrate its superior efficiency, requiring less than 15% of the time of the existing methods to find a feasible solution.

## I Introduction

With the ongoing development and widespread deployment of mobile robots, there has been an increasing focus on path planning for high-level tasks. Among the formal languages used for specifying such complex tasks, Linear Temporal Logic (LTL) stands out as a widely adopted choice. LTL provides a structured means for the users to articulate complex requirements, such as navigating a robot to a target region without collision with obstacles or ensuring specific locations are visited infinitely often [1, 2, 3, 4]. In recent years, the field of robot path planning for LTL tasks has witnessed extensive investigation, spurred by its broad applications. These applications encompass a wide range of scenarios, such as environmental surveillance [5], search and rescue missions [6], and intelligent warehousing systems [7, 8].

In the context of LTL path planning, one of the most foundational methods is the automata-theoretical approach based on finite abstractions [9, 10, 11, 5, 12]. This approach involves the creation of a discrete abstraction of the workspace, which effectively captures the robot's mobility constraints. Subsequently, the discrete abstraction is synchronized with an automaton representation of the LTL task. This synchronization enables the formulation of the planning problem as a graph-search problem within the product space. However, this graph-search approach, although conceptually powerful, faces a significant computational challenge. In particular, as the system's dimensionality increases, the state-space of the finite abstraction grows exponentially, rendering the graph-search problem infeasible.

Sampling-based methods, such as rapid random trees (RRT), have emerged as a promising solution to tackle the computational challenges associated with path planning in continuous state-spaces [13]. More recently, sampling-based algorithms have been introduced to enhance the computational efficiency of solving LTL planning problems [14, 15, 16, 17, 18]. For example, in [16], a sampling-based algorithm, inspired by the RRT*, is proposed to find optimal paths that satisfy LTL tasks with a prefix-suffix structure. This algorithm circumvents the necessity of explicitly exploring the entire state-space by incrementally constructing random trees over the product state-space. Building upon this advancement, [17] further introduces a biased sampling strategy that leverages automata information to significantly improve sample efficiency. Moreover, in [18], the authors extend the methods in [17] to continuous workspaces without discretization. Specifically, they introduce an abstraction-free planning algorithm that directly samples within a continuous space and integrates these samples with automata states.

In sampling-based LTL planning, one of the key factor is how each new state is sampled. While biased sampling strategies offer an enhanced approach compared to uniform sampling, they primarily rely on distance information within the Buchi automaton. This approach neglects valuable insights from the workspace, such as the physical feasibility of task progression. However, integrating continuous workspace information with the Buchi automaton is very challenging due to the inherently heterogeneous structures of these components. Recently, there has been a notable progress in leveraging the power of neural networks for expedting solutions to intricate problems. For instance, within the domain of path planning, neural networks have been employed to predict the probability distribution of optimal paths [19, 20, 21, 22]. Moreover, neural networks have been applied, in an end-to-end fashion, for generating solutions to temporal logic tasks [23, 24, 25, 26].

In this paper, we introduce a novel neural-network guided (NN-guided) sampling strategy designed specifically for LTL planning. Our approach builds upon the basic architecture of the sampling-based algorithm for continuous workspaces, as established in [18]. However, instead of relying solely on automata information, we incorporate a multi-modal neural network capable of jointly extracting features from
both the workspace and the Buchi automaton. This neural network offers predictive capabilities to steer the sampling process in directions that are more likely to yield optimal solutions, ones that are not only task-progressive but also feasible within the workspace. To demonstrate the efficiency of our approach, we compare the proposed NN-guided sampling strategy with existing sampling strategies on a set of randomly generated problem instances. The statistical results underscore the effectiveness of our new strategy, as it requires less than 15% of the time needed by the existing strategies to find a feasible solution.

## II Problem Formulation

### _System Model_

We consider the scenario, where a single robot navigating in a two-dimensional continuous workspace represented by a compact subset \(\mathcal{W}\subseteq\mathbb{R}^{2}\). The workspace is assumed to be partitioned as \(\mathcal{W}=\mathcal{W}_{\text{free}}\cup\mathcal{O}\), where \(\mathcal{O}\) is an open subset representing obstacle regions and \(\mathcal{W}_{\text{free}}\) is the free region in which the robot can move. The free workspace is further partitioned as \(m\) labeled regions of interest and a non-labeled region \(\mathcal{W}_{\text{free}}=\mathcal{R}_{1}\dot{\cup}\cdots\dot{\cup}\mathcal{R}_ {m}\dot{\cup}\mathcal{R}_{non}\).

The mobility of the robot can be captured by a weighted transition system

\[TS=(\mathcal{W},\mathbf{x}_{0},\rightarrow_{T},\mathcal{AP},L,C),\]

where \(\mathcal{W}\) is set of infinite positions of the robot; \(\mathbf{x}_{0}\) is its initial position; \(\rightarrow_{T}\subseteq\mathcal{W}\times\mathcal{W}\) is the transition relation such that: for any \(\mathbf{x},\mathbf{x}^{\prime}\in\mathcal{W}\), we have \((\mathbf{x},\mathbf{x}^{\prime})\in\rightarrow_{T}\) if along the straight line between \(\mathbf{x}\) and \(\mathbf{x}^{\prime}\) (i) does not intersect with \(\mathcal{O}\); and (ii) crosses any boundary of labeled regions at most once [18]; \(\mathcal{AP}=\{\pi^{1},\ldots,\pi^{m}\}\) is the set of atomic propositions with labeling function \(L:\mathcal{W}\rightarrow\mathcal{AP}\) such that \(L(\mathbf{x})=\pi^{i}\) iff \(\mathbf{x}\in\mathcal{R}_{i};C:\mathcal{W}\times\mathcal{W}\rightarrow\mathbb{ R}^{+}\) is the weight function calculating the Euclidean distance, i.e., \(C(\mathbf{x}_{1},\mathbf{x}_{2})=\|\mathbf{x}_{1}-\mathbf{x}_{2}\|_{2}\).

An infinite _path_ is a sequence \(\tau\!=\!\tau(1)\tau(2)\cdots\!\in\!\mathcal{W}^{\omega}\) such that \(\tau(1)=\mathbf{x}_{0}\) and \((\tau(k),\tau(k+1))\in\rightarrow_{T},k=1,2,\ldots\). The _trace_ of infinite path \(\tau\) is \(\operatorname{trace}(\tau)=L(\tau(1))L(\tau(2))\cdots\in(\mathcal{AP})^{\omega}\). We say a path \(\tau\) is finite if it is a finite sequence of points, and we denote by \(|\tau|\) its _length_. For a finite path \(\tau\), its cost \(J(\tau)\) is defined as the the cumulative distances between consecutive states, i.e., \(J(\tau)=\sum_{k=1}^{|\tau|-1}C(\tau(k),\tau(k+1))\).

### _Temporal Logic Tasks_

The formal specification of robot is captured by an linear temporal logic formula without next (\(\operatorname{LTL}_{-\bigcirc}\)), which is widely used in robot task planning in continuous workspace [27]. The syntax of \(\operatorname{LTL}_{-\bigcirc}\) is given as follows:

\[\phi::=\text{true}\mid\pi\in\mathcal{AP}\mid\neg\phi\mid\phi_{1}\wedge\phi_ {2}\mid\phi_{1}\mathcal{U}\phi_{2},\]

where \(\neg\) and \(\wedge\) are Boolean operators "negation" and "conjunction", respectively; \(\mathcal{U}\) is the temporal operator "until", which can further induce temporal operators "eventually" \(\Diamond\) and "always" \(\square\).

An \(\operatorname{LTL}\) formula \(\phi\) is evaluated over an infinite word \(\sigma=\sigma(1)\sigma(2)\cdots\in\mathcal{AP}^{\omega}\). We denote by \(\sigma\models\phi\) that word \(\sigma\) satisfies \(\operatorname{LTL}\) formula \(\phi\); the reader is referred to [28] for the formal semantics. We denote by \(\operatorname{Words}(\phi)\) the set of all words satisfying formula \(\phi\). It is well-known that, for any \(\operatorname{LTL}\) formula \(\phi\), \(\operatorname{Words}(\phi)\) can be accepted by a non-deterministic Buchi automaton (NBA) [28]. Formally, an NBA is a tuple \(B=(\mathcal{Q}_{B},\mathcal{Q}_{B}^{0},\Sigma,\rightarrow_{B},\mathcal{Q}_{B} ^{\prime})\), where \(\mathcal{Q}_{B}\) is the set of states, \(\mathcal{Q}_{B}^{0}\) is the set of initial states, \(\Sigma=\mathcal{AP}\) is the alphabet, \(\rightarrow_{B}\subseteq\mathcal{Q}_{B}\times\Sigma\times\mathcal{Q}_{B}\) is the transition relation, and \(\mathcal{Q}_{B}^{F}\) is the set of accepting states. For simplicity, we assume that the initial-state is unique, i.e., \(\mathcal{Q}_{B}^{0}=\{q_{B}^{0}\}\).

An infinite run \(\rho_{B}\) of \(B\) over an infinite word \(\sigma=\pi_{0}\pi_{1}\cdots\in(\mathcal{AP})^{\omega}\) is a sequence \(\rho_{B}=q_{B}^{0}q_{B}^{1}q_{B}^{2}\cdots\) such that \(q_{B}^{0}\in\mathcal{Q}_{B}^{0},(q_{B}^{i},\pi_{i},q_{B}^{i+1})\in\rightarrow_ {B},\forall i=0,1,\ldots\). We say infinite run \(\rho_{B}\) is accepting if it contains accepting states infinite number of times; we say a word is accepting if it induces an accepting run, and we denote by \(\mathcal{L}_{B}\) the set of all accepting words of \(B\). Hereafter, \(B\) is referred to as the NBA that accepts \(\phi\), i.e., \(\mathcal{L}_{B}=\operatorname{Words}(\phi)\).

### _LTL Task Planning Problem_

To fulfill an \(\operatorname{LTL}_{-\bigcirc}\) formula \(\phi\), the robot needs to execute an infinite path. For the purpose of planning, it suffices to consider paths in the "prefix-suffix" structure \(\tau=\tau^{\operatorname{pre}}[\tau^{\operatorname{swf}}]^{\omega}\), where the prefix part \(\tau^{\operatorname{pre}}\) repeats only once and the suffix part \(\tau^{\operatorname{swf}}\) repeats indefinitely [9]. The cost of prefix-suffix path \(\tau\) is defined by \(J(\tau)=\lambda J(\tau^{\operatorname{pre}})+(1-\lambda)J(\tau^{\operatorname{ swf}})\), where \(\lambda\in[0,1]\) is a user-defined weight coefficient.

Then our objective is to find a plan for the robot in the prefix-suffix structure such that a given \(\operatorname{LTL}\) formula is fulfilled with minimum cost.

**Problem 1**: _Given \(\operatorname{LTL}_{-\bigcirc}\) formula \(\phi\), determine a prefix-suffix path \(\tau\) in transition system \(TS\) such that (i) \(\operatorname{trace}(\tau)\models\phi\); and (ii) for any prefix-suffix path \(\tau^{\prime}\) such that \(\operatorname{trace}(\tau^{\prime})\models\phi\), we have \(J(\tau)\leq J(\tau^{\prime})\)._

## III Sampling-Based Task Planning

To solve Problem 1, a typical approach is to perform graph-search on the _product_ of \(TS\) and \(B\)[5]. However, when the state space \(\mathcal{W}\) is continuous, building the entire product space is infeasible even by discretizations. Therefore, in [18], the authors proposed a (continuous space) sampling-based algorithm, called TL-RRT*, that incrementally builds trees on-the-fly without construct the entire product space a priori. Our work is build upon the sampling-based approach; therefore, we review it briefly in this section. The readers are referred to [18] for more details on this method.

### _Main Sampling-Based Algorithm_

The TL-RRT* algorithm is essentially a random search over the product space \(\mathcal{Q}_{P}:=\mathcal{W}_{\text{free}}\times\mathcal{Q}_{B}\). It consists of two parts, prefix part and suffix part, and for each part, a similar random tree construction is employed in order to search the optimal path. We briefly sketch the procedures.

#### Iii-A1 Prefix Search

Starting from the initial state \(q_{0}=(\mathbf{x}_{0},q_{B}^{0})\), one first builds a prefix tree \(\mathcal{T}=(\mathcal{V}_{\mathcal{T}},\mathcal{E}_{\mathcal{T}},\operatorname{Cost})\) by incrementally adding vertices, where \(\mathcal{V}_{\mathcal{T}}\) and \(\mathcal{E}_{\mathcal{T}}\) are the sets of vertices and edges in \(\mathcal{T}\), respectively. The tree contains some _goal states_ defined by \(\mathcal{Q}_{\text{goal}}:=\mathcal{W}_{\text{free}}\times\mathcal{Q}_{B}^{F}\).
By projecting paths in tree onto \(\mathcal{W}\), the path from the initial state \(q_{0}\) to each goal state \(q_{\text{goal}}\in\mathcal{V}_{\mathcal{T}}\cap\mathcal{Q}_{\text{goal}}\) forms a prefix path \(\tau^{\text{pre}}\), whose cost is stored by function \(\text{Cost}:\mathcal{V}_{\mathcal{T}}\rightarrow\mathbb{R}^{+}\).

#### Iii-A2 Suffix Search

The suffix part is very similar to the prefix part, the main difference is that one needs to construct a set of random trees rooted from goal states \(\mathcal{P}:=\mathcal{T}\cap\mathcal{Q}_{\text{goal}}\) in the prefix tree such that they can return back to the goal states. This gives us a suffix plan \(\tau^{\text{sif}}\) from each goal state, and the prefix-suffix plan with minimum cost among all goal states is the final optimal plan.

#### Iii-A3 Constructing Random Trees

In the above two parts, the key is construction of random tree \(\mathcal{T}=(\mathcal{V}_{\mathcal{T}},\mathcal{E}_{\mathcal{T}},\text{Cost})\) on-the-fly. The main construction steps are as follows.

1. Sample a state \(\mathbf{x}^{\text{rand}}\in\mathcal{W}_{\text{free}}\) "randomly";
2. Determine a new state \(\mathbf{x}^{\text{new}}\) to be added to the tree based on some distance criteria on \(\mathbf{x}^{\text{rand}}\) and \(\mathcal{T}\);
3. Determine set \(\mathcal{Q}^{\text{near}}\subseteq\mathcal{V}_{\mathcal{T}}\) based on some distance criteria from which the tree will be extended to \(\mathbf{x}^{\text{new}}\);
4. For each state \(q_{P}^{\text{near}}=(\mathbf{x}^{\text{near}},q_{B}^{\text{near}})\in \mathcal{Q}_{P}^{\text{near}}\), we consider a potential edge from \(q_{P}\) to \(q_{P}^{\text{near}}=(\mathbf{x}^{\text{new}},q_{B})\) if \((\mathbf{x}^{\text{near}},\mathbf{x}^{\text{new}})\in\rightarrow_{\mathcal{T}}\) and \((q_{B}^{\text{near}},L(\mathbf{x}^{\text{near}}),q_{B}^{\text{near}})\in \rightarrow_{B}\);
5. Add \(q_{P}^{\text{new}}\) to tree \(\mathcal{T}\) from state \(q_{P}\in\mathcal{Q}_{P}^{\text{near}}\) to minimize \(\text{Cost}(q_{P}^{\text{new}})=\text{Cost}(q_{P}^{\text{near}})+C(q_{P}^{ \text{near}},q_{P}^{\text{new}})\);
6. After adding \(q_{P}^{\text{new}}\), the tree edges and costs are reconfigured so that each vertex is reached by a path with minimum cost from the root.

### _Sampling Strategies_

In the construction of random trees, it remains to specify how state \(\mathbf{x}^{\text{rand}}\) is sampled "randomly". In [18], the authors proposed two different sampling strategies for \(\mathbf{x}^{\text{rand}}\):

* _Uniform Sampling:_\(\mathbf{x}^{\text{rand}}\) is selected according to a uniform distribution on \(\mathcal{W}_{\text{free}}\) (in fact, any distribution as long as all states has non-zero probability);
* _Biased Sampling:_\(\mathbf{x}^{\text{rand}}\) is selected according to a biased distribution on \(\mathcal{W}_{\text{free}}\) such that one has more chance to move towards an accepting state in \(B\).

Since our NN-guided approach is related to the biased sampling, we briefly review this method. First, one needs to pre-process the NBA \(B\) so that infeasible transitions are removed. Then based on the simplified NBA, one defines a distance function \(\rho:\mathcal{Q}_{B}\times\mathcal{Q}_{B}\rightarrow\mathbb{N}\) to capture the length of the shortest path between each pair of states. Then the selection of \(\mathbf{x}^{\text{rand}}\) is determined as follows:

1. Select a _feasible accepting state_\(q_{B}^{F,\text{feas}}\in\mathcal{Q}_{B}^{F}\) such that \(\rho(q_{B}^{Q},q_{B}^{F,\text{feas}})\neq\infty\) and \(\rho(q_{B}^{F,\text{feas}},q_{B}^{F,\text{feas}})\neq\infty\);
2. Define the set of vertices \(\mathcal{D}_{\min}\subseteq\mathcal{V}\) that are closest to \(q_{B}^{F,\text{feas}}\) according the distance function \(\rho\). Then select a vertex \(q_{P}^{\text{closest}}=\left(\mathbf{x}^{\text{closest}},q_{B}^{\text{closest }}\right)\in\mathcal{V}_{\mathcal{T}}\) from the tree according to a specific distribution [18] such that states in \(\mathcal{D}_{\min}\) has more chance to be selected;
3. Select two successive states \(q_{B}^{\text{succ},1},q_{B}^{\text{succ},2}\in\mathcal{Q}_{B}\) such that \(\alpha_{B}^{\text{closest}}\xrightarrow{L(\mathbf{x}^{\text{cluster}})}_{B}q_{B }^{\text{succ},1}\xrightarrow{\ldots}p_{B}\ q_{B}^{\text{succ},2}\), and \(\rho(q_{B}^{\text{succ},2},q_{B}^{\text{feas}})\leq\rho(q_{B}^{\text{succ},1},q _{B}^{F,\text{feas}})\leq\rho(q_{B}^{\text{closest}},q_{B}^{F,\text{feas}})\);
4. Select a state \(\mathbf{x}^{\mathcal{C}}\) such that \(q_{B}^{\text{succ},1}\xrightarrow{L(\mathbf{x}^{\mathcal{C}})}_{B}q_{B}^{ \text{succ},2}\) is feasible;
5. Compute the shortest path from \(\mathbf{x}^{\mathcal{L}}\) and \(\mathbf{x}^{\text{closest}}\) within \(\mathcal{W}_{\text{free}}\). Pick the second point in the shortest path, denoted by \(\mathbf{x}^{\text{target}}\) as a heuristic direction for sampling;
6. Finally, select \(\mathbf{x}^{\text{rand}}\) according to a distribution that has more chance to sample towards the direction of \(\mathbf{x}^{\text{target}}\).

## IV Neural Network Guided Sampling

Although biased sampling provides a more efficient approach compared with the uniform sampling, it solely relies on the distance information in Buchi automaton. For example, when \(q_{B}^{F,\text{feas}}\) as well as intermediate states \(q_{B}^{\text{succ},1}\) and \(q_{B}^{\text{succ},2}\) are selected, one only consider whether or not the task progress can be pushed forward in the NBA. However, the information from the workspace, i.e., whether the task progress is feasible physically, is neglected.

To further improve the sample efficiency for the random tree construction, one essentially needs to _jointly_ consider the information workspace and the NBA in order to have more chance to sample states that can move towards accepting states _by paths that are feasible in the workspace_. However, obtaining such a good heuristic is very challenging since the workspace is continuous. In this section, we present a new neural network guided (NN-guided) sampling strategy, where a "sample net" is used that effectively fuses the information of the workspace and the NBA. All implementation details as well as source codes are available at [https://github.com/LRJ-2000/NNgTL](https://github.com/LRJ-2000/NNgTL)

### _Overview of NN-Guided Approach_

#### Iv-A1 Purposes of Network Networks

The main architecture of our sample net is shown in Figure 1 consisting of two sub-networks: the Path Prediction Network (PathNet) and the State Prediction Network (StateNet). The inputs of the PathNet and the StateNet are the same, which are both the workspace map as well as the NBA for the LTL task. However, their purposes and outputs are different. Specifically,

* The output of the StateNet is a vector \(\mathbf{p}\) with a length of \(|\mathcal{Q}_{B}|\). In this vector, each entry \(p_{i}\) denotes the probability that state \(i\) is involved in the optimal path. The prediction vector \(\mathbf{p}\) is employed to guide the choices of \(q_{B}^{F,\text{feas}},q_{B}^{\text{succ},1},q_{B}^{\text{succ},2}\in\mathcal{Q }_{B}\) in the biased sampling.
* The output of the PathNet is a \(200\times 200\) matrix \(\mathcal{P}\) such that the value of each entry represents the likelihood that the entry is on the optimal path. Therefore, this weight matrix \(\mathcal{P}\) is used as a more reasonable metric for sampling \(\mathbf{x}^{\text{rand}}\) by considering the workspace information with preforming shortest path search.

#### Iv-A2 NN-Guided Sampling Strategy

Now, let us discuss how the proposed neural networks are used to guide the sampling process. It still follows the basic idea of biased sampling method as detailed in steps S1-S6. However, we further leverage the outputs of the two sub-networks to improve and simply the sampling process. Specifically, at each instant, suppose that the output of the StateNet and the PathNet are \(\mathbf{p}\) and \(\mathcal{P}\). We set \(\alpha\in(0,1)\) as a parameter that specifies the probability of using the predicted information of StateNet to guide the sampling. Then, to determine
the sample point \(\mathbf{x}^{\text{rand}}\), our approach makes the following changes C-1 and C-2 to steps S-1 to S-6.

C-1: When selecting \(q_{B}^{F,\text{feas}}\), \(q_{B}^{\text{closest}}\), \(q_{B}^{\text{succ.1}}\) as in steps S1-S3 in the biased sampling, there is a \(1-\alpha\) probability that we still follow exactly the same strategy in S-1 to S-3. However, there is an \(\alpha\) probability that all these states selected according to the probability vector \(\mathbf{p}\). In other words, we have \(\alpha\) probability to activate the prediction result of the StateNet.

C-2: After obtaining state \(\mathbf{x}^{\mathcal{L}}\) in step S-4, to sample state \(\mathbf{x}^{\text{rand}}\), we simplify steps S-5 and S-6 as a single step. Particularly, instead of first computing the shortest path and then using the second point in the path to generate a sample distribution, here we directly use the prediction result \(\mathcal{P}\) by the PathNet to sample \(\mathbf{x}^{\text{rand}}\). More specifically, let \((x_{1},y_{1})\) and \((x_{2},y_{2})\) be the coordinations of \(\mathbf{x}^{\mathcal{L}}\) and \(\mathbf{x}^{\text{closest}}\), respectively. We consider the rectangle region \(\textsc{Rec}=[x_{1}:x_{2},y_{1}:y_{2}]\). We define a discrete distribution over all grids in Rec according to the normalized value of their weights in \(\mathcal{P}\), i.e., grids with larger value has more chance to be selected. Then \(\mathbf{x}^{\text{rand}}\) is sampled randomly from the rectangle region according to this distribution.

Here, we discuss the main features of the purposed NN-guided sampling strategy. First, our NN-guided approach subsumes all properties, such as probabilistic completeness and asymptotic optimality, of the TL-RRT* algorithm in [18] since we still follow the main structure of TL-RRT* and at each step, our algorithm has a non-zero probability to switch to the original sampling strategy. However, compared with the biased sampling strategy adopted in [18], our NN-guided sampling strategy further jointly considers both the workspace information and the NBA, which provides a better heuristic for "good" samples. Furthermore, since our strategy uses the predicted distribution directly without involving the shortest path search for each step, its online execution is also much faster that the biased sampling strategy.

### _Inputs Encodings_

Recall that, for both the PathNet and the StateNet, their inputs are the workspace map and the NBA for the LTL formula. To leverage neural networks for processing the workspace with continuous space and NBA with graph structure, appropriate encoding techniques are needed.

#### Iii-B1 Encoding for Workspace

First, we consider the continuous workspace as a \(200\times 200\) pixel image or a grid map. Each grid in the image corresponds to a specific point in the workspace, which is labeled, obstacle or free. Then the image is transformed into a tensor of dimensions \((m+1)\times 200\times 200\) with \(m\) be the number of different labels, i.e., each grid in the workspace is encoded as a vector \(\mathbf{a}=[a_{0},a_{1},...,a_{m}]\). Specifically, the first entry \(a_{0}\) represents the grid's status, where \(-1\) for the initial location, \(0\) for free space, and \(1\) for an obstacle. For \(i=1,\ldots,m\), we have \(a_{i}=1\) if it belongs to \(\mathcal{R}_{i}\), and \(a_{i}=0\) otherwise.

#### Iii-B2 Encoding for Buchi Automata

First, we convert NBA to a directed graph, where nodes and edges correspond to states and transitions, respectively, and have their features. Specifically, the feature for a node is a vector \(\mathbf{v}=[v_{1},v_{2},v_{3}]\), where \(v_{1}\in\{0,1\}\) represents whether or not it is an initial state, \(v_{2}\in\{0,1\}\) represents whether or not it is an feasible accepting state, and \(v_{3}\) is the (normalized) distance to the closest feasible accepting state. For each edge, the feature is a vector \(\mathbf{e}=[e_{1},e_{2},...,e_{m}]\in\{-1,0,1\}^{m}\) specifying the atomic propositions that need to be true for the underlying transition in the NBA. Since later on we use graph neural networks (GNN) to process features of the NBA, we further transform the directed graph into a heterogeneous graph. This transformation involves adding a new node within each original edge so that the features of the edges are inherited by the nodes added. Additionally, to augment feature aggregation and spread, a self-loop is added to each node, and a pooling node is added so that each node has a directed edge leading to this pooling node.

### _Implementation Details of Neural Networks_

#### Iii-C1 PathNet

It has the following four building blocks.

**Map Encoder:** The purpose is to extract features from the grid map by five convolutional blocks. Each block houses a \(4\times 4\) convolutional layer with a stride of \(2\) and padding of \(1\), complemented by a batch-norm layer, a dropout layer with probability \(0.5\), and a LeakyReLU activation with a negative slope of \(0.2\). Note that the sizes of the map evolves from

Fig. 1: Overview of the sampling network.
\(m\times 200\times 200\) to \(1024\times 6\times 6\) when passing through these blocks.

**NBA Encoder:** The purpose is to extract global features from the NBA. Comprising five layers, the encoder utilizes Graph Attention (GAT) convolutions to address distinct edge types in the heterogeneous graph [29]. The node features are proceeded by a dropout layer and a ReLU activation after convolutions. Finally, global mean pooling operations are used to accumulate feature representation of the entire graph.

**Fusion Network:** The purpose is to amalgamate features from both the workspace Map Encoder and the NBA Encoder. This is done by the following two steps. First, NBA features are transformed via a linear layer to attain compatibility with map features. Then vector concatenation are used to fuse these harmonized features.

**Path Predictor:** The purpose is to output the weight matrix \(\mathcal{P}\in\mathbb{R}^{200\times 200}\) as the prediction for optimal paths. To this end, we use five up-convolution blocks to upscale and to refine the amalgamated features. Each block is structured with a transposed convolutional layer, a batch-norm layer, a dropout layer (with probability \(0.5\)), and a ReLU activation. Drawing from the "U-Net" architecture [30], our design integrates skip connections, merging features from both the third convolutional modules of the Map and NBA Encoders. This approach capitalizes on the synergy of both encoders, enhancing the merged feature representation. Subsequent to this fusion, features are relayed to the Path Predictor via concatenation. Leveraging these connections ensures the retention of intricate spatial details alongside the depth of hierarchical features. Finally, we use an \(1\times 1\) convolution to reshape the features to \(1\times 200\times 200\) dimensions, and a sigmoid activation is used to refine the output.

#### Iv-C2 StateNet

This net is essentially a classifier for the NBA states. It has a simpler structure consisting of the following two components.

**Map Encoder:** The main purpose is to encode the map into a \(256\)-length feature vector, which will be served as a precursor to the Node Predictor. Specifically, the map is processed by an \(1\times 1\) convolution, transitioning the \(8\)-channel input to \(3\) channels, thus aligning with conventional image processing frameworks. The features then engage with the pre-trained "ResNet-50" model [31]. The terminal fully connected layer of the ResNet is omitted, and is replaced by our bespoke fully connected layer, rendering the output as a \(256\)-length feature vector.

**Node Predictor**, tailored for node classification, starts with a GAT convolution layer, stretching the graph's node features to a 256-length dimension, in line with the map features. Each node's features are subsequently concatenated with the Map Encoder-generated map feature vector, amalgamating spatial and structural data at every node. A sequence of information dissemination follows via five sequential GAT modules, each housing a GAT convolution, a ReLU activation for non-linearity, and a dropout (with probability \(0.5\)) for regularization. The classification culminates with two sequential fully connected layers and a Softmax layer, analyzing the consolidated node features to yield the classification probability.

### _Training Neural Networks_

#### Iv-D1 Data Set Preparations

Initially, we randomly generate \(15400\) pairs of workspace and LTL formulae. Specifically, in each \(200\times 200\) grid map workspace, we randomly place obstacles as well as seven distinct labeled regions. The initial location of the robot is also randomized. Note that grid map are only used for the purpose of map generation, it is still mapped to and used as continuous workspace. To order to obtain an expert path for each pair of workspace and LTL task, we use the existing biased-sampling approach with \(10,000\) iterations. The obtained expert path is then encoded into a \(200\times 200\) binary matrix. Specifically, we mark those grids crossed by the expert path, as well as their immediate neighbors, as \(1\). Then we label NBA states visited by the expert path as \(1\). Finally, through data augmentations, this data set is expanded to \(107800\) cases.

#### Iv-D2 Training Procedures

The training process started with training the StateNet first. Specifically, we first fixed the parameters of the ResNet portion and only update the parameters of the other parts. When the loss became stable after 100 epochs, we unfroze the parameters of the ResNet and continued training for another 20 epochs. The trainings were performed by the Adam optimizer with an initial learning rate of \(0.001\) and a batch size of \(128\). We used cross entropy loss as the loss function. After training the StateNet, we trained the PathNet. Specifically, we first initialized the GAT layers in the NBA Encoder using the parameters from the GAT layers in StateNet. After training for 150 epochs, the loss stabilized. We still used the Adam optimizer with an initial learning rate of \(0.0001\) and a batch size of \(128\). We employed the binary cross entropy loss as the loss function.

## V Simulations & Numerical Experiments

In this section, we provide simulation results for the proposed method. First, a case study is provided to illustrate our approach. Then we perform a set of numerical experiments to evaluate the efficiency of our approach compared with existing sampling strategies. All algorithms were implemented using Python on a Windows 11 computer with an Intel Core i7-13700K 5.40GHz processor.

### _Case Study_

We consider a robot moving in a workspace shown in Figure 2 with initial position of the robot, obstacles, and labeled regions as depicted in the figure. We consider the following LTL task for the robot

\[\phi=\Box\Diamond_{1}\wedge\neg l_{1}\mathcal{U}l_{2}\wedge\Diamond_{3},\]

i.e., the robot needs to (i) visit \(l_{2}\) at least once without visiting \(l_{1}\); (ii) visit \(l_{3}\) at least once; (iii) visit \(l_{1}\) infinitely often. The NBA of \(\phi\) is shown in Figure 2(b), where state \(4\) is the unique feasible accepting state. The optimal plan searched by our algorithm is shown as the red lines in Figure 2. The robot first goes to \(l_{2}\), then hoes to \(l_{3}\), and finally stays at \(l_{1}\). That is, only the prefix part contributes to the overall cost.
To better illustrate our NN-guided sampling strategy, we explain how the random tree \(\mathcal{T}\) for the prefix path is expended initially from the root \(q_{P}^{0}=(\mathbf{x}_{0},q_{B}^{\mathrm{init}})\). Since the NBA only has one feasible accepting state, the choice for \(q_{B}^{F,\mathrm{feas}}\) is unique, and we have \(q_{P}^{\mathrm{closest}}=q_{P}^{0}\) since the tree only has a root so far. Then the StateNet predicts \(\mathbf{p}=[0999,0.486,0.902,0.994,0.997]\). Since \(0\xrightarrow{L(\mathbf{x}_{0})}_{B}0\), we have \(q_{B}^{\text{succ.1}}=0\). From the feasible successor states of \(q_{B}^{\text{succ.1}}\), we choose \(q_{B}^{\text{succ.2}}=2\) since it has a higher probability (0.902) than state \(1\) (0.486). Then according to the transition condition \(0\xrightarrow{l_{2}}_{B}2\) in the NBA, we select a point in the labeled region \(l_{2}\) as \(\mathbf{x}^{\mathcal{C}}\), which is shown as the yellow point in Figure 3. Then we construct the rectangle region between \(\mathbf{x}^{\mathcal{C}}\) and \(\mathbf{x}^{\mathrm{closest}}\), and state \(\mathbf{x}^{\mathrm{rand}}\) is sampled randomly according to the distribution determined by the PathNet prediction \(\mathcal{P}\) as shown in Figure 2(a).

Note that, in this example, there are actually two feasible prefix paths: \(l_{2}\to l_{3}\to l_{1}\) and \(l_{3}\to l_{2}\to l_{1}\). Clearly, the former is optimal with less cost. This information is captured by the prediction result of the StateNet, which prefers state \(2\in\mathcal{Q}_{B}\) for the optimal path. Furthermore, the prediction result of the PathNet can effectively avoid obstacles and has more chance to sample near the optimal path. Therefore, these prediction results by the neural networks guide our search process to converge to a desired solution more quickly.

### _Comparison with Existing Methods_

#### V-B1 Experiment Settings

We conduct a set of experiments to illustrate the efficiency of our NN-guided sampling strategy compared with the existing uniform and biased sampling strategies. Specifically, independent from the training set, we generate another \(240\) pairs of workspace map and LTL task. For each instance, we run our method with \(\alpha=0.8\) as well as the two existing method to find a feasible plan. Note that, since all these RRT-based approaches are probabilistic optimal, we focus on comparing _how fast_ these strategies can find _the first feasible solution_, and the performance of the first feasible solution in terms of its length. Formally, we consider the following metrics when the first feasible solution is found: the execution time \(T\) taken, the number of iterations \(n\) required, the number of nodes \(m\) in the random tree, and the length of the first feasible solution \(len\).

#### V-B2 Statistic Results

The numerical experiments results are shown in Table I. Specifically, based on the execution time \(T\) of the uniform sampling approach, we divide the tasks into simple tasks with \(T\leq$180\,\mathrm{s}$\) and complex tasks with \(T>$180\,\mathrm{s}$\). Then Tables Ia and Ib show the average value of each metric for each algorithm within these two task categories, respectively. Note that many complex tasks, the uniform sampling strategy fails to find a feasible path within \(2000\,\mathrm{s}\). For such cases, we terminate the search by only recording \(T,n\) and \(m\) without consider the length \(len\).

The statistic results show that, for both simple and complex tasks, our NN-guided sampling strategy can significantly enhance the efficiency of the RRT-based algorithm. In particular, the timed required to obtain a feasible solution by our NN-guided sampling strategy is less than 15% of that of the biased sampling strategy, which is already much more efficient than uniform sampling strategy. Furthermore, the length of the first feasible solution found by our strategy is similar to those of the other two strategies. We would like the remark that the metric of \(len\) is not essential compared with other metrics since this is just the performance of the first feasible solution. The entire algorithm will converge to the optimal solution when the number of iterations increases.

## VI Conclusion

In this paper, building upon the current state-of-the-art sampling-based LTL planning algorithms, we propose a novel sampling strategy based on multi-modal neural networks to guide the sampling process. Our approach, on the one hand, leverages the feature extraction power of neural networks in an end-to-end fashion, and on the other hand, still enjoys all good properties of the sampling-based methods such as probabilistic optimality/completeness. Experimental results show that our proposed sampling strategy can significantly enhance the planning efficiency of the algorithm. In future research, we will further improve the feature fusion methods for multi-robot planning problems.

\begin{table}

\end{table} TABLE I: Experiment Results

Fig. 3: Predication results of the neural networks.

Fig. 2: Workspace of the robot, where the gray regions denote obstacles, the green regions denote labeled regions, and the red lines denote the optimal path synthesized.