created Preprocessing check if true

deactivate in header.h
This commit is contained in:
Raphael Maenle 2018-01-20 11:58:32 +01:00
parent 7a3b33455d
commit 9863c8b9e8
5 changed files with 39 additions and 12 deletions

View File

@ -1,7 +1,3 @@
//
// Created by mpapa on 05.12.2017.
//
#include "AbstractionLayer_1.h" #include "AbstractionLayer_1.h"
#include "../../../header.h" #include "../../../header.h"
#include <iostream> #include <iostream>
@ -13,6 +9,7 @@ bool AbstractionLayer_1::PreProcessing(coor mySize, const vector<Part*>* partAr
const vector<Part*>& ref_partArray = *partArray; const vector<Part*>& ref_partArray = *partArray;
analyseParts analyse(mySize.row*mySize.col); analyseParts analyse(mySize.row*mySize.col);
Part buf; Part buf;
int PSum=0;
int iterator=0; int iterator=0;
if(!analyse.getImages()) if(!analyse.getImages())
{ {
@ -23,7 +20,8 @@ bool AbstractionLayer_1::PreProcessing(coor mySize, const vector<Part*>* partAr
//TODO rows and cols //TODO rows and cols
for(int i = 0; i < mySize.row*mySize.col; i++) for(int i = 0; i < mySize.row*mySize.col; i++)
{ {
unsigned char poempel = analyse.getTabs(i);; unsigned char poempel = analyse.getTabs(i);
PSum+=PoempelSum(poempel); //preprocess correct check
for (int j=0;j<4;j++) for (int j=0;j<4;j++)
{ {
ref_partArray[iterator]->m_a1.m_connections=poempel; ref_partArray[iterator]->m_a1.m_connections=poempel;
@ -32,10 +30,12 @@ bool AbstractionLayer_1::PreProcessing(coor mySize, const vector<Part*>* partAr
} }
} }
if(PREPRO_CHECK && PSum)
return false;
//Zugriff auf den vector mit den einzelnen teilen: part[0].getConnenctions() entspricht pömpel von bild 0.jpg und liefert ein unsigned char, poempl Belegung wie ausgemacht //Zugriff auf den vector mit den einzelnen teilen: part[0].getConnenctions() entspricht pömpel von bild 0.jpg und liefert ein unsigned char, poempl Belegung wie ausgemacht
InitialiseConstraintMatrixSize(mySize.col+2, mySize.row+2); //col row switched in this function InitialiseConstraintMatrixSize(mySize.col+2, mySize.row+2); //col row switched in this function
setEdgeZero(); setEdgeZero();
@ -43,6 +43,33 @@ bool AbstractionLayer_1::PreProcessing(coor mySize, const vector<Part*>* partAr
return true; return true;
} }
int AbstractionLayer_1::PoempelSum(uint8_t constraint)
{
int PoempelSum=0;
if((constraint & 0b11000000)==0b01000000)
PoempelSum--;
else if((constraint & 0b11000000)==0b10000000)
PoempelSum++;
if((constraint & 0b00110000)==0b00010000)
PoempelSum--;
else if((constraint & 0b00110000)==0b00100000)
PoempelSum++;
if((constraint & 0b00001100)==0b00000100)
PoempelSum--;
else if((constraint & 0b00001100)==0b00001000)
PoempelSum++;
if((constraint & 0b00000011)==0b00000001)
PoempelSum--;
else if((constraint & 0b00000011)==0b00000010)
PoempelSum++;
return PoempelSum;
}
//it through qualityVector and removes all that do not trigger PlaceOfPartGood //it through qualityVector and removes all that do not trigger PlaceOfPartGood
bool AbstractionLayer_1::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector) bool AbstractionLayer_1::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector)
{ {

View File

@ -55,6 +55,7 @@ public:
void shift(uint8_t& Part, int shifts); void shift(uint8_t& Part, int shifts);
void setEdgeZero(); void setEdgeZero();
int PoempelSum(uint8_t constraint);
void CreateRandomPuzzle(); void CreateRandomPuzzle();
qualityVector returnInBox(vector<Part>& PuzzleBox); qualityVector returnInBox(vector<Part>& PuzzleBox);

View File

@ -1,6 +1,3 @@
//
// Created by Raphael Maenle on 21/12/2017.
//
#include "../../header/solve.h" #include "../../header/solve.h"
#include "../../header/input.h" #include "../../header/input.h"

View File

@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <random> #include <random>
#define PREPRO_CHECK false
using namespace std; using namespace std;
#include "header/input.h" #include "header/input.h"

View File

@ -44,8 +44,9 @@ public:
bool PreProcessing() bool PreProcessing()
{ {
createBox(); createp_box(); createBox(); createp_box();
dp.PreProcessing({cols,rows}, nullptr); if(!dp.PreProcessing({cols,rows}, nullptr)) return false;
a1.PreProcessing({cols,rows}, &p_myBox); if(!a1.PreProcessing({cols,rows}, &p_myBox)) return false;
return true; return true;
} }