Search code examples
algorithmdynamicgreedy

Algorithm - Minimizing Equation


If we are given an equation say 3x + 2y <= 10, we want to find the value of x and y such that x + y = maximum and 10 - 3x - 2y is minimized. How can this be done? I am thinking of it as a dynamic programming problem ! but not sure if I am right.

In the above x = 0 and y = 5 will be the answer.

Thanks.


Solution

  • There is an immense mathematical literature on this problem. If the equations are all linear, then the answer, if there is a unique one, has to lie on a vertex of the polytope described by the constraints. Look up linear programming. The Simplex algorithm is the classical method for searching along edges of the polytope to find a vertex that satisfies the minimization.