## 4 Proposal
### Proposed Algorithm
#### 4.2.2 Modified Dijkstra Algorithm (MD)
```
1:Requiring vehicle \(v\)
2:Vehicle's destination node \(d\)
3:Actual node actual
4:Adjacent nodes \(Ad=\{k_{1},...,k_{n}\}\) not empty
5:Adjacency distance matrix \(d[n]\)\(\triangleright n=\textit{number of nodes}\)
6:Un-visited nodes \(\textit{unVisited}=\{\,\}\) empty
7:\(d[actual]=0\)
8:add actual to unVisited
9:while Still are nodes in unVisiteddo
10:\(Min=\) get minimal distance node (3)
11:if\(Min\) does not exist then
12:return there is no available alternative route
13:else
14: take \(Min\) from unVisited
15:for all\(k\) in adjacent nodes \(Ad=\{k_{1},...,k_{n}\}\)do
16:if\(d[k]>distance_{(actual,k)}+d[Min]\)then
17:\(d[k]\gets distance_{(actual,k)}+d[Min]\)
18:endif if
19:end for
20:endif
21:end while
```  
**Algorithm 2** Modified Dijkstra Route Recalculation (MD)  
```
1:Un-visited nodes \(\textit{unVisited}=\{u_{1},...,u_{n}\}\) not empty
2:Actual node actual
3:Adjacency distance matrix \(d[n]\)
4:\(\textit{min}=NotExists\)
5:for\(u\) in unVisiteddo
6:if\(use_{(actual,u)}\geq capacity_{(actual,u)}\) AND \(u\) is not directly connected to \(actual\)then
7: take \(u\) from unVisited
8:else
9:if\(d[u]<d[min]\)then
10:\(min\gets u\)
11:endif
12:end if
13:end for
14:return min
```  
**Algorithm 3** Get minimal distance node  
```
1:Un-visited nodes \(\textit{unVisited}=\{u_{1},...,u_{n}\}\) not empty
2:Actual node actual
4:Adjacency distance matrix \(d[n]\)
5:\(\textit{min}=NotExists\)
6:for\(u\) in unVisiteddo
7:if\(use_{(actual,u)}\geq capacity_{(actual,u)}\) AND \(u\) is not directly connected to \(actual\)then
8: take \(u\) from unVisited
9:else
10:if\(d[u]<d[min]\)then
11:\(min\gets u\)
12:endif
13:endif
14:endif
15:end if
16:end for
17:return min
```  
**Algorithm 4** The Dijkstra Route Recalculation (MD)  
```
1:Un-visited nodes \(\textit{unVisited}=\{u_{1},...,u_{n}\}\) not empty
2:Actual node actual
3:Adjacency distance matrix \(d[n]\)
4:\(\textit{min}=NotExists\)
5:for\(u\) in unVisiteddo
6:\(\textit{max}=\textit{max}(\textit{max}(\textit{max}(\textit{max}(\textit{max}( \textit{max}(\textit{max}(\textit{max}(\textit{max}(\textit{max}(\textit{max}(\textit{ max}(\textit{max}(\textit{max}(\textit{max(\textit{max(\textit{max((\textit((((((((((((((((((((((((((((((

#### 4.2.3 Local-Congestion Based Algorithm (LC)

In this approach a route was assigned to a vehicle based only in the local congestion information of the adjacent streets to the node. This was done in order to establish if the congestion information granted from the state of the neighborhood of a vehicle was enough to get good results, or if instead it is necessary to develop an exhaustive solution in the search space of the optimal. In this implementation, the intersection evaluates only its adjacent streets according to their congestion state, and reports to the vehicle the one with the less congestion between the available streets, that is, between those with sufficient space for the vehicle. The pseudo code is shown below (Algorithms 4 and 5). ```
0:Requiring vehicle \(\
u\)
0:Actual node actual
1:Node \(k=\) Get next node in which congestion is minimal and has space for the vehicle (6)
2:if\(k\) exists then
3:return next street (actual, \(k\))
4:else
5:return there is no available route
6:end if
```
**Algorithm 4**Local Congestion (LC)
```
0:Adjacent nodes \(Ad=\{k_{1},...,k_{n}\}\) not empty
0:Actual node actual
1:\(min=NotExists\)
2:for\(k\) in \(Ad\)do
3:if\(use_{(actual,k)}<capacity_{(actual,k)}\ AND\)\(congestion_{(actual,k)}<congestion_{(actual,min)}\)
4:\(min\gets k\)
5:endif
6:end for
7:return\(min\)
```
**Algorithm 5**Get next node

#### 4.2.4 Natural Behavior Algorithm

In this implementation the objective was to model what would a vehicle do when moving around the city if the decision is not supported by any communication system. The vehicle is not communicating with the intersection nodes, so when it arrives to an intersection it just evaluate the streets adjacent to its current street and take the first whose capacity is less than its use.