Skip to content

Hierarchical pcube representation #43

@JATothrim

Description

@JATothrim

Following is just me thinking about the polycube representation and how an pcube is computed.
(sorry if the grammar is bad/gibberish as I'm not too good writing complex sentences in english... 🥲 )

An tree (hierarchical representation) is an compact way to represent the polycubes:

When an base pcube N is expanded to N+1 etc. we count the index of the permutation:

  1. Generate unique list of candidate expansions for the base pcube.
  2. Start with single candidate in the permutation list.
    This is the "normal way" N+1 expansion of pcube.
  3. Process all unique permutations of the expansion list.
    For N+1 expansion the permutation index is just the candidate's array index.

Whats new is the N+2, N+3, etc. expansion of an base pcube:

  • N+2: Generate all unique permutations with two candidates.
    Each unique shuffle increments the permutation index.
  • N+3 expansion is all unique permutations with three candidates.
  • ...
  • The final base pcube expansion is simply using all the candidates.

Above process gives unique "index" value to all possible base pcube expansions:
Since we are computing just N+1 the expansions beyond this are not needed until later.
(Note: if we remember the last permutation state for base pcube N+2,
we can continue the enumeration from where we left it for future N+3 etc.)

Now that base pcube expansions have an well defined "index" encode pcube(s) with following:

  • Some kind of reference to the base pcube
  • the used permutation index value.
    Note that this value will grow with the count of candidate combinations.
  • the rotation's index. (an number of [0, 23] )

This scheme does mean that to get the actual coordinate data we have to (re-)compute it using
the expansion process again:

  1. Start with already rotated base pcube.
  2. Compute expansion candidate list for this pcube.
  3. Expand using the permutation index.
    This an hard problem: If we have to start from zero this would take an long time.
    Better options would be to selectively save the permutation state+index and continue from nearest check point.
  4. Rotate the expanded pcube using the rotation index.
  5. Repeat until we have pcube of required N

The hierarchical representation can be collapsed this way into the canonical form. (sorted coordinate list)

The reference to the base pcube de-duplicates it for all pcubes derived from it and this forms an tree structure.
The trick for saving memory is that the base pcube(s) should be loaded from the disk cache on demand
so N-1 part of the pcube(s) is kept out of memory.
Draw back is that the disk cache system needs to support finding any particular pcube and we have to store the pcube tree structure on disk.

Does any above idea(s) make sense ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions