I am wondering if one could solve a feasible system of linear equations using a Linear programming approach, instead of standard linear algebra techniques such as gaussian elimination. For instance, below is an overdetermined system:
$$\begin{cases}
a+b+d = 10 \\
b+c+d = 12\\
a+b+c = 9 \\
a+c+d = 11 \\
a+b+e = 15 \\
a+b = 5 \\
b+c = 7
\end{cases}$$
The unique solution to this is
$$\begin{cases}
a = 2\\
b = 3\\
c = 4\\
d = 5\\
e = 10
\end{cases}$$
I tried solving using LP library in python, it says that system is infeasible. I had used a constant objective function (=1) and maximized it. However, I get a message that the system is infeasible. Could someone throw some light on it please?
Thank you.
Best Answer
Your objective function $c^\top x$ seems wrong. Just use \begin{matrix} \min & 0^\top x \\ \text{w.r.t.} & A x = b \end{matrix} and your LP solver should return no solution if there is no solution for $Ax = b$ or otherwise one of the solutions.
Example using lpSolve from R:
If not done already, install lpSolve:
Load the library:
Create a new model in $5$ unknowns and store it in the variable lprec:
Set the objective function t0 $c = 0$:
Now add the constraints, thus the rows of $A x = b$:
Have a look at the model:
Now solve:
And check the found optimal value:
Then check for the found feasible solution