Here is one of them - for you a mathematical brain. I have a matrix, in fact its half matrix, cut diagonally. Each matrix element can be 1 or 0 . I need to find all possible combinations of 1 s and 0 s for any matrix of width N.
It is quite simple, you can get the number of elements on this matrix with a given width N with
for this example, where N = 7 this will give us 28 or the number of elements. Then you can get combinations with
.
So the formula will be
to get all possible combinations.

Now that's where it gets complicated. There is one condition that must be met for each result. The sum of each set of elements on the matrix (shown below with each row presented) should be less than 4 for the first set (first in the first row), less than 3 for all other sets (these are constants, regardless of the value of N).

Here's what the sets look like for this example ( N = 7 ). If you notice that each line is represented. So, for the first set, if the combination is 0 1 0 1 0 1 0 , this would be true, since its sum is <4 (starting from its first line). For the second set, if the combination is 1 0 0 0 0 1 0 , it is valid because it must be <3.

I need to do this for huge matrices, so coarse forcing all possible permutations to find those that fall under this condition would be unreasonable. I need to find some kind of algorithm that I can use to create valid matrices from bottom to top, and not from top to bottom. Perhaps separate operations that can be compiled later to give a complete set of results.
Any ideas are welcome.
source share