Say you have the following system of equations:
100x + 200y + 200z = 250
95x + 180y + 190z = 220
85x + 210y + 210z = 240
with additional constraints on each variable given by:
x >= .55
x <= .75
y >= .80
y <= .95
z >= .10
z <= .25
I have used the lpSolveAPI library in R and there is no solution, which may be true. That is fine; I don't dispute that.
What I am looking for is the solution such that the total error is minimized (i.e. the value of the left hand side vs. the right hand side). What are the best values of x, y and z such that the sum of all the errors of each equation is minimized.
How could I structure this in R using lpSolveAPI? The example below has 3 equations with 3 variables but I'd like to solve a more complex example with 50 equations of the same 3 variables. For reference, a similar approach but where there is a solution is here: Solving a feasible system of linear equations using Linear Programming
I have a feeling I need to modify the objective function in some way. Any thoughts?