Implementation of the Genetic Algorithm (GA) and Binary Particle Swarm Optimization (PSO) on the Multiple Fault Diagnosis (MFD) problems
This repo contains the implementation of the Genetic Algorithm (GA) and Binary Particle Swarm Optimization (PSO) on the Multiple Fault Diagnosis (MFD) problems.
- fixedInput.py --- Get the input data for fitness calculation and verification
- simpleGA.py --- Implementation of GA (fitness calculation not included)
- fitnessMDF.py --- Fitness calculation based on the likelyhood function proposed by Dr. Potter from University of Georgia (Link to the paper)
- wrapperGA.py --- Combination of other essential elements of GA and generational fitness calculation
- validator.py --- Verification of whether the implementation of GA works
Note: The source of data is Dr. Potter from University of Georgia
- TendencyMatrix10x25.txt --- The likelyhood matrix and prior probability vector
- ExhaustiveResults10x25.txt --- The source for verification
Keep the file structure. In python set your local working environment to the folder "ga-pso-mfd >>Genetic_Algorithm". Run wrapperGA.py firstly, then use the classes. An example is shown as the following:
# assuming you have run wrapperGA.py
## get a manifestation vector: binary representation of integer 350
manGenerator = ManGenerator()
manVector = manGenerator.getBit(350)
## get the optimization result from GA
test = WrapperGa(1000, 1, 0.8, 0.05)
test.evolution(manVector)
## verify the GA result by comparing to
## the "truely optimized results" retrieved from ExhaustiveResults10x25.txt
vali = Validator(table)
vali.getBestDi(350)
If you have a customized fitness function, you can easily plug in your code to replace what is currently in FitnessCalc class.
- fixedInput.py --- Get the input data for fitness calculation and verification
- binaryPSO.py --- Implementation of PSO (fitness calculation not included)
- fitnessMDF.py --- Fitness calculation based on the likelyhood function proposed by Dr. Potter from University of Georgia (Link to the paper)
- wrapperPSO.py --- Combination of other essential elements of PSO and generational fitness calculation
- validator.py --- Verification of whether the implementation of PSO works
Note: The source of data is Dr. Potter from University of Georgia
- TendencyMatrix10x25.txt --- The likelyhood matrix and prior probability vector
- ExhaustiveResults10x25.txt --- The source for verification
Keep the file structure. In python set your local working environment to the folder "ga-pso-mfd >>Particle_Swarm_Optimization". Run wrapperPSO.py firstly, then use the classes. An example is shown as the following:
# assuming you have run wrapperPSO.py
## get a manifestation vector: binary representation of integer 350
manGenerator = ManGenerator()
manVector = manGenerator.getBit(350)
## get the optimization result from PSO
test = WrapperPso(300, 0.7, 2, 2)
test.fly(manVector)
## verify the PSO result by comparing to
## the "truely optimized results" retrieved from ExhaustiveResults10x25.txt
vali = Validator(table)
vali.getBestDi(350)
If you have a customized fitness function, you can easily plug in your code to replace what is currently in FitnessCalc class.