I have coded an equation solver using gaussian elimination. The input is units that are to be sorted by their size relative to the largest unit (example output 1l = 10dl = 100cl = 1000ml). I have example inputs that the code handles well, but on some unknown code for a test it crashes. Is there anywhere one could find test inputs to use for debugging (equation systems that are solvable)? The input should only yield integer solutions and preferably be between 2 to 10 variable equations
Asked
Active
Viewed 72 times
0
-
Can't you just create random problems? – Nico Schertler Jun 05 '19 at 15:46
-
It's not clear to me what you're solving here. Typical Gaussian elimination doesn't guarantee integer solutions. I have no way to tell if your system of equations is ill conditions. All systems of equations are not guaranteed to have solutions. Besides, who uses Gaussian elimination? LU decomposition with pivoting is a better idea. – duffymo Jun 05 '19 at 15:47
-
I know, but the test cases I get are provided such that they guarantee positive integer solutions. I guess the problem is pretty specific, but all I asked for was if anyone knew somewhere where there are any linear equation systems that one could use to test such algorithms with @duffymo – Kyozoku Jun 05 '19 at 15:59
-
That seems time consuming if they are supposed to be solvable and 10 variables for example @NicoSchertler – Kyozoku Jun 05 '19 at 16:00
-
Why is it time consuming? Generate a random matrix and a random solution vector that respects your constraints (positive, integer). Then calculate the right-hand side and use it to re-calculate the solution vector. Then, compare. Ensuring solvability is a bit trickier, but doable: When you create the matrix row by row, check that the new row does not lie in the span of the previous rows (e.g. using an equivalent orthonormal system of rows). – Nico Schertler Jun 05 '19 at 16:14
-
True, I did not think about that, but it's kind of what I ended up doing. Solved it btw @NicoSchertler – Kyozoku Jun 05 '19 at 17:03