Note that there are some explanatory texts on larger screens.

plurals
  1. POAlgorithm to find most efficient moves to arrive at a given point
    primarykey
    data
    text
    <p>(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.)</p> <p>Suppose that I have a set of points in an <em>n</em>-dimensional space. Using 3 dimensions for example:</p> <pre><code>A : [1,2,3] B : [4,5,6] C : [7,8,9] </code></pre> <p>I also have a set of vectors that describe possible movements in this space:</p> <pre><code>V1 : [+1,0,-1] V2 : [+2,0,0] </code></pre> <p>Now, given a point <em>dest</em>, I need to find a starting point <em>p</em> and a set of vectors <em>moves</em> that will bring me to <em>dest</em> in the most efficient manner. Efficiency is defined as "fewest number of moves", not necessarily "least linear distance": it's permissible to select a <em>p</em> that's further from <em>dest</em> than other candidates if the move set is such that you can get there in fewer moves. The vectors in <em>moves</em> 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.</p> <p>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 <em>dest</em> points. I want to optimize for speed, not memory. It's acceptable for the algorithm to fail (to find no possible paths to <em>dest</em>).</p> <h3>Update w/ Accepted Solution</h3> <p>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 &lt;<em>dest</em>, <em>p+vectors</em>>, 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 <em>dest</em> lookups happen in constant time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload