added AbstractionLayer Template
Basic layer implementation to use as a template for new layers. Including detailed ToDos.
This commit is contained in:
parent
5be9f6cbf7
commit
ec4a5da05c
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
#include "AbstractionLayer_TemplateLayer.h" //TODO: Replace every occurrence of "TemplateLayer" in this file with Layer Name
|
||||||
|
#include "../../../header.h" //TODO: add AbstractionLayer_TemplateLayer.cpp to CMakeList
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool AbstractionLayer_TemplateLayer::PreProcessing(coor mySize, const vector<Part*>* partArray)
|
||||||
|
{
|
||||||
|
//TODO: your implementation (see AbstractionLayer_Base.h for further descriptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractionLayer_TemplateLayer::EvaluateQuality (coor constraintCoordinate, qualityVector& qVector)
|
||||||
|
{
|
||||||
|
//TODO: your implementation (see AbstractionLayer_Base.h for further descriptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractionLayer_TemplateLayer::SetConstraintOnPosition(const coor constraintCoordinate,const AbstractionLayer_TemplateLayer_Properties constraint)
|
||||||
|
{
|
||||||
|
//TODO: your implementation (see AbstractionLayer_Base.h for further descriptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractionLayer_TemplateLayer::RemoveConstraintOnPosition(const coor constraintCoordinate)
|
||||||
|
{
|
||||||
|
//TODO: your implementation (see AbstractionLayer_Base.h for further descriptions)
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
|
||||||
|
#ifndef SOURCE_ABSTRACTIONLAYER_TemplateLayer_H //%TODO: Change include guards (Replace TEMPLATELAYER)
|
||||||
|
#define SOURCE_ABSTRACTIONLAYER_TemplateLayer_H
|
||||||
|
//TODO: Replace every occurrence of "TemplateLayer" in this file with Layer Name
|
||||||
|
|
||||||
|
#include "AbstractionLayer_TemplateLayer.h"
|
||||||
|
#include "../AbstraktionLayer_Base.h"
|
||||||
|
|
||||||
|
//TODO: Check which includes are necessary for your layer
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
//#include <utility>
|
||||||
|
//#include <bitset>
|
||||||
|
//#include <random>
|
||||||
|
//#include <cstdio>
|
||||||
|
//#include <cstdlib>
|
||||||
|
#include "opencv2/highgui/highgui.hpp"
|
||||||
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define PATH "..\\..\\..\\pieces\\%04d.jpg"
|
||||||
|
#elif defined __unix__
|
||||||
|
#define PATH "..//..//..//pieces//%04d.jpg"
|
||||||
|
#elif defined __APPLE__
|
||||||
|
#define PATH "..//..//..//pieces//%04d.jpg"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace cv; //for openCV functions
|
||||||
|
|
||||||
|
class AbstractionLayer_TemplateLayer : public AbstractionLayer_Base<AbstractionLayer_TemplateLayer_Properties>
|
||||||
|
{
|
||||||
|
public: //TODO: implement at least these functions ind AbstractionLayer_TemplateLayer.cpp
|
||||||
|
bool PreProcessing(coor mySize, const vector<Part*>* partArray) ;
|
||||||
|
bool EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector);
|
||||||
|
bool SetConstraintOnPosition(const coor constraintCoordinate,const AbstractionLayer_TemplateLayer_Properties constraint);
|
||||||
|
bool RemoveConstraintOnPosition(const coor constraintCoordinate);
|
||||||
|
|
||||||
|
//--------------------implemented in base class----------------------
|
||||||
|
//
|
||||||
|
// void InitialiseConstraintMatrixSize(const int32_t collumns, const int32_t rows) //TODO: overload function if special initialisation of ConstraintMatrix is needed
|
||||||
|
// {
|
||||||
|
// m_constraintMatrix = vector<vector<T>>(collumns, vector<T>(rows));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// vector<vector<T>> m_constraintMatrix{}; //<-- Matrix where the constraints of the layer will be saved
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //SOURCE_ABSTRACTIONLAYER_TemplateLayer_H
|
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
#ifndef SOURCE_ABSTRACTIONLAYER_TEMPLATELAYER_H
|
||||||
|
#define SOURCE_ABSTRACTIONLAYER_TEMPLATELAYER_H //%TODO: Change include guards (Replace TEMPLATELAYER)
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
//TODO: Replace every occurrence of "TemplateLayer" in this file with Layer Name
|
||||||
|
|
||||||
|
|
||||||
|
class AbstractionLayer_TemplateLayer_Properties
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AbstractionLayer_TemplateLayer_Properties() {}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_template_feature; //TODO: add private member variables to store relevant information for your Layer for each position or part
|
||||||
|
//TODO: (used in ConstraintMatrix and Part Vector)
|
||||||
|
friend class AbstractionLayer_TemplateLayer;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //SOURCE_ABSTRACTIONLAYER_TEMPLATELAYER_H
|
@ -0,0 +1,21 @@
|
|||||||
|
Todo for new layer:
|
||||||
|
|
||||||
|
copy and rename folder "Layer_TEMPLATE" (and files)
|
||||||
|
Check all "//TODO:" comments in these files
|
||||||
|
|
||||||
|
header add:
|
||||||
|
- add include to new abstractionlayer.h in solve.h
|
||||||
|
- add include to properties.h in input.h
|
||||||
|
|
||||||
|
code add:
|
||||||
|
- add 1 to DESTRUCTION_COUNT in destructionPower.h
|
||||||
|
- add SpeedTable information in DestructionPower.cpp
|
||||||
|
- add abstractionlayer cpp to puzzle class in solve.h
|
||||||
|
- add Properties to Piece class in input.h
|
||||||
|
|
||||||
|
- add Preprocessing in 'Preprocessing' in solve.h
|
||||||
|
- add remove call in Puzzle::removeConstraints in puzzleExtension.cpp
|
||||||
|
- add set call in Puzzle::setConstraints in puzzleExtension.cpp
|
||||||
|
- add threshold in SetBestOrMoreLayers in structure.cpp
|
||||||
|
- add EvaluateQuality to switchcase in solve in structure.cpp
|
||||||
|
- remove - removeSimilar Call from backtrack function in structure.cpp
|
Loading…
Reference in New Issue
Block a user