RM: aging, minor edits
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
This commit is contained in:
parent
d91dded858
commit
1c85bee091
@ -40,6 +40,7 @@ bool DestructionPower::RemoveConstraintOnPosition(const coor constraintCoordinat
|
|||||||
void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate) {
|
void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate) {
|
||||||
|
|
||||||
for (int i = 0; i < DESTRUCTION_COUNT; ++i) {
|
for (int i = 0; i < DESTRUCTION_COUNT; ++i) {
|
||||||
|
|
||||||
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray.push_back(0);
|
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray.push_back(0);
|
||||||
int divisor=0;
|
int divisor=0;
|
||||||
if(constraintCoordinate.row > 0)
|
if(constraintCoordinate.row > 0)
|
||||||
@ -57,6 +58,9 @@ void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate)
|
|||||||
else
|
else
|
||||||
//create default destructionPower //TODO find some better solution for default
|
//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];
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,23 +105,21 @@ bool AbstractionLayer_Histogram::PlaceOfPartGood(coor myCoor, Mat& myPart)
|
|||||||
|
|
||||||
HistogramComparer localComparer;
|
HistogramComparer localComparer;
|
||||||
//sets coordinates to correct position for layer
|
//sets coordinates to correct position for layer
|
||||||
myCoor.row++;
|
|
||||||
myCoor.col++;
|
|
||||||
|
|
||||||
if( myCoor.row == 1 && myCoor.col == 1){return true;}
|
if( myCoor.row == 0 && myCoor.col == 0){return true;}
|
||||||
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)){
|
if(localComparer.CompareHistogram(m_constraintMatrix[myCoor.col][myCoor.row-1].image, myPart)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else return false;
|
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)){
|
if(localComparer.CompareHistogram(m_constraintMatrix[myCoor.col-1][myCoor.row].image, myPart)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else return false;
|
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) &&
|
if( localComparer.CompareHistogram(m_constraintMatrix[myCoor.col][myCoor.row-1].image, myPart) &&
|
||||||
localComparer.CompareHistogram(m_constraintMatrix[myCoor.col-1][myCoor.row].image, myPart)){
|
localComparer.CompareHistogram(m_constraintMatrix[myCoor.col-1][myCoor.row].image, myPart)){
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,8 +35,6 @@ bool next(vector<LogEntry>& log,Puzzle& puzzleMat)
|
|||||||
setsolution(log,puzzleMat);
|
setsolution(log,puzzleMat);
|
||||||
else
|
else
|
||||||
setsolution(log,puzzleMat);
|
setsolution(log,puzzleMat);
|
||||||
if(log.back().myCoor.row==26)
|
|
||||||
cout << log.back().myCoor.row << ", " << log.back().myCoor.col << endl;
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -81,7 +79,7 @@ void solve(vector<LogEntry>& log,Puzzle& puzzleMat)
|
|||||||
case 0://pömpel
|
case 0://pömpel
|
||||||
puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector);
|
puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector);
|
||||||
break;
|
break;
|
||||||
case 1://
|
case 1://histogram
|
||||||
puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
|
puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
|
||||||
break;
|
break;
|
||||||
case -1://random
|
case -1://random
|
||||||
@ -111,8 +109,6 @@ void setsolution(vector<LogEntry>& log, Puzzle& puzzleMat)
|
|||||||
puzzleMat.combinedQualityVector.clear(); //clear data from temp variable
|
puzzleMat.combinedQualityVector.clear(); //clear data from temp variable
|
||||||
//tell log entry that it is set
|
//tell log entry that it is set
|
||||||
log.back().Set();
|
log.back().Set();
|
||||||
if(log.back().myCoor.row==27)
|
|
||||||
cout << "hello" << endl;
|
|
||||||
puzzleMat.setConstraints(log.back().myCoor,log.back().PieceCollector.begin()->second);
|
puzzleMat.setConstraints(log.back().myCoor,log.back().PieceCollector.begin()->second);
|
||||||
//cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl;
|
//cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user