Exemplo n.º 1
0
def runAlgorithm(family):
    """
	Run algorithm for family.
	:param family: the requested family.
	"""
    start = datetime.now()

    # Get sigma
    sigma = hf.getFamilySigma(family)
    print('Sigma size is: {}.'.format(len(sigma)))

    # Get strings
    strings = hf.getFamilyStrings(family)
    print(
        'Total number of strings is: {}.\nGot info for running algorithm in {}.'
        .format(len(strings),
                datetime.now() - start))

    start = datetime.now()

    # Run algorithm
    algorithm = Algorithm(sigma, strings, family)
    algorithm.run()
    algorithm.print_fingerprints(sys.argv[1] + '/')

    # Record time passed.
    print('Algorithm runtime: {}.'.format(datetime.now() - start))
Exemplo n.º 2
0
from lib.algorithm import Algorithm

if __name__ == '__main__':
    algo = Algorithm(population_size=100, mutation_rate=0.1, max_generation=10000)
    algo.start()