High field above 20 T is required in diverse physical programs and nuclear magnetic resonance (NMR) systems. For intended science program requirements, as a demonstration of the development in high field superconducting magnet technology, a 25 T (4.2 K) 52 mm cold-bore all-superconducting magnet consisting of a 10 T high-temperature superconducting insert magnet and a 15 T low-temperature superconducting background magnet, is being developed at the Institute of Electrical Engineering, Chinese Academy of Sciences. The development of such a magnet requires its optimization, and the choosing the number and type of coils is crucial to the final optimal design. However there are few researches focusing on the effect of coil combinations. To study the relationship between the number of coils and the magnet parameters, we first discuss the magnet optimization. The objective function of the optimization is defined as the weighted function of coil volume according to the costs of different superconductors, and the following constraint conditions are taken into considerations: center field, YBCO conductor characterization, hoop stress in Nb3Sn coils, and the critical performances of these wires. All those constraint conditions are taken in the analytical form, and the magnetic field, stress results are verified with the finite element method. To guarantee the reliability of the optimal results, in addition to consider the constraint conditions, a method of combining global optimization and local optimization is adopted. 20 different coil combinations are selected according to the investigation of superconducting wires, and their optimal results are calculated. The following conclusions are drawn from the analyses of these results. Firstly, in the design of high field magnet, the number of coils and magnet cost demonstrate a "V"-shaped relationship, that is, there exist an optimal number of coils. Secondly, when the objective function demonstrates good values, Nb3Sn coils generate fields in a range of 6-7 T, whereas NbTi coils generate fields in a range of 8-9 T. Finally, the objective functions under two different situations, i.e., Nb3Sn coils and NbTi coils are powered together and separately, are calculated. From the comparisons we find that the effect of reducing one power supply is acceptable when the number of coils is not too big.