The solution to the problem of finding the probability density of all possible states (configurations) in dipole lattices, which also allows obtaining information about the degree of frustration in the system, is considered in the article. As an example, the Cairo lattice of 40 particles (dipoles) was used - a two-dimensional system of artificial spin ice, combining the geometry of square and Kagome lattices. Our method was created by combining the approximate polynomial algorithms of the MC-walk and the Greedy algorithm. We used the Greedy algorithm to obtain the energy data points for each possible spin excess, then partition the space into an equal number of intervals, and MC-walk to accumulate the data points. It was shown that the use of intervals makes it possible to ensure good performance of the method on the most degenerate energy regions but has a problem in finding data points on the least degenerate regions. The distribution of the density of states is constructed.