Generally speaking heuristics aim to find a good enough solution to a problem in a reasonable amount of time. These are mostly based on experiences and common sense. Metaheutistics iteratively tries to improve a candidate solution with respect to a given measure of quality.They rarely make assumptions about the problem being optimized
They can search very large spaces of candidate solutions. Whereas they do not guarantee the finding of an optimal solution. Some of the popularly used metaheuristics for optimization problems are:
• Simulated Annealing (SA),
• Particle Swarm Optimization (PSO),
• Differential Evolution (DE),
• Genetic Algorithm (GA),
• Evolutionary Strategy (ES).
This python program takes an input file and then splits it into different smaller chunks. Next it can collect all the different chunks and join it to get the original file. -------------------------------------------------------- # define the function to split the file into smaller chunks def splitFile(inputFile,chunkSize): #read the contents of the file f = open(inputFile, 'rb') data = f.read() # read the entire content of the file f.close() # get the length of data, ie size of the input file in bytes bytes = len(data) #calculate the number of chunks to be created noOfChunks= bytes/chunkSize if(bytes%chunkSize): noOfChunks+=1 #create a info.txt file for writing metadata f = open('info.txt', 'w') f.write(inputFile+','+'chunk,'+str(noOfChunks)+','+str(chunkSize)) f.close() chunkNames = [] for i in range(0, bytes+1, chunkSize): fn1 = "chunk%s...
Comments