This paper presents a novel heuristic method for optimal control of mixed-integer problems that, for given feasible values of the integer variables, are convex in the rest of the variables. The method is based on Pontryagin's maximum principle and allows the problem to be solved using convex optimization techniques. The advantage of this approach is the short computation time for obtaining a solution near the global optimum, which may otherwise need very long computation time when solved by algorithms guaranteeing global optimum, such as dynamic programming (DP). In this paper, the method is applied to the problem of battery dimensioning and power split control of a plug-in hybrid electric vehicle (PHEV), where the only integer variable is the engine on/off control, but the method can be extended to problems with more integer variables. The studied vehicle is a city bus, which is driven along a perfectly known bus line with a fixed charging infrastructure. The bus can charge either at standstill or while driving along a tramline (slide in). The problem is approached in two different scenarios: First, only the optimal power split control is obtained for several fixed battery sizes; and second, both battery size and power split control are optimized simultaneously. Optimizations are performed over four different bus lines and two different battery types, giving solutions that are very close to the global optimum obtained by DP.