Skip to main content
. 2021 May 1;21(9):3148. doi: 10.3390/s21093148
Algorithm 1 Pseudo code of the Parking and routing algorithm.
  •  1:

    procedureInitialization

  •  2:

      Define the input variables

  •  3:

      Define the outputs: availability, congestion, drivingTime, bestPath and bestSpot

  •  4:

      Set the weights based on the case(= 1,2,3)

  •  5:

      Set the distances between all junctions and between the junctions and the parking lots

  •  6:

      Initialize arrival rate, departure rate, traffic intensity value

  •  7:

      Initialize congestion rates for all links, waiting time on the gates

  •  8:

      Initialize availability rate for all parking lots based on the capacity

  •  9:

      Set time slots to 5 (PR1, PR2, PR3, PR4 and PR5)

  • 10:

      Set the simulation time for each time slot

  • 11:

      Divide the simulation time into T’s

  • 12:

      Define the parking lots (P1, P2, P3, P4, P5 and P6)

  • 13:

      Define the cost of the parking lots

  • 14:

      Define the states of the transition matrix based on the available spots

  • 15:

    end procedure

  • 16:

    procedureTransitionMatrix(parkingLot,arrivals,departures)

  • 17:

      updates the empty spots in the parking lot

  • 18:

      update the ratio of the states in the matrix

  • 19:

      Return updated transition matrix

  • 20:

    end procedure

  • 21:

    procedureParkingRoutingAlgorithm

  • 22:

      Call Initialization procedure

  • 23:

      Specify the time slot or study the five slots

  • 24:

      for each PR in timeSlots do

  • 25:

        for each T in simulationTime do

  • 26:

          Generate arrivals based on the arrival rate and traffic intensity

  • 27:

          for each arrival in arrivals do

  • 28:

            Specify the starting point

  • 29:

            for each P in parkingLots do

  • 30:

              Get all path from starting point to the parking lot

  • 31:

              Call TransitionMatrix procedure for finding the availability rates

  • 32:

              for each Path in Paths do

  • 33:

                Get the congestion rate, waiting time at the gates

  • 34:

                Get waiting time at the gate

  • 35:

                Get the distance to the parking lot and the cost

  • 36:

              end for

  • 37:

              Generate departures based on the departure rate of the parking lot

  • 38:

            end for

  • 39:

            Find the objective function for all paths to the parking lots

  • 40:

            Define the best path and the best spot for this arrival based on the objective function

  • 41:

            Update all input variables based on the best values

  • 42:

            Send the best values to the arrival and store them in the outputs

  • 43:

          end for

  • 44:

        end for

  • 45:

      end for

  • 46:

    end procedure