Question: (java programming question) Implement Randomized Hill Climbing and apply it to a minimization problem involving the following function f: with x,y[6,+6] Your procedure should be

(java programming question)

Implement Randomized Hill Climbing and apply it to a minimization problem involving the following function f:

(java programming question) Implement Randomized Hill Climbing and apply it to a

with x,y[6,+6]

Your procedure should be called RHC and have the following input parameters:

  • sp: is the starting point[1] of the Randomized Hill Climbing run
  • p the number of neighbors of the current solution that will be generated
  • z neighborhood size; for example if z is set to z=0.5 p neighbors for the current solution s are generated by adding vectors v=(z1,z2) with z1 and z2 being random numbers in [-0.5,+0.5] uniformly distributed
  • seed which is an integer that will be used as the seed[2] for the random generator you employ in your implementation.

RHC returns a vector (x,y) the value of f(x,y) and the number solutions that were generated during the run of RHC.

Run your randomized hill climbing procedure RHC twice[3] for the following parameters:

sp= (2.9, 3.2), (-2.5,+3.2), (4.2,-2) and (0,0)

p= 30 and 120

z= 0.03 and z=0.1

For each of the 32 runs report:

a. the best solution (x,y) found and its value for f

b. number of solutions generated during the run[4].

Summarize your results; for each p and z combination[5]. Interpret the obtained results evaluating solution quality, algorithm speed, impact of sp, p, and z on solution quality and algorithm speed. Do you believe with other values for p and r better results could be accomplished? At last, assess if RHC did a good, medium or bad job in computing a (local) minimum for f.

[1] A vector (x,y) with x,y[-6,+6]

[2] If you run RHC with the same values for sp, p, z and seed it will always return the same solution; if you run is with the same values for sp, p, z and a different seed, it likely will return a different solution and the number of solutions searched is almost always different.

[3] Make sure you use a different seed for your random generator to get a different sequence of random numbers for the 2 runs!

[4] Count the number of times function f is called during the search

[5] (30,0.03), (120,0.1), (30, 0.1), (120,0.03)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!