Given this sort of dataset:
The limitations of each variable are:
- ID: identifier if each object, unique in the table
- Score1: A number between 0 and 1, that represent the value of the object
- P1: probability of call, betwen 0 and 1
- Flag: should the object be in group <b?
I want to split the dataset in 2 groups (A and B) given the rules:
- The sum of P1 on group A should be at least n
- The sum of P1 on group B should be at least m
- The diference between the average Score1 in the two groups should be minimal
- The average of Score1 on all the selected (group A + group B) should be maximum
- We don't have to select all the rows
- Rows with Flag = True can not be in group A
How can I do this in a smart/fast way?