def get_random_seed(self):
        return self._random_seed

    def get_max_imp(self):
        return self._max_imp

    def get_hmcr(self):
        return self._hmcr

    def get_par(self):
        return self._par

    def get_hms(self):
        return self._hms

    def get_mpai(self):
        return self._mpai

    def get_mpap(self):
        return self._mpap

    def maximize(self):
        return self._maximize

if __name__ == '__main__':
    obj_fun = ObjectiveFunction()
    num_processes = 1
    num_iterations = 1  # because random_seed is defined, there's no point in running this multiple times
    results = harmony_search(obj_fun, num_processes, num_iterations)
    print('Elapsed time: {}\nBest harmony: {}\nBest fitness: {}'.format(results.elapsed_time, results.best_harmony, results.best_fitness))
Exemplo n.º 2
0
    def get_max_imp(self):
        return self._max_imp

    def get_hmcr(self):
        return self._hmcr

    def get_par(self):
        return self._par

    def get_hms(self):
        return self._hms

    def get_mpai(self):
        return self._mpai

    def get_mpap(self):
        return self._mpap

    def maximize(self):
        return self._maximize


if __name__ == '__main__':
    obj_fun = ObjectiveFunction()
    num_processes = cpu_count()  # use number of logical CPUs
    num_iterations = num_processes * 5  # each process does 5 iterations
    results = harmony_search(obj_fun, num_processes, num_iterations)
    print('Elapsed time: {}\nBest harmony: {}\nBest fitness: {}'.format(
        results.elapsed_time, results.best_harmony, results.best_fitness))
Exemplo n.º 3
0
    def get_par(self):
        #TODO implement pitch adjustment rate accroding to http://scialert.net/qredirect.php?doi=jas.2013.633.638&linkid=pdf
        return self._par

    def get_hms(self):
        return self._hms

    def get_mpai(self):
        return self._mpai

    def get_mpap(self):
        #TODO remove, when it runs
        return 0.5

    def maximize(self):
        return self._maximize

from problemParser import parse_problem
from docopt import docopt
if __name__ == '__main__':
    arguments = docopt(__doc__)
    problem_instance = parse_problem(arguments['<problem_instance>'])
    obj_fun = VRPTWObjectiveFunction(arguments, problem_instance)
    num_processes = cpu_count() - 1 #use number of logical CPUs - 1 so that I have one available for use
    num_processes = 1
    num_iterations = 100
    (result, value) = (harmony_search(obj_fun, num_processes, num_iterations))
    print obj_fun.make_x_from_vector(result)
    print value
        return self._random_seed

    def get_max_imp(self):
        return self._max_imp

    def get_hmcr(self):
        return self._hmcr

    def get_par(self):
        return self._par

    def get_hms(self):
        return self._hms

    def get_mpai(self):
        return self._mpai

    def get_mpap(self):
        return self._mpap

    def maximize(self):
        return self._maximize

if __name__ == '__main__':
    obj_fun = ObjectiveFunction()
    num_processes = 1
    num_iterations = 1  # because random_seed is defined, there's no point in running this multiple times
    initial_harmonies = [[random.randint(-1000, 1000) for _ in range(2)] for _ in range(100)]
    results = harmony_search(obj_fun, num_processes, num_iterations, initial_harmonies=initial_harmonies)
    print('Elapsed time: {}\nBest harmony: {}\nBest fitness: {}'.format(results.elapsed_time, results.best_harmony, results.best_fitness))
Exemplo n.º 5
0
	
	def use_random_seed(self):
		return hasattr(self, '_random_seed') and self._random_seed
	
	def get_max_imp(self):
		return self._max_imp
		
	def get_hmcr(self):
		return self._hmcr
		
	def get_par(self):
		return self._par
		
	def get_hms(self):
		return self._hms
		
	def get_mpai(self):
		return self._mpai
	
	def get_mpap(self):
		return self._mpap
		
	def maximize(self):
		return self._maximize

if __name__ == '__main__':
	obj_fun = ObjectiveFunction()
	num_processes = cpu_count() #use number of logical CPUs
	num_iterations = num_processes * 5 #each process does 5 iterations
	print(harmony_search(obj_fun, num_processes, num_iterations))