University course scheduling (UCS) is one of the most important and time-consuming issues that all educational institutions face yearly. Most of the existing techniques to model and solve UCS problems have applied approximate methods, which are different in terms of efficiency, performance, and optimization speed. Accordingly, this research aims to apply an exact optimization method to provide an optimal solution to the course scheduling problem. In other words, in this research, an integer programming model is presented to solve the USC problem. In this model, hard and soft constraints include the facilities of classrooms, courses of different levels and compression of students' curriculum, courses outside the faculty and planning for them, and the limited time allocated to the professors. The objective is to maximize the weighted sum of allocating available times to professors based on their preferences in all periods. To evaluate the presented model's feasibility, it is implemented using the GAMS software. Finally, the presented model is solved in a larger dimension using a real data set from a college in China and compared with the current program in the same college. The obtained results show that considering the mathematical model's constraints and objective function, the faculty courses' timetable is reduced from 4 days a week to 3 working days. Moreover, master courses are planned in two days, and the courses in the educational groups do not interfere with each other. Furthermore, by implementing the proposed model for the real case study, the maximum teaching hours of the professors are significantly reduced. The results demonstrate the efficiency of the proposed model and solution method in terms of optimization speed and solution accuracy.