I am tackling a problem which uses lots of equations in the form of:
$$ q_i(x) = c_i(x) + \sum_{j=1}^N \left\lfloor \frac{q_i(x)}{P_j} \right\rfloor C_j $$
where $q_i(x)$ is the only unknown, $c_i$, $C_j$, $P_j$ are always positive. $C_j < P_j$ for all $j$
- How is this type of problems efficently solved especially when the number of iterations $N$ is between 20 - 100?
What I was doing is $q_i(x) - c_i(x)$ must be equal to the summation of integers. So i was doing an exhaustive search for $q_i(x)$ which satisfies both ends of the equation. Clearly this is computationally exhaustive even if I do the search on a parallel computer..
- What if $c_i(x)$ is a floating point number, this will even make the problem even more difficult to find a real $q_i(x)$?
Thanks

My proposal:
[For the sake of brevity the unknown $q_i(x)$ is denoted $Q$ and $c_i(x)$, $C$.] All constants can be real.
The right hand side is a sum of regular staircase functions, with the steps having width $P_j$ and height $C_j$. You can construct the resulting sum for increasing $Q$, from $Q=0$, by finding all discontinuities. The discontinuities occur at integer multiples of the widths, i.e. $k_jP_j$.
Maintain a vector with components $(k_j+1)P_j$, and a corresponding sum $S=C+\sum k_jC_j$. Initialize all $k_j=0$ and $S=C$. Now take the smallest of the $(k_j+1)P_j$ and increment $k_j$: $k_jP_j$ is increased by $P_j$, and $S$ by $C_j$.
Doing this repeatedly, you will enumerate all discontinuities, by increasing order. Between two successive discontinuities, let at $Q'$ and $Q''$, the sum is constant and equals the current S. You have a solution $Q=S$ every time that $Q'\le S\le Q''$.
For efficient implementation, the list of future discontinuities $(k_j+1)P_j$ is better organized as a priority queue.
Assuming that the first solution is found after the $M^{th}$ discontinuity, the running time will be $O(M\log N)$.
UPDATE:
Given that $x-1<\lfloor x\rfloor\le x$, we have this bracketing for $S$: $$C+Q\sum_{j=1}^N\frac{C_j}{P_j}-\sum_{j=1}^NC_j<S=C+\sum_{j=1}^N\lfloor\frac Q{P_j}\rfloor C_j\le C+Q\sum_{j=1}^N\frac{C_j}{P_j}.$$
By equating the bounds (magenta and black lines) to $Q$ (green), you get a good estimate of the range where solutions can be found. (If you start from a nonzero $Q$, you can initialize $k_j=\lfloor\frac Q{P_j}\rfloor$.)