From 4ed991539dee69a93f900ac9835fcb7536f7c0f6 Mon Sep 17 00:00:00 2001 From: Raphael Maenle <17550607+g-spacewhale@users.noreply.github.com> Date: Sat, 27 Jan 2018 18:07:42 +0100 Subject: [PATCH] poempelfind broken --- .../DestructionPower/DestructionPower.h | 2 +- Source/functions/solve/structure.cpp | 23 ++++++++++++------- Source/header/solve.h | 1 + 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h index f51fc35..288af80 100644 --- a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h +++ b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h @@ -1,6 +1,6 @@ #pragma once //TODO!! increase Destructioncount -#define DESTRUCTION_COUNT 2 +#define DESTRUCTION_COUNT 3 #include "DestructionPower_Properties.h" #include "../AbstraktionLayer_Base.h" diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 5fab820..29a2fb0 100755 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -71,8 +71,10 @@ coor calculateNextCoor(vector& log, Puzzle& puzzleMat) void solve(vector& log,Puzzle& puzzleMat) { - log.back().abstractionLevel = puzzleMat.dp.getNextAbstractionLayer(log.back().myCoor,log.back().abstractionLevel); //sets in abstractionLevel - //status(log,p_Box,puzzleMat); + log.back().abstractionLevel = puzzleMat.dp.getNextAbstractionLayer(log.back().myCoor,log.back().abstractionLevel); //sets in abstractionLevel + cout << "a: " << log.back().abstractionLevel << endl; + + //status(log,p_Box,puzzleMat); //TODO!! Add more layers here switch(log.back().abstractionLevel) { @@ -80,7 +82,7 @@ void solve(vector& log,Puzzle& puzzleMat) puzzleMat.a1.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); //puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector); break; - case 2://SURFFeature + case 1://SURFFeature // return; puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); break; @@ -88,8 +90,8 @@ void solve(vector& log,Puzzle& puzzleMat) return; puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); break; - case 1://color - puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); + case 2://color + puzzleMat.acm.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); break; case -1://random setsolution(log,puzzleMat); @@ -185,7 +187,7 @@ float capLogElements(vector& log) { // Till Now only ground structure -> incorrect variable ans vector names - double limit = 0.6; + double limit = 0.9; double diff = 0; int id=0; @@ -211,6 +213,10 @@ float capLogElements(vector& log) if(id>0) newid = --id; //set to the one just over limit + + cut(log,++newid);//this only for test + return 1;//this only for test + while(id<(log.back().PieceCollector.size()-1)) //find maximum difference in function { if(!log.back().PieceCollector[id].first) @@ -223,8 +229,7 @@ float capLogElements(vector& log) newid = id; } } - if(log.back().abstractionLevel==0) - cut(log,newid); + cut(log,newid); vectorsizeAfter = log.back().PieceCollector.size(); destroyed = ((double)vectorsizeBefore - (double)vectorsizeAfter) / (double)vectorsizeBefore; @@ -244,6 +249,7 @@ void cut(vector& log, int& cutID) // geeignete Threshold values muessen noch getestet werden bool SetBestOrMoreLayersArithmetical(vector& log, qualityVector& cqVector) { + return false; float threshold, tempBest = 0.0; unsigned int countHigherThreshold = 0; @@ -315,6 +321,7 @@ void CalculateNewCombinedQuality(vector& log, qualityVector& qVector, if (cqVector.at(i).second->GetPartID() == qVector.at(j).second->GetPartID() && cqVector.at(i).second->GetNumOfRotations() == qVector.at(j).second->GetNumOfRotations()) { // sum Quality of PieceCollector (qualityVector) to combinedQualityVector cqVector.at(i).first += qVector.at(j).first; + qVector.at(j).first = cqVector.at(i).first/DESTRUCTION_COUNT; countSummarizedVectors++; removePart=false; break; // skip remaining for loop => save time! diff --git a/Source/header/solve.h b/Source/header/solve.h index 707c560..5962e7c 100755 --- a/Source/header/solve.h +++ b/Source/header/solve.h @@ -49,6 +49,7 @@ public: if(!a1.PreProcessing({cols,rows}, &p_myBox)) return false; if(!a3.PreProcessing({cols,rows}, &p_myBox)) return false; if(!a4.PreProcessing({cols,rows}, &p_myBox)) return false; + if(!acm.PreProcessing({cols,rows}, &p_myBox)) return false; return true; }