removed calls to other layers to get into solver
problem with imread in preprocess when multiple layers make call. This was subv. by deactivating these layers.
This commit is contained in:
@ -65,23 +65,23 @@ void Puzzle::shuffle()
|
||||
//deletes all constraints from all abstractionlayers
|
||||
void Puzzle::removeConstrains(coor removeCoordinates)
|
||||
{
|
||||
this->a1.RemoveConstraintOnPosition(removeCoordinates);
|
||||
this->a3.RemoveConstraintOnPosition(removeCoordinates);
|
||||
// this->a1.RemoveConstraintOnPosition(removeCoordinates);
|
||||
// this->a3.RemoveConstraintOnPosition(removeCoordinates);
|
||||
this->a4.RemoveConstraintOnPosition(removeCoordinates);
|
||||
//TODO!! Add other layer remove here
|
||||
}
|
||||
void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
|
||||
{
|
||||
//dp
|
||||
this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.clear();
|
||||
for(auto it:this->tmp_destructionArray)
|
||||
this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.emplace_back(it);
|
||||
// this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.clear();
|
||||
// for(auto it:this->tmp_destructionArray)
|
||||
// this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.emplace_back(it);
|
||||
|
||||
//a1
|
||||
this->a1.SetConstraintOnPosition(setConstraints,constraintPiece->m_a1);
|
||||
//this->a1.SetConstraintOnPosition(setConstraints,constraintPiece->m_a1);
|
||||
|
||||
//a3
|
||||
this->a3.SetConstraintOnPosition(setConstraints,constraintPiece->m_a3);
|
||||
//this->a3.SetConstraintOnPosition(setConstraints,constraintPiece->m_a3);
|
||||
|
||||
//a4
|
||||
this->a4.SetConstraintOnPosition(setConstraints,constraintPiece->m_a4);
|
||||
@ -187,7 +187,6 @@ Mat Puzzle::resultImage( vector<LogEntry>& log){
|
||||
|
||||
sprintf(name, PATH, imageNumber);
|
||||
Mat img = imread(name, 1);
|
||||
|
||||
copyMakeBorder(img,img,200,200,200,200,BORDER_CONSTANT,Scalar(255,255,255));
|
||||
Mat invert = Mat::ones(img.size(), CV_8UC3); // invert for rotation to work correctly
|
||||
bitwise_not ( img, invert );
|
||||
|
@ -43,7 +43,7 @@ void createNextLogElement(vector<LogEntry>& log, Puzzle& puzzleMat)
|
||||
{
|
||||
log.emplace_back(LogEntry(coor(0, 0)));
|
||||
log.back().myCoor = calculateNextCoor(log, puzzleMat);
|
||||
puzzleMat.dp.DestructionOfSurrounding(log.back().myCoor);//calculate dp from surrounding
|
||||
// puzzleMat.dp.DestructionOfSurrounding(log.back().myCoor);//calculate dp from surrounding
|
||||
//get all not set pieces
|
||||
for(auto it:puzzleMat.p_myBox)
|
||||
if(!it->set)
|
||||
@ -78,13 +78,15 @@ void solve(vector<LogEntry>& log,Puzzle& puzzleMat)
|
||||
switch(log.back().abstractionLevel)
|
||||
{
|
||||
case 0://pömpel
|
||||
puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector);
|
||||
puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
|
||||
//puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector);
|
||||
break;
|
||||
case 1://poempelposition
|
||||
return;
|
||||
puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
|
||||
break;
|
||||
case 4://SURFFeature
|
||||
puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
|
||||
|
||||
break;
|
||||
case -1://random
|
||||
cout << endl;
|
||||
@ -95,10 +97,8 @@ void solve(vector<LogEntry>& log,Puzzle& puzzleMat)
|
||||
}
|
||||
float worth = capLogElements(log);
|
||||
cout << " | " << worth << endl;
|
||||
if(worth && log.back().abstractionLevel)
|
||||
cerr << "removed something!" << endl;
|
||||
|
||||
calculateTrueDestructionPower(log,puzzleMat, worth);
|
||||
// calculateTrueDestructionPower(log,puzzleMat, worth);
|
||||
CalculateNewCombinedQuality(log, log.back().PieceCollector, puzzleMat.combinedQualityVector);
|
||||
|
||||
}
|
||||
@ -227,7 +227,7 @@ float capLogElements(vector<LogEntry>& log)
|
||||
newid = id;
|
||||
}
|
||||
}
|
||||
cut(log,newid);
|
||||
//cut(log,newid);
|
||||
|
||||
vectorsizeAfter = log.back().PieceCollector.size();
|
||||
destroyed = ((double)vectorsizeBefore - (double)vectorsizeAfter) / (double)vectorsizeBefore;
|
||||
@ -241,7 +241,11 @@ float capLogElements(vector<LogEntry>& log)
|
||||
void cut(vector<LogEntry>& log, int& cutID)
|
||||
{
|
||||
while(cutID<log.back().PieceCollector.size())
|
||||
{
|
||||
cerr << "!";
|
||||
log.back().PieceCollector.erase(log.back().PieceCollector.begin()+cutID);
|
||||
}
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
// -------------------- Part David: SetBest and CalculateCombinedQuality --------------------
|
||||
|
Reference in New Issue
Block a user