Bonus-Malus systems are widely used in the insurance business. For the operation of such systems transition rules and premium scales need to established. Optimization of these systems usually means the calculation of appropriate premium scales while treating transition rules external parameters. In this paper, on the contrary, we show how optimal transition rules can be determined for a given set of premium scales. To this end, integer programming (IP) is used as a basic tool. Numerical examples are also presented to demonstrate the viability of our approach.