Choosing a random solution among infinite solutions of a linear system

54 Views Asked by At

I am solving a system of equations of the form $(a_i\cdot x_{i,1} + b_i)\cdot x_{i,2} = c_i$, for $i=1,\dots,N$.

$a_i$, $b_i$ and $c_i$ are known and I have few (essentially 7, when $N=10^5$) constrains of the form $\Sigma_{i=1}^{N} a_i x_{i,1}$ = A, or similar.

The point is the naturally this system has infinite number of solutions. I wanted to find a way to find at least one which solves the equations but also conforms with the constraints.

Does anyone know of a way to do it? Maybe a Monte-Carlo style approach?

Thanks