I am trying to use CVXPY to solve a linear program of the following form:
10 people respond to a survey asking for their household, age, gender, and generation. From these responses, I have written up many constraints and statistics such as "average age of all 10 individuals = 40", or "number of single-parent households = 0". Each field (a given person's age, race, etc.) is represented as a CVXPY Variable. The goal is to use these constraints to regenerate the original survey responses (pretend that an outsider sees the constraints published without seeing the survey responses and wants to determine what the original survey responses for each individual were).
I can encode my constraints as CVXPY constraints, but then I have no objective function to maximize, as all I have are many constraints. Is there a way to encode my objective function to return the number of constraints that are met by a given assignment of variables, so that the objective function is maximized when all constraints are met? I can't tell if there is a way to do this from the CVXPY documentation. Alternatively, is there another open-source optimizer that is better suited to solving this program? I have already solved it using a SAT solver, and want to do it with a nonlinear optimizer now.
Example data is in the following format: ID, Household #, Age, Sex, Race, Generation:
ID is irrelevant and is only used to help me keep track of line numbers in other code.
1 1 80 1 1 2
2 1 40 0 0 1
3 1 70 1 0 2
4 1 30 1 1 1
5 1 90 0 0 2
6 2 10 0 1 0
7 2 10 0 1 0
8 2 10 1 0 0
9 2 40 1 0 1
10 2 20 0 1 1
Thank you, Christian