Note that there are some explanatory texts on larger screens.

plurals
  1. POiterate through a 3d matrix, finding all solutions
    text
    copied!<p>iterate through a 3d matrix</p> <p>i need to check every possible solution to a certain predicament.</p> <p>i have a matrix[x][y][z] that represents possible nodes to travel through. I already finished a method that should give me a set of solutions (it disables a single path every iteration and recalculates the entire solution, disable priority is based on travel capacity of the last solution) but i need to see how effective my method is in terms of total time taken to calculate a set. For this i require a method calculate the solution on every permutation of these paths. </p> <p>currently it only has a single layer in between 2 main layers (L1) where 0 is a free path and 1 is a non accessible path. This here is the starting layout where i can toggle the values on layer L1 from 0 to 1 to disable a path and the basis of my shortest path search algorithm.</p> <pre><code>L0 0 0 0 0 0 L1 0 1 0 1 0 L2 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 </code></pre> <p>how can i iterate through every possible combination of disabling the free paths when the dimensions of the matrix are non constant (meaning they are already user defined on compile time and can be changed whenever)? there are 2^n solutions where n is the number of free path on all mediary layers. (a quick explanation in C or C++ would be best, even pseudo code is good) since there currently 9 free path to make combinations with there should be about 2^9 solutions which i need to test with. I havent done any brute force algorithms before so i have no idea how to make one.</p>
 

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