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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:35:26+00:00 2026-05-13T13:35:26+00:00

(This is not exactly the problem that I have, but it’s isomorphic, and I

  • 0

(This is not exactly the problem that I have, but it’s isomorphic, and I think that this explanation will be easiest for others to understand.)

Suppose that I have a set of points in an n-dimensional space. Using 3 dimensions for example:

A : [1,2,3]
B : [4,5,6]
C : [7,8,9]

I also have a set of vectors that describe possible movements in this space:

V1 : [+1,0,-1]
V2 : [+2,0,0]

Now, given a point dest, I need to find a starting point p and a set of vectors moves that will bring me to dest in the most efficient manner. Efficiency is defined as “fewest number of moves”, not necessarily “least linear distance”: it’s permissible to select a p that’s further from dest than other candidates if the move set is such that you can get there in fewer moves. The vectors in moves must be a strict subset of the available vectors; you can’t use the same vector more than once unless it appears more than once in the input set.

My input contains ~100 starting points and maybe ~10 vectors, and my number of dimensions is ~20. The starting points and available vectors will be fixed for the lifetime of the app, but I’ll be finding paths for many, many different dest points. I want to optimize for speed, not memory. It’s acceptable for the algorithm to fail (to find no possible paths to dest).

Update w/ Accepted Solution

I adopted a solution very similar to the one marked below as “accepted”. I iterate over all points and vectors and build a list of all reachable points with the routes to reach them. I convert this list into a hash of <dest, p+vectors>, selecting the shortest set of vectors for each destination point. (There is also a little bit of optimization for hash size, which isn’t relevant here.) Subsequent dest lookups happen in constant time.

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

    Actually, considering that you have around 10 vectors, you can, for a given dest point, calculate only the 1024 “targets” from the subset of vectors — e.g every reachable space, with the information about what set of moves gets there. That might be “slow”, or “fast” depending on context (it’s be absurdly fast if implemented on a parallel computing device like the GPU).

    Having all the sets that get there you can calculate the paths a lot quicker, then you can pick the point from which to get to dest in the fewest moves, choosing from the subset of the ones that are either your query or further.

    (thanks to Strilanc)

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

Sidebar

Related Questions

I have a problem that is common, but I am not quite sure exactly
I'm not exactly sure how to properly debug this but have tried a few
This is not exactly a programming question, but it's highly related. We are writing
I'm not exactly sure how to ask this question really, and I'm no where
My question is not exactly the same as this one (it's not theoretical, there
Not sure exactly how to word this question ... so edits are welcomed! Anyway
Exactly what the title says. Note, this is not about subscriptable objects.
Sorry for this not being a real question, but Sometime back i remember seeing
Under what circumstances would this or would this not be safe? I have a
This is not a new topic, but I am curious how everyone is handling

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.