## 2 Materials and Methods
### Proposed PUTSS Algorithm  
Public urban transportation operates on a standard schedule at equal time intervals. The challenge is to devise an algorithm that adjusts these intervals to ensure the following:  
* Public urban transport vehicles do not run empty;
* Passengers do not wait excessively long at stations. To meet these constraints, the PUTSS algorithm was developed based on imposing a maximum waiting time of 15 min. Assuming a route provides departures every 5 min, the issue of skipping departures arises if there are fewer passengers on the road (_RTCVCF_) compared with a statistical value (_SDCF_). The PUTSS algorithm utilizes the calculation formula from relation (6), where _SDCF_ is less than 2.5 and the RTCVC factor (_RTCVCF_) exceeds the total bus capacity minus 5, then the bus can depart. If the _SDCF_ exceeds 2.5, a safety margin of 5 seats is maintained, ensuring passenger comfort and preventing situations where additional passengers may arrive after the bus departs from the terminal. \[Decision=\left\{ \begin{array}{l}-1,\ SDCF<2.5\ \ and\ RTCVCF<(k-5)\\ 0,\ (SDCF<2.5\ and\ RTCVCF>(k-5))\\ or\ (SDCF\ \geq 2.5\ and\ RTCVCF<(k-5))\\ 1,\ SDCF\ \geq\ 2.5\ and\ RTCVCF\geq(k-5)\end{array} \right., \tag{6}\]  
where:  
_Decision_ is a flag variable that can take on the following three values:  
* A value of \(-1\) if a scheduled run can be skipped;
* A value of 0 if the bus should depart on its scheduled run;
* A value of 1 if an additional run should be added because of high identified congestion levels. _SDCF_--the Statistical Data Component factor;  
_RTCVCF_--the Real-Time Computer Vision Component factor;  
\(k\)--the capacity of the bus scheduled for departure on its run, measured in the maximum number of passengers. Figure 3 depicts the block diagram for the PUTSS algorithm, highlighting its components, decision points, and overall functionality. The first step involves utilizing Google Maps Service to identify public urban transport stations along the analyzed route. This identification provides accurate data regarding congestion levels at each station. This component ensures that the algorithm clearly understands the geographic layout of the transport system. The second component is responsible for scraping congestion data from Google Maps Service for each hour of the day. Selenium automates the browsing process, allowing systematic data collection. The data retrieved provides a real-time view of congestion levels, which is necessary for the _SDCF_ calculation and subsequent decision-making in the algorithm. The RTCVC employs Azure Computer Vision to identify the number of station passengers based on real-time images. This module provides real-time passenger data, allowing for a more informed assessment of whether to adjust bus schedules based on actual occupancy levels. This decision-making process dynamically adjusts the bus schedule based on real-time data, which helps to minimize overcrowding and avoid running empty buses. This final component translates the decisions made by the PUTSS algorithm into actionable outputs, such as adjusting the bus schedule. The Public Urban Transport Scheduling System (PUTSS) algorithm operates through a series of steps that combine real-time data and historical patterns to optimize public transportation schedules. Below, we outline the core processes involved that support the decision-making framework. Figure 3: Block diagram of the PUTSS algorithm. 1. The algorithm receives two primary inputs including historical congestion data (from the Statistical Data Component, SDC) and real-time visual information about passengers at bus stops (from the Real-Time Computer Vision Component, RTCVC). Google Maps provides real-time traffic data, while Microsoft Azure's Computer Vision service identifies the number of passengers at bus stops in real time. These two components feed data into the system continuously;
2. The SDC component relies on historical data to predict future congestion levels.