U ntil the end of the 20th century it was common that cities organized, financed, and managed their own public transportation systems. More recently (in Italy mainly during the last decade), many countries liberalized the service provision of public transportation. Although offering local public transportation is a political and financial duty of governments, the service provision is outsourced to a private operator, while the government retains a control position, given to a regulatory agency. This is a common scheme not only in transportation. In close collaboration with the public transportation agency of the city of Bologna, Italy, we designed a methodology to optimize some aspects of the contractual relationship between that agency and the bus operator. We focus on the fines specified by the contract when the operator fails to comply with the service level it has agreed to provide, and on a procedure to measure that service level. Our approach has the advantage that it aligns the incentives of both parties to the benefit of bus riders. We model the agency-operator relationship as a multistage game and find its equilibrium to establish the best operating regime. The gametheoretical approach provides expressions for the fines that the operator should be charged if it does not satisfy the contracted services, and for the optimal agency's budget to devote to control activities. Second, to check the compliance of the operator with the schedule specified by the contract in a resource-efficient way, we compute how to position the agency's employees to verify if buses are running according to the specifications of the contract. This is achieved by counting bus services and by checking other quality indicators. We formulate this NP-hard problem as a mixed integer linear program and propose an algorithm to solve it that is effective in providing itineraries for the controllers working for the agency.