Hillclimbing and simulated anealing algorithms

write a hillclimbing algorithm to find maximum value of function f=|13.value(v)-170| where v is the input binary variable of 40bits and one counts the number of 1’s in v. set Max at 100 and thus reset algorithm 100 times for the global maximum and print the found maximum value for each reset separated by a comma in the output.txt file.

Note:For this the output should be local maxima,global maxima and so on… example:350,170,350,170,350,170

write a Simulated Anealing algorithm to find maximum value of function f=|14.value(v)-190| where v is the input binary variable of 50bits and one counts the number of 1’s in v. set Max at 200 and thus reset algorithm 100 times for the global maximum and print the found maximum value for each reset separated by a comma in the output.txt file.

Describe how to run the code. Write the code in Python.

Tags: No tags