changed name of layer 1 to layer 0

and slightly modified speedtable: hard coded inverse to make calculation easier
This commit is contained in:
Raphael Maenle 2018-01-08 18:44:32 +01:00
parent c0f0417d3b
commit ab2741a743
3 changed files with 13 additions and 11 deletions

View File

@ -5,9 +5,11 @@
#include "DestructionPower.h"
//TODO! Add more layers here!
//sets relations of speed for the different layers
map<int,float> DestructionPower_Properties::SpeedTable =
{
{1,0.001}
{0,0.99}
};
@ -53,7 +55,7 @@ void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate)
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i] /=divisor;
else
//create default destructionPower //TODO find some better solution for default
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i] =1-m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SpeedTable[i+1];
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i] =1-m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SpeedTable[i];
}
}

View File

@ -96,7 +96,7 @@ void setsolution(vector<LogEntry>& log, Puzzle& puzzleMat)
{
//advance number of randomed part count
if(log.back().PieceCollector.size()>1) log.back().advanceRandomed();
//'set=true' all 4 rotations of pieces in puzzleBox
for(int i=0;i<puzzleMat.p_myBox.size();i++)
if(puzzleMat.p_myBox[i]->GetPartID()==log.back().PieceCollector.begin()->second->GetPartID())
@ -152,7 +152,7 @@ bool backtrack(vector<LogEntry>& log, Puzzle& puzzleMat)
void calculateTrueDestructionPower(vector<LogEntry>& log, Puzzle& puzzleMat, float Layerworth) {
float destructionPower = sqrt(
Layerworth * puzzleMat.dp.m_constraintMatrix[0][0].SpeedTable[log.back().abstractionLevel+1]);
Layerworth * puzzleMat.dp.m_constraintMatrix[0][0].SpeedTable[log.back().abstractionLevel]);
//save destructionArray for when coor is done
if(puzzleMat.tmp_destructionArray.empty())
@ -232,13 +232,13 @@ bool SetBestOrMoreLayersArithmetical(vector<LogEntry>& log, qualityVector& cqVec
}
else
{
switch(log.back().abstractionLevel+1)
switch(log.back().abstractionLevel)
{
case 1: threshold = 0.90; break;
case 2: threshold = 0.80; break;
case 3: threshold = 0.75; break;
case 4: threshold = 0.66; break;
case 5: threshold = 0.60; break;
case 0: threshold = 0.90; break;
case 1: threshold = 0.80; break;
case 2: threshold = 0.75; break;
case 3: threshold = 0.66; break;
case 4: threshold = 0.60; break;
default: threshold = 0.5; break;
}

View File

@ -5,7 +5,7 @@ int LogEntry::randomed(0);
int main()
{
unsigned int cols=9,rows=8;
unsigned int cols=4,rows=5;
vector<LogEntry> log;
Puzzle puzzleMat(cols, rows);