algorithm - How can I iterate through all possible grid layouts? -


i have grid (an nsarray of cgpoints)where want layout objects @ points based on constraints. know:

  • how big grid is
  • the number of objects have laid out on grid, @ point
  • the minimum distance between 1 object (calculated using pythagorean magic)
  • the distance between points on grid
  • each point can have 1 object located there

i pick random object (using arc4random) , validate whether or not valid point. if is, flag such , choose point. if not, continue until either entire array searched @ point grid layout marked impossible , start again.

this continues until valid grid layout found.

problem:

i don't know how many if any valid layouts exist given constraints. i'm having trouble trying find way either calculate possible permutations, or iteratively search through permutations find if valid grids exist, prior embarking on impossible search.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -