'Cartesian product with checking condition when adding a new element to the set and without a repeat of elements

There are two sets of:

  1. int Transformer substations

  2. object Buildings(the set is larger than the first set at least by 5 times).
    The building has 2 parameters (number and load).

    Need to create all possible combinations: each transformer station is loaded by 60-80% in every combination, and buildings don't repeat.

    Glad to hear any suggestions.

Tried the Cartesian product but I have no idea how to apply it. Ideas just don't appear. I guess it is because of the stress produced by the war in Ukraine where I live.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source