Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:20:51+00:00 2026-06-10T05:20:51+00:00

I am currently doing some calculations with trees. Each node has 5 values I

  • 0

I am currently doing some calculations with trees. Each node has 5 values I am trying to calculate and a type deciding how these values are calculated. Some calculations can be pretty complicated algorithms. All calculations within a node depend solely on the values of its child nodes, so I am doing calculations from down to top. For each node type, a value depends on different values of the childnodes. I am interested mainly in the 5 values in the root node, which depend on all values in all other nodes ofc. All this is working just fine. A node can only have 1 or 2 childnodes, and the tree usually is no deeper than 5 levels.

For some node-types, there is a tolerance; meaning some values there would not matter, see this picture, I marked those with XX. Sometimes even, some values would be in relation, like C = XX * A. Currently, these values are just set to some default values. Sometimes there would be a complicated relationship even, like multiple possible solutions of an algorithm like Newton’s Method, depending on starting values.

Sorry for my bad drawing skills

Now there is a rating I can apply on the values of the root node. What I would like is to optimize this rating by adjusting the XX-values deep within the tree. The calculations within each node can be a range of many possible formulas and the tolerance can be one of many possible patterns, so I cannot just figure out some formula but I would need some algorithm which is very flexible. I do not know of such an algorithm. Does anyone have an idea?

/Edit: To clarify, it is unclear how many values in the tree will be free. There is not just one XX, but there may be any number of them (I guess max. 10), so my first step would be identifying these values. Also, I will be doing this on many generated trees within a time window, so speed is not unimportant as well. Thanks:)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:20:53+00:00Added an answer on June 10, 2026 at 5:20 am

    If you have 3 input values XX, YY, and ZZ, you are searching a 3 dimension space. What you are looking to do is to apply an optimisation algorithm, or Heuristic algorithm. Your choice of algorithm is key, a cost benefit between your time and the computer’s time. I am guessing that you just want to do this once.

    What ever method you use, you need to understand the problem, which means to understand how your algorithm changes with different input values. Some solutions have a very nice minimum that is easy to find (e.g. using Newton’s Method), some don’t.

    I suggest starting simple. One of the most basic is just to do an iterative search. It’s slow, but it works. You need to make sure that your iteration step is not too large, such that you don’t miss some sweet spots.

    For XX = XXmin to XXmax
      For YY = YYmin to YYmax
        For ZZ = ZZmin to ZZmax
    
          result = GetRootNodeValue(XX, YY, ZZ)
    
          If result < best_result then
            print result, XX, YY, ZZ
            best_result = result
          End if
    
        End For
      End For
    End For
    

    Below is another method, it’s a stochastic optimisation method (uses random points to converge on the best solution), it’s results are reasonable for most conditions. I have used this successfully and it’s good at converging to the minimum value. This is good to use if there is no clear global minimum. You will have to configure the parameters for your problem.

    ' How long to search for, a larger value will result in long search time
    max_depth = 20000
    
    ' Initial values
    x0 = initial XX value
    y0 = initial YY value
    z0 = initial ZZ value
    
    ' These are the delta values, how far should the default values range
    dx = 5
    dy = 5
    dz = 5
    
    ' Set this at a large value (assuming the best result is a small number)
    best_result = inf
    
    ' Loop for a long time
    For i = 1 To max_depth
    
        ' New random values near the best result
        xx = x0 + dx * (Rnd() - 0.5) * (Rnd() - 0.5)
        yy = y0 + dy * (Rnd() - 0.5) * (Rnd() - 0.5)
        zz = y0 + dy * (Rnd() - 0.5) * (Rnd() - 0.5)
    
        ' Do the test
        result = GetRootNodeValue(xx, yy, zz)
    
        ' We have found the best solution so far
        If result < best_result Then
            x0 = xx
            y0 = yy
            z0 = zz
            best_result = result
        End If
    
        Print progress
    Next i
    

    There are many optimisation algorithms to choose from. Above are some very simple ones, but they may not be the best for your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently doing some testing to determine the performance implications of including an index
I'm currently doing some last-measure optimizations, mostly for fun and learning, and discovered something
I am currently doing some network programming and had a couple questions concerning timeouts.
I am currently doing some kind of reporting system.the figures, tables, graphs are all
I am doing some PloneFormGen work. Currently PloneFormGen stores entered form entries internally as
I am doing some performance critical work in C++, and we are currently using
Im currently doing a console app that has to send scheduled emails. In one
I'm currently doing some normalization along the lines of: J = Integrate[Psi[x, 0]^2, {x,
I'm currently doing some computation in Mathematica related to Quantum Mechanics. As we've moved
I am currently looking at some code that is doing even trivial insert/select/update by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.