# Tree Optimization, Combinatorics, algorithm [closed]

My Partners and me, we are trying to optimize frequency process...

I used Java to show our Problem, but the question is about algorithm NOT about Java implementation. Although implementations in java help us a lot.

What we want to simplify our problem as much as possible in a JTree.

As you can see, each node or leaf has a numResampleOperations involved per node/leaf.

L -> Increment or multiplication
M -> Decrement or division


How do we calculate the values?

Target = Source*L/M
numResampleOperations = filterSize * Source * Integer.max(L, M);


We want to obtain only one value per frequency indicated in one String, removing not needed branch of Tree. 210, 200, 180, 160 and 150 like is shown in the image.

For this example we used only 5 ordered Target frequencies (only integers value are allowed), but can grow until 50 frequency values.

The Tree must preserve at least one per included Target frequency of 150Hz, at least one of 160Hz, .., 210Hz.

The highest priority is to have the minimum sum involved of numResampleOperations

How do we remove not needed branches (those whose sum is very high), nodes or leafs, with the guarantee of having at least one (frequency required on String), but the sum of all numResampleOperations is minimum?

What do you suggest to us?

We starting with https://stackoverflow.com/questions/56095738/generate-list-with-combination-of-subset-of-list-java But due to the dimensions the solution is not viable.

## closed as unclear what you're asking by dkaeae, Evil, Discrete lizard♦May 29 at 12:05

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• I'm not sure your question is really on-topic here. It'd help understanding if you recast it based on standard CS terminology instead of Java-specific JTree, JTextField, etc. – dkaeae May 27 at 14:10
• @dkaeae I edited my question avoiding to use Java components, I don't know CS terminology, where I can read about this? – Anita May 28 at 0:50
• AIUI you have a tree where each vertex has some independent parameters, some dependent parameters, and a cost. The cost of the tree is the sum of the cost of the vertices, and you want to minimise it. But it's not clear to me (1) what the parameters of the root are, and whether they can be changed; (2) whether filterSize is a dependent or independent parameter. – Peter Taylor May 28 at 6:45