beforemerge

This commit is contained in:
Raphael Maenle
2017-12-22 22:55:55 +01:00
parent bfed4aba05
commit edd3c8620b
7 changed files with 195 additions and 22 deletions

View File

@ -11,9 +11,9 @@ map<int,float> DestructionPower_Properties::SpeedTable =
};
void DestructionPower::PreProcessing(const vector<Part*>* partArray)
void DestructionPower::PreProcessing(coor mySize,const vector<Part*>* partArray)
{
InitialiseConstraintMatrixSize(32,28);
InitialiseConstraintMatrixSize(mySize.row,mySize.col);
}
//it through qualityVector and removes all that do not trigger PlaceOfPartGood
@ -48,6 +48,35 @@ void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate)
newDestructionArray[i] /=divisor;
}
}
//gets next highest valued abstraction layer down from current one (if first, get highest)
int DestructionPower::getNextAbstractionLayer(coor newCoordinate, int currentAbstractionLayer)
{
float currentPower=-1;
int nextLayer=-1;
float nextLayerPower=0;
if (currentAbstractionLayer>=0)
currentPower = m_constraintMatrix[newCoordinate.row][newCoordinate.col].DestructionArray[currentAbstractionLayer];
int i=0;
for(float it:m_constraintMatrix[newCoordinate.row][newCoordinate.col].DestructionArray)
{
if(it <= currentPower)
{
//if equal, then has to be the next one (activated from left to right)
if(it == currentPower)
if(i>currentAbstractionLayer)
return i;
//if this one is bigger than previous biggest one, save
if(it>nextLayerPower)
{
nextLayerPower=it;
nextLayer=i;
}
i++;
}
}
return nextLayer;
}
DestructionPower_Properties::DestructionPower_Properties() {
float aging=1.001;
@ -57,4 +86,4 @@ DestructionPower_Properties::DestructionPower_Properties() {
DestructionArray.emplace_back((DestructionPower_Properties::SpeedTable[i]*DESTRUCTION_INIT));
DestructionArray.back()<0.99 ? DestructionArray.back()*=aging:DestructionArray.back();
}
}
}

View File

@ -17,12 +17,14 @@
class DestructionPower : public AbstractionLayer_Base<DestructionPower_Properties>
{
public:
void PreProcessing(const vector<Part*>* partArray) override;
void PreProcessing(coor mySize,const vector<Part*>* partArray)override;
bool EvaluateQuality (coor constraintCoordinate, qualityVector& qVector) override;
bool SetConstraintOnPosition(coor constraintCoordinate, AbstractionLayer_1_Properties constraint);
bool RemoveConstraintOnPosition(coor constraintCoordinate)override;
void DestructionOfSurrounding(coor constraintCoordinate);
int getNextAbstractionLayer(coor newCoordinate, int currentAbstractionLayer);
private:
};