New to the forums not sure if this is the correct place but here goes...
I am wondering if there might be a mathematical solution to my problem. I am setting up a breeding program and have a database with "animal id", "mother id", "father id"
I have a job that allows the user to select (for example) 80 females and 8 males to breed, each male would be assigned 8 females to breed with.
I also have a couple rules for the breeding assignment, those rules are...
Brother/Sister mating is NOT allowed.
X number of sisters (maximum) can breed with the same male.
I can not control the animals that the user selects though. Right now my job try's to randomly assign 8 females to each male while avoiding the limitations. If it fails to place 100% it just loops and try's again.
Is there some sort of way that I can determine if the placement is possible or not with a combination of SQL and some clever math?
Attached is some sample data..