If there is an equation 3a + 6b +7d = 55
and the solution set is {1,4,6}
but it is unknown which number in the solution corresponds to which variable, is there a way to determine which number corresponds with which variable without using brute force? Could this method scale if the equation had 1000 variables? Thanks!
Permutation for equation solving
103 Views Asked by artificial_intelligence At
1
This is brute-force solution with pruning search where solution can't be found.
Let's show two things. First, if coefficients and solutions are non-negative numbers and if they are represented as a sorted list, then maximal value equation can have is 'parallel sum', and minimal value is 'reversed sum'.
It is enough to see that for four numbers
0 <= a1 <= a2
and0 <= b1 <= b2
holds:Second is that it is always possible to transform problem to problem of the same type with non-negative coefficients and solutions. To 'move' solutions to non-negative it is needed to add to all solutions value
-min(solutions)
and to result-min(solutions)*sum(coefficients)
. Similar procedure 'moves' coefficients to non-negative.Here is python implementation of solution: