I am searching for a simple hill climbing Algorithm
It is for a large scale simulation, This is an example of how the "CurrentLocation" is changing.
import time
targ = 1.5 # target of t
location = 1 #starting point
step = 0.9 # step change starting point
a=0
b=0
while abs(targ-location)>0.05:
if targ>location:
if b==1: # If I already been at b
b=0
a=0
step = step*(0.9)
print 'stepChangeA'
location =location + abs(location*step)
else:
location =location + abs(location*step)
a=1
print 'increase'
else:
if a==1: #If I already been at a
a=0
b=0
step = step*(0.9)
print 'stepChangeB'
location =location - abs(location*step)
else:
location = location - abs(location*step)
b=1
print 'decrease'
time.sleep(0.1) # just so it will be easy to see the change..
print location
The algorithm that I presented is working, But I feel that there most be something more effective... any advise ?
Thank You