This is an assembler class.
Public Member Functions
| ||assembler_0_c (void)|
| ||~assembler_0_c (void)|
|errState ||createMatrix (const problem_c *puz, bool keepMirror, bool keepRotations, bool complete)|
| ||the part of the initialisation that may take a while. |
|void ||assemble (assembler_cb *callback)|
| ||start the assembly process. |
|int ||getErrorsParam (void)|
| ||when createMatrix returns an error you can call this function to find out which piece is involved, or other additional information |
|virtual float ||getFinished (void) const |
| ||a function that returns the finished percentage in the range between 0 and 1. |
|virtual void ||stop (void)|
| ||stops the assembly process sometimes in the near future. |
|virtual bool ||stopped (void) const |
| ||returns true, as soon as the process really has stopped |
|virtual errState ||setPosition (const char *string, const char *version)|
| ||sets the position of the assembly process, so that it continues exactly where it stood, when getPosition was called |
|virtual void ||save (xmlWriter_c &xml) const |
| ||this function saves the current state of the assembler into an xml node to write it to an file. |
|virtual void ||reduce (void)|
| ||Try to optimize piece placement. |
|virtual unsigned int ||getReducePiece (void) const |
| ||Then running in an extra thread it is possible to find out which piece is worked on by reduce. |
|virtual unsigned long ||getIterations (void)|
| ||this function returns a number reflecting the complexity of the puzzle. |
|bool ||getPiecePlacementSupported (void) const |
|unsigned int ||getPiecePlacement (unsigned int node, int delta, unsigned int piece, unsigned char *tran, int *x, int *y, int *z) const |
|unsigned int ||getPiecePlacementCount (unsigned int piece) const |
|void ||debug_step (unsigned long num=1)|
|assembly_c * ||getAssembly (void)|
Static Public Member Functions
|static bool ||canHandle (const problem_c *p)|
Protected Member Functions
|void ||GenerateFirstRow (void)|
|int ||AddPieceNode (unsigned int piece, unsigned int rot, unsigned int x, unsigned int y, unsigned int z)|
|void ||getPieceInformation (unsigned int node, unsigned char *tran, int *x, int *y, int *z, unsigned int *pc) const |
|void ||AddVoxelNode (unsigned int col, unsigned int piecenode)|
|unsigned int ||getRows (int pos)|
|unsigned int ||getRight (int pos)|
|unsigned int ||getColCount (int pos)|
|unsigned int ||getVarivoxelStart (void)|
|unsigned int ||getPos (void)|
|assembler_cb * ||getCallback (void)|
|unsigned int ||getPiecenumber (void)|
|void ||checkForTransformedAssemblies (unsigned int pivot, mirrorInfo_c *mir)|
|const problem_c * ||puzzle|
Private Member Functions
|void ||cover (unsigned int col)|
|void ||uncover (unsigned int col)|
|void ||cover_row (register unsigned int r)|
|void ||uncover_row (register unsigned int r)|
|bool ||try_cover_row (register unsigned int r, unsigned int *columns)|
|void ||remove_row (register unsigned int r)|
|void ||reinsert_row (register unsigned int r)|
|void ||remove_column (register unsigned int c)|
|void ||solution (void)|
|void ||iterativeMultiSearch (void)|
|bool ||canPlace (const voxel_c *piece, int x, int y, int z) const |
|int ||prepare (void)|
| ||this function prepares the matrix of nodes for the recursive function I've done some additions to Knuths algorithm to implement variable voxels (empty spaces in the solution) and multiple instances of the same piece. |
|bool ||checkmatrix (void)|
|unsigned int ||clumpify (void)|
| ||assembler_0_c (const assembler_0_c &)|
|void ||operator= (const assembler_0_c &)|
|std::vector< unsigned int > ||left|
|std::vector< unsigned int > ||right|
|std::vector< unsigned int > ||upDown|
|std::vector< unsigned int > ||colCount|
|unsigned int ||pos|
|unsigned int * ||rows|
|unsigned int * ||columns|
|unsigned long ||iterations|
|unsigned int ||varivoxelStart|
|unsigned int ||varivoxelEnd|
|unsigned int ||piecenumber|
|assembler_cb * ||asm_bc|
|unsigned int ||reducePiece|
|std::vector< piecePosition > ||piecePositions|
|unsigned int ||avoidTransformedPivot|
|mirrorInfo_c * ||avoidTransformedMirror|
| ||set to true, when complete rotation analysis is requested |
This is an assembler class.
It is mor or less identical to Don Knuths idea. Some changes have been done though to provide for holes. This class can not handle ranges or multi-pieces.
All involved pieces must be there exactly one time. But in that case it is a bit faster than assembler_1.
this function prepares the matrix of nodes for the recursive function I've done some additions to Knuths algorithm to implement variable voxels (empty spaces in the solution) and multiple instances of the same piece.
Empty voxels in the result are done by removing columns from the matrix. This will prevent the algorithm from filling the corresponding voxels. But we need to have the constraints that these columns place on the solution. This is done by adding these columns to the matrix but behind the normal columns. These additional columns wont be searched by the alg. if it looks for the next task to achieve.
Multiple instances of the same piece is handles in a similar way. To prevent finding the same solution again and again with just the pieces swapping places we number the pieces and their possible placements and disallow that the position number of piece n is lower than the position number of piece n-1. This can be achieved by adding more constraint columns. There need to be one column for each
negative result show there is something wrong: the place -result has not possible position inside the result
References AddPieceNode(), mirrorInfo_c::addPieces(), addToCache(), AddVoxelNode(), voxel_c::boundX1(), voxel_c::boundX2(), voxel_c::boundY1(), voxel_c::boundY2(), voxel_c::boundZ1(), voxel_c::boundZ2(), canPlace(), checkForTransformedAssemblies(), columns, symmetries_c::countSymmetryIntersection(), GenerateFirstRow(), problem_c::getGridType(), voxel_c::getHx(), voxel_c::getHy(), voxel_c::getHz(), voxel_c::getIndex(), voxel_c::getMirrorTransform(), symmetries_c::getNumTransformations(), symmetries_c::getNumTransformationsMirror(), problem_c::getResultShape(), problem_c::getShape(), problem_c::getShapeShape(), voxel_c::getState(), gridType_c::getSymmetries(), getVarivoxelStart(), gridType_c::getVoxel(), voxel_c::getXYZ(), problem_c::partNumber(), problem_c::pieceNumber(), piecenumber, puzzle, reducePiece, voxel_c::selfSymmetries(), symmetries_c::symmetrieContainsTransformation(), symmetries_c::symmetriesLeft(), symmetries_c::symmetryContainsMirror(), voxel_c::transform(), unSymmetric, voxel_c::VX_FILLED, and voxel_c::VX_VARIABLE.
Referenced by createMatrix().
Try to optimize piece placement.
the function tries to remove possible piece placements by checking if, after the piece has been placed somewhere, that all the other pieces still can be placed and all holes can still be filled. if this is not the case then this placement can be removed
it is not necessary for an assembler to implement this function
Reimplemented from assembler_c.
References checkmatrix(), clumpify(), colCount, columns, cover(), down, piecenumber, piecePositions, reducePiece, remove_row(), right, try_cover_row(), uncover(), uncover_row(), and varivoxelEnd.
sets the position of the assembly process, so that it continues exactly where it stood, when getPosition was called
the function should only be called when assembly is not running it should be called before calling assemble
Reimplemented from assembler_c.
References ASSEMBLER_VERSION, bt_assert, columns, cover(), cover_row(), assembler_c::ERR_CAN_NOT_RESTORE_SYNTAX, assembler_c::ERR_CAN_NOT_RESTORE_VERSION, assembler_c::ERR_NONE, getInt(), getLong(), iterations, left, piecenumber, pos, and rows.