Python Forum

Full Version: How to solve equations, with groups of variables and or constraints?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need a way to formulate a series of equations that are about finding at least one combination of groups of variables, that added together, equal a certain sum.

Example time:
(A,B)+(C,D,E)=3

This means that at least one combination of one variable chosen from each group (for example AC or BE but not ACD) when added needs to sum up to 3. Furthermore I also need to be able to constraint all variables to a range of integers, in this example all 5 variables can have the value 0, 1 or 2. This means that at least one variable in AB will have the value 1, and at least one variable in CDE will have the value 2, or vice versa, for this equation to hold true.

So I need to solve a lot of equations similar to this, all together. I have looked into Linear Programming in general, and Mixed Integer Linear Programming (and the mip library) specifically, but I have not been able to find anything about how to make these or constraints.

Is Linear Programming/Mixed Integer Linear Programming even the answer, or do I need to go in another direction to solve these types of equations?