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 4045750
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:28:25+00:00 2026-05-20T13:28:25+00:00

I’m needing to implement what to me looks like a decision tree (though searching

  • 0

I’m needing to implement what to me looks like a decision tree (though searching on that term returns posts on finding out influencing factors in a decision process – which isn’t what I’m after).

The system I’m building will be working out warranty periods to give a product installation based upon some criteria. The requirement is for the creation of a set of possible vectors (e.g. Installation Pitch, Profile, location, material type etc…) and for those vectors to be assembled by the user into a tree structure:

-- Profile == corrugate (warranty = 20 years)
  -- Pitch >= 0 && < 5 (warranty = 2 years)
  -- Pitch >= 5 && < 20 (warranty = 10 years)
-- Environment == coastal && distance <= 500 meters (warranty 2 years)

This is a simple case, but the theory is that I can then walk this tree when it comes time to figure out a warranty period, and then choose the lowest value that the tree produces given the supplied information.

Right now I can sensibly see this being stored as a tree in the database (it’s a Rails app) and just writing some method to walk the tree and decide, but I wanted to know if there is a better way to approach this problem?

I’m going to have to repeat myself later in the project when I also implement another decision tree that will decide whether a warranty application needs further moderation by our warranty team. In that case the outcome from each node will just be true or false.

Seeing as it’s a pretty crucial part of the app I’d like to get the structure right first time 🙂 And perhaps learn something new along the way 🙂

  • 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-05-20T13:28:26+00:00Added an answer on May 20, 2026 at 1:28 pm

    I think a tree (or multiple trees–since you can only compare one vector element at a time before making a decision) translates this data very intuitively. There may be a more compact way of doing it, but if anyone else will be looking at this code in the future, the tree method will help them to maintain it.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into

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.