You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All KPuzzle conveniences were available, including composable and invertible transformations.
This has now mostly been replaced by the SemiGroupActionPuzzle trait. It has this name because its operation are closest to a semigroup
action (compared to the full group action of KPuzzle):
This is implemented for KPuzzle, and can be implemented for various other
puzzles. In particular, it is also implemented for specific phases of puzzle
searches so that they can use different:
pattern/transformation representations,
prune table implementations, and
various other techniques like symmetry reduction.
All the methods on SemiGroupActionPuzzle take a &self parameter in order to allow information (such as implementation-specific lookup tables) to be stored on the implementation.
A vestigial GroupActionPuzzle trait remains, but it is essentially unused at the moment. It may become useful in the future when generalizing KPuzzle-specific optimizations to more puzzles.
TPuzzle
By convention, the generic type of puzzle implementing SemiGroupActionPuzzle is called a TPuzzle (since T is a common name for such a type). For example:
The core engine of every search is IDFSearch, an iterative deepening
depth-first search, which takes a TPuzzle generic. It also takes a second
generic struct that allows for the "zero-cost" abstraction of compile-time
dispatch for search optimizations:
The generics on IDFSearch default to KPuzzle with a HashPruneTable. Also note that the name "optimizations" should probably also be revised, as (for example) bandaged puzzles may rely on them for correctness.
PhaseCoordinatePuzzle
PhaseCoordinatePuzzle is an implementation of SemiGroupActionPuzzle that is used to construct a view of a puzzle where all patterns are enumerable, such as:
Square-1 patterns where only the shape and parity are taken into account.
A view of 3x3x3 where only edge orientation is take into account.
A coordinate for a 4x4x4 search phase.
Since it implements SemiGroupActionPuzzle, it can itself be passed to IDFSearch.
This construction is facilitated by at SemanticCoordinate trait implementation:
This coordinate specifies the "meaning" of each pattern that will be transformed into a low-level representation (a numeric index). For example, for Square-1 phase 1 this is implemented as:
#[derive(PartialEq,Eq,Hash,Clone,Debug)]pub(crate)structSquare1Phase1Coordinate{masked_pattern:KPattern,parity:BasicParity,}implSemanticCoordinate<KPuzzle>forSquare1Phase1Coordinate{fntry_new(_kpuzzle:&KPuzzle,full_pattern:&KPattern) -> Option<Self>{if/* fails sliceability check */{returnNone;}Some(Self{
masked_pattern:/* pattern with all edges indistinguishable and all corners indistinguishable */,
parity,/* conventional permutation parity */})}}
PhaseCoordinate::new(…) enumerates the full graph of SemanticCoordinate values by:
assigning each pattern an index when it is first seen, and
building a fully cached move application table.
This is flexible and fast enough for our current prototyping, but we will want to go faster in the future. This can (and should) allow for more optimized mathematical implementations when possible, particularly for some 4x4x4 phases.
Composing PhaseCoordinatePuzzles
PhaseCoordinatePuzzle is designed to be composed. For example, for Square-1 phase 2 we implement SemanticCoordinate for three independent views of the square-square puzzle, and then compose them as follows:
While the APIs are designed to allow automatic/ergonomic connection of multiple phases of searching, this currently requires the implementation to manually call multiple IDFSearch implementations.
The text was updated successfully, but these errors were encountered:
Generic IDFS
SemiGroupActionPuzzle
Originally,
twsearch
assumed that:KPuzzle
, andKPuzzle
conveniences were available, including composable and invertible transformations.This has now mostly been replaced by the
SemiGroupActionPuzzle
trait. It has this name because its operation are closest to a semigroupaction (compared to the full
group action of
KPuzzle
):This is implemented for
KPuzzle
, and can be implemented for various otherpuzzles. In particular, it is also implemented for specific phases of puzzle
searches so that they can use different:
All the methods on
SemiGroupActionPuzzle
take a&self
parameter in order to allow information (such as implementation-specific lookup tables) to be stored on the implementation.A vestigial
GroupActionPuzzle
trait remains, but it is essentially unused at the moment. It may become useful in the future when generalizingKPuzzle
-specific optimizations to more puzzles.TPuzzle
By convention, the generic type of puzzle implementing
SemiGroupActionPuzzle
is called aTPuzzle
(sinceT
is a common name for such a type). For example:IDFSearch
The core engine of every search is
IDFSearch
, an iterative deepeningdepth-first search, which takes a
TPuzzle
generic. It also takes a secondgeneric struct that allows for the "zero-cost" abstraction of compile-time
dispatch for search optimizations:
The generics on
IDFSearch
default toKPuzzle
with aHashPruneTable
. Also note that the name "optimizations" should probably also be revised, as (for example) bandaged puzzles may rely on them for correctness.PhaseCoordinatePuzzle
PhaseCoordinatePuzzle
is an implementation ofSemiGroupActionPuzzle
that is used to construct a view of a puzzle where all patterns are enumerable, such as:Since it implements
SemiGroupActionPuzzle
, it can itself be passed toIDFSearch
.This construction is facilitated by at
SemanticCoordinate
trait implementation:This coordinate specifies the "meaning" of each pattern that will be transformed into a low-level representation (a numeric index). For example, for Square-1 phase 1 this is implemented as:
PhaseCoordinate::new(…)
enumerates the full graph ofSemanticCoordinate
values by:This is flexible and fast enough for our current prototyping, but we will want to go faster in the future. This can (and should) allow for more optimized mathematical implementations when possible, particularly for some 4x4x4 phases.
Composing
PhaseCoordinatePuzzle
sPhaseCoordinatePuzzle
is designed to be composed. For example, for Square-1 phase 2 we implementSemanticCoordinate
for three independent views of the square-square puzzle, and then compose them as follows:Composing multiple phases
While the APIs are designed to allow automatic/ergonomic connection of multiple phases of searching, this currently requires the implementation to manually call multiple
IDFSearch
implementations.The text was updated successfully, but these errors were encountered: