I'm fairly new at programming, so I'm hoping someone will be able to point me in the right direction on this.
I have a list of ~2400 people and each person has at least one of 23 conditions (the condition for each person is either 1 if they have the condition or 0 if they don't).
E.G. If Jon has conditions 1, 5, and 6 Jon's output would be {1,0,0,0,1,1,0,0...}.
I will then be given a list of how many people with each condition is desired. So if condition 1's desired number is 10 people and condition 2's desired number is 5 people, I would want 10 people who have condition 1 and 5 people who have condition 2 (A person can count towards condition 1 and condition 2 if they have both).
Also, I must select exactly 30 people and try to get as close to the desired number of conditions as possible, with a strict limitation that a single condition must have at least three people and no more than 10 people.
Is there a way that this can be done and if so how would I go about doing it? I tried brute forcing this, but the large number of combinations prevented me from getting a solution.
Edit: Here is a small example with a list of 5 people and 4 conditions:
Person 1: {1,0,0,1}
Person 2: {0,1,1,1}
Person 3: {0,0,0,1}
Person 4: {1,0,0,0}
Person 5: {1,0,0,1}
Desired number of conditions {2,1,1,2}. The idea is that I need to select 3 people and get as close to the desired number of conditions as possible. In this example person 1,2, and 4 would be selected. I have to expand this idea to a list of 2400 people with 23 conditions and selecting 30 people (though it should be able to expand to any list size and any number of conditions) and it is not known if there is a combination of 30 members that will result in an exact match.
Did that help clarify things?