added destructionPower as abstractionLayer
This commit is contained in:
@ -0,0 +1,44 @@
|
||||
//
|
||||
// Created by mpapa on 05.12.2017.
|
||||
//
|
||||
|
||||
#include "DestructionPower.h"
|
||||
#include <iostream>
|
||||
|
||||
void DestructionPower::PreProcessing(const vector<Part*>* partArray)
|
||||
{
|
||||
InitialiseConstraintMatrixSize(32,28);
|
||||
}
|
||||
|
||||
//it through qualityVector and removes all that do not trigger PlaceOfPartGood
|
||||
bool DestructionPower::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector)
|
||||
{
|
||||
}
|
||||
|
||||
bool DestructionPower::SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_1_Properties constraint)
|
||||
{
|
||||
}
|
||||
|
||||
bool DestructionPower::RemoveConstraintOnPosition(const coor constraintCoordinate)
|
||||
{
|
||||
}
|
||||
|
||||
//gets destruction power from left and from top if possibe and normalizes
|
||||
void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate) {
|
||||
float newDestructionArray[DESTRUCTION_COUNT];
|
||||
for (int i = 0; i < DESTRUCTION_COUNT; ++i) {
|
||||
int divisor=0;
|
||||
if(constraintCoordinate.row > 0)
|
||||
{
|
||||
divisor++;
|
||||
newDestructionArray[i] += m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row-1].m_destruction.DestructionArray[i];
|
||||
}
|
||||
if(constraintCoordinate.col > 0)
|
||||
{
|
||||
divisor++;
|
||||
newDestructionArray[i] += m_constraintMatrix[constraintCoordinate.col-1][constraintCoordinate.row].m_destruction.DestructionArray[i];
|
||||
}
|
||||
if(divisor)
|
||||
newDestructionArray[i] /=divisor;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Created by mpapa on 05.12.2017.
|
||||
//
|
||||
|
||||
#ifndef SOURCE_ABSTRACTIONLAYER_1_H
|
||||
#define SOURCE_ABSTRACTIONLAYER_1_H
|
||||
|
||||
#define DESTRUCTION_INIT 0.5
|
||||
#define DESTRUCTION_COUNT 1
|
||||
|
||||
#include "../AbstraktionLayer_Base.h"
|
||||
#include "DestructionPower_Properties.h"
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <random>
|
||||
|
||||
class DestructionPower : public AbstraktionLayer_Base<DestructionPower_Properties>
|
||||
{
|
||||
public:
|
||||
void PreProcessing(const vector<Part*>* partArray);//override
|
||||
bool EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector);
|
||||
bool SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_1_Properties constraint);
|
||||
bool RemoveConstraintOnPosition(const coor constraintCoordinate);
|
||||
|
||||
void DestructionOfSurrounding(const coor constraintCoordinate);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif //SOURCE_ABSTRACTIONLAYER_1_H
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by mpapa on 05.12.2017.
|
||||
//
|
||||
|
||||
#ifndef SOURCE_ABSTRACTIONLAYER_1_PROPERTIES_H
|
||||
#define SOURCE_ABSTRACTIONLAYER_1_PROPERTIES_H
|
||||
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "DestructionPower.h"
|
||||
|
||||
class DestructionPower_Properties
|
||||
{
|
||||
public:
|
||||
DestructionPower_Properties()
|
||||
{
|
||||
for(int i=0;i<DestructionArray.size();i++)
|
||||
DestructionArray[i]=(map[i]*DESTRUCTION_INIT);
|
||||
|
||||
}
|
||||
private:
|
||||
float DestructionArray[DESTRUCTION_COUNT];
|
||||
static map<int,float> SpeedTable = create_SpeedTable;
|
||||
friend class DestructionPower;
|
||||
|
||||
static map<int,float> create_SpeedTable(){
|
||||
map<int, float> m;
|
||||
m[1] = 0.001;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif //SOURCE_ABSTRACTIONLAYER_1_PROPERTIES_H
|
Reference in New Issue
Block a user