In a magnetic resonance imaging system, the magnetic field homogeneity plays a decisive role on the image quality. As an effective technique, passive shimming (PS) uses ferromagnetic material (shim pieces) to eliminate the field impurity in the imaging area. In existing PS algorithms, most attempt to efficiently find continuous solutions using standard linear programming (LP). However, discrete solution has to be used in shimming practice. Direct rounding off of the continuous solution may lead to an unacceptable homogeneity loss. In theory, integer programming (IP) can be used to find discrete solution, however, it usually requires a huge amount of computing time, and the optimization procedure can hardly to converge. In this work, a mixed integer programming scheme was proposed, which combines the LP and IP algorithms to find the practical shimming solution. In the hybrid optimization algorithms, the first step is to obtain the initial continuous solution using an improved linear programming model, which not only minimize the peak-peak field error, but also seek the optimal target magnetic field. The second step is to re-optimize those shim pieces having a significant influence on the field homogeneity using an integer linear programming model. In the established optimization model (step 1), the LP algorithm guarantees a global minimum solution for the given problem, without extra computational parameters involved in the transition from first-step to second-step optimization. Compared with other integer programming strategies, the hybrid algorithm can greatly save the computing time and maintain excellent shimming results achieved by continuous solution. This has been demonstrated by a shimming study for the 1.5T superconducting magnets.