From 1c85bee091323a4ab3615b6baa4323d321f3b8f8 Mon Sep 17 00:00:00 2001 From: Raphael Maenle <17550607+g-spacewhale@users.noreply.github.com> Date: Fri, 19 Jan 2018 22:09:12 +0100 Subject: [PATCH] RM: aging, minor edits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aging erhöht, damit histo aufgerufen wird. histo layer matrix position verändert, damit die stimmt histo.image daten sind momentan immer NULL -> error bei Aufruf --- .../DestructionPower/DestructionPower.cpp | 4 ++++ .../LayerHistogram/AbstractionLayer_Histogram.cpp | 10 ++++------ Source/functions/solve/structure.cpp | 6 +----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp index f74d459..eeea3a8 100644 --- a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp +++ b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp @@ -40,6 +40,7 @@ bool DestructionPower::RemoveConstraintOnPosition(const coor constraintCoordinat void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate) { for (int i = 0; i < DESTRUCTION_COUNT; ++i) { + m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray.push_back(0); int divisor=0; if(constraintCoordinate.row > 0) @@ -57,6 +58,9 @@ void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate) else //create default destructionPower //TODO find some better solution for default m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i] = m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SpeedTable[i]; + //aging + if(m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i]<0.9) + m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i]=m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i]*(float)1.001+(float)0.01; } } diff --git a/Source/functions/AbstractionLayers/LayerHistogram/AbstractionLayer_Histogram.cpp b/Source/functions/AbstractionLayers/LayerHistogram/AbstractionLayer_Histogram.cpp index 380ef48..d1177c9 100644 --- a/Source/functions/AbstractionLayers/LayerHistogram/AbstractionLayer_Histogram.cpp +++ b/Source/functions/AbstractionLayers/LayerHistogram/AbstractionLayer_Histogram.cpp @@ -105,23 +105,21 @@ bool AbstractionLayer_Histogram::PlaceOfPartGood(coor myCoor, Mat& myPart) HistogramComparer localComparer; //sets coordinates to correct position for layer - myCoor.row++; - myCoor.col++; - if( myCoor.row == 1 && myCoor.col == 1){return true;} - else if(myCoor.col == 1 && myCoor.row >1){ + if( myCoor.row == 0 && myCoor.col == 0){return true;} + else if(myCoor.col == 0 && myCoor.row >0){ if(localComparer.CompareHistogram(m_constraintMatrix[myCoor.col][myCoor.row-1].image, myPart)){ return true; } else return false; } - else if( myCoor.row == 1 && myCoor.col >1){ + else if( myCoor.row == 0 && myCoor.col >0){ if(localComparer.CompareHistogram(m_constraintMatrix[myCoor.col-1][myCoor.row].image, myPart)){ return true; } else return false; } - else if (myCoor.col > 1 && myCoor.row >1){ + else if (myCoor.col > 0 && myCoor.row >0){ if( localComparer.CompareHistogram(m_constraintMatrix[myCoor.col][myCoor.row-1].image, myPart) && localComparer.CompareHistogram(m_constraintMatrix[myCoor.col-1][myCoor.row].image, myPart)){ return true; diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 3beec78..240e204 100755 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -35,8 +35,6 @@ bool next(vector& log,Puzzle& puzzleMat) setsolution(log,puzzleMat); else setsolution(log,puzzleMat); - if(log.back().myCoor.row==26) - cout << log.back().myCoor.row << ", " << log.back().myCoor.col << endl; return true; } @@ -81,7 +79,7 @@ void solve(vector& log,Puzzle& puzzleMat) case 0://pömpel puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector); break; - case 1:// + case 1://histogram puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); break; case -1://random @@ -111,8 +109,6 @@ void setsolution(vector& log, Puzzle& puzzleMat) puzzleMat.combinedQualityVector.clear(); //clear data from temp variable //tell log entry that it is set log.back().Set(); - if(log.back().myCoor.row==27) - cout << "hello" << endl; puzzleMat.setConstraints(log.back().myCoor,log.back().PieceCollector.begin()->second); //cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl; }