I have a bunch of linear forms in the same number of variables, with the number of linear forms much larger than the number of variables. Say, they are $\ell_i(x_1,...,x_n)=l_{i1}x_1+...+l_{in}x_n$, for $i=1,...,N$.
I also have a multiset of values, $c_k$ with multiplicity $m_k$, for $k=1,...,K$, with $\sum_{k=1}^Km_k=N$.
I need to find a solution, by which I mean find $x_1$, ..., $x_n$ such that the values $\ell_i(x_1,...,x_n)$, $i=1,...,N$ form this multiset. That is, there must be $m_k$ copies of $c_k$ among these values, for each $k=1,...,K$, regardless of specific places where they might occur.
Are there methods to impose conditions ensuring existence of a solution, and solve the system under these conditions?
Here's the outline of the ILP formulation:
Let $y_{ik}$ be binary variables such that $y_{ik} = 1$ if the linear form $i$ takes the value $c_k$ and $y_{ik} = 0$ otherwise. We want to find the values of $x_1, ..., x_n$ and $y_{ik}$ that satisfy the following constraints:
For each linear form $i$, exactly one $y_{ik}$ is equal to 1: $[\sum_{k=1}^K y_{ik} = 1, \quad i = 1, ..., N]$
The values of $c_k$ should appear exactly $m_k$ times: $[\sum_{i=1}^N y_{ik} = m_k, \quad k = 1, ..., K]$
The linear form $i$ takes the value $c_k$ only if $y_{ik} = 1$: $[l_{i1}x_1 + ... + l_{in}x_n - c_k = M(1 - y_{ik}), \quad i = 1, ..., N, \quad k = 1, ..., K]$
Here, $M$ is a large constant (greater than the maximum possible value of the linear form) to enforce the constraint when $y_{ik} = 0$.
Now you can use an ILP solver like IBM CPLEX, Gurobi, or the open-source SCIP solver to find the solution to this problem. This will give you the values of $x_1, ..., x_n$ and $y_{ik}$ that satisfy the constraints. For your problem size should be manageable.
If you want to explore multiple solutions, you can iteratively solve the ILP with additional constraints that exclude the previous solutions until no more feasible solutions are found or you have found enough solutions for your needs.