The paper presents an approach to estimate the optimal number of vehicles on public transport line; this approach is based on a simulation model of the process of servicing the bus line passengers. A problem of determining such a number of buses, that provides the minimum cost of transport at the maximum level of passenger service, is quite a complex issue due to the stochastic nature of the transport process and the random nature of the demand for trips of urban residents. An efficiency of a public bus line is proposed to be considered on the basis of the total operation costs of a bus line in terms of the interests of particular elements of the transport system — passengers as customers of public transport and public transport companies as providers of services. The author presents a class library implemented with the use of the Python programming language; on the basis of this library, the model simulating the process of the public transport line operation was developed. The results of the simulation experiment, based on the developed software, allowed the author to define the functional dependence between the total waiting time for bus passengers at bus stops and the characteristics of the public transport line. Using the obtained dependence, a formula for estimating the optimal number of vehicles on a public transport line was established as an argument, in which the function of the transport subsystem total cost reaches its extreme minimum.