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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:47:38+00:00 2026-05-23T22:47:38+00:00

in the last few days I’ve been thinking about this problem without finding an

  • 0

in the last few days I’ve been thinking about this problem without finding an optimal solution, hence this question.

Let’s say we have a set of N variables, which a user can compose to create a list of rules and the following action, such as:

variables V_1,V_2,V_3
V_1 > 5 -> "Turn left"
V_2 < 6 -> "Turn right"
1 < V_1 < 4 -> "Continue straight"
V_1 = 0 AND V_2 > 6 AND V3 > 5 -> "Go backwards"
default -> "Stay"

Variables won’t necessarly be integers, and suppose that the rules are all composed by a list of AND clauses followed by an action.

What i want to do is to build a decision tree that would allow me to fast process an input like (0,7,9) and return the proper action.
As of now, my only idea is to partition the variable space and the see where the input state fits, but it seems a slow soluition : anybody knows something that may be faster?

  • 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-23T22:47:38+00:00Added an answer on May 23, 2026 at 10:47 pm

    What makes it slow? Lot of rules? Long rules? Lot of variables? Slow rules processing?

    If you have not to many variables rules, I would clearly go for a hash table.

    This is an example of tree (not necessarily optimal) for the problem you stated.

    variables V_1,V_2,V_3
    V_1 > 5 -> "Turn left"
    V_2 < 6 -> "Turn right"
    1 < V_1 < 4 -> "Continue straight"
    V_1 = 0 AND V_2 > 6 AND V3 > 5 -> "Go backwards"
    default -> "Stay"
    
       V1         V2      V3
       <0 ------- <6 --------------- Right
                  >=6 -------------- Stay
    
       0 -------- <6 --------------- Right
                   6 --------------- Stay
                  >6 ---- <=5 ------ Stay
                          >5 ------- Backwards
    
       ]0-1] ---- <6 --------------- Right
                  >=6 -------------- Stay
    
       ]1-4[ ----------------------- Straight
    
       [4-5] ---- <6 --------------- Right
                  >=6 -------------- Stay
    
       >5 ------- <6 --------------- Right
                  >=6 -------------- Stay
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a shoutout as I've been spending the last few days learning about
I've been working on this app for the last few days and suddenly this
OK I have been messing about with URL rewriting for the last few days
Last few days I searched all over the internet to solve this problem but
I've been getting this error frequently every day for the last few days... $
I've been looking for a solution the last few days, I didn't really found
I've been reading about Singleton pattern for last few days. The general perception is
I've been scratching my head over this for the last few days and neither
I have been reading over the last few days about assembly language, and the
I've been stumped with this for the last few days, I'm a bit new

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.