beforemerge
This commit is contained in:
@ -26,7 +26,7 @@ public:
|
||||
* @brief pure virtual method for the pre processing of the layer
|
||||
* @param [in] partArray - References of all Parts, in which the properties of the Layer will be written
|
||||
*/
|
||||
virtual void PreProcessing(const vector<Part*>* partArray) = 0;
|
||||
virtual void PreProcessing(coor mySize, const vector<Part*>* partArray) = 0;
|
||||
|
||||
/**
|
||||
* @brief pure virtual method for the quality evaluation of the layer
|
||||
@ -58,7 +58,7 @@ public:
|
||||
* @param [in] collumns - Wished collumns of the m_constraintMatrix
|
||||
* @param [in] rows - Wished rows of the m_constraintMatrix
|
||||
*/
|
||||
virtual void InitialiseConstraintMatrixSize(const int32_t collumns, const int32_t rows)
|
||||
void InitialiseConstraintMatrixSize(const int32_t collumns, const int32_t rows)
|
||||
{
|
||||
m_constraintMatrix = vector<vector<T>>(collumns, vector<T>(rows));
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
};
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void AbstractionLayer_1::PreProcessing(const vector<Part*>* partArray)
|
||||
void AbstractionLayer_1::PreProcessing(coor mySize, const vector<Part*>* partArray)
|
||||
{
|
||||
InitialiseConstraintMatrixSize(32+2, 28+2);
|
||||
InitialiseConstraintMatrixSize(mySize.row+2, mySize.col+2);
|
||||
setEdgeZero();
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ void AbstractionLayer_1::setEdgeZero()
|
||||
{
|
||||
for(int col=0;col<m_constraintMatrix.size();col++)
|
||||
for(int row=0;row<m_constraintMatrix[col].size();row++)
|
||||
if(col ==0 || col == m_constraintMatrix.size() || row == 0 || row == m_constraintMatrix[col].size())
|
||||
if(col ==0 || col == m_constraintMatrix.size()-1 || row == 0 || row == m_constraintMatrix[col].size()-1)
|
||||
m_constraintMatrix[col][row].m_connections=0b00000000;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
class AbstractionLayer_1 : public AbstractionLayer_Base<AbstractionLayer_1_Properties>
|
||||
{
|
||||
public:
|
||||
void PreProcessing(const vector<Part*>* partArray);//override
|
||||
void PreProcessing(coor mySize, const vector<Part*>* partArray) final;
|
||||
bool EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector);
|
||||
bool SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_1_Properties constraint);
|
||||
bool RemoveConstraintOnPosition(const coor constraintCoordinate);
|
||||
|
Reference in New Issue
Block a user