I’m getting back to the project where I needed that.
I’m quite certain there is a way to be found.
That post is a mere up, though only in order to not waste time in what I’m going to explain next, in case someone has an answer.
My intelligence has limits (obviously), and the answer to that problem either doesn’t exist, or lies beyond those limits.
What I’m going to try, is genetic programming. The problem seems simple enough to formulate for that approach to be somehow valid.
If I succeed I’ll both post the answer and the code used to evolve algos.