Question: This is how Q1 looks in the csv file: 5 -6 0 -6 3 -1 0 -1 1 Consider the following optimization problem over function

 This is how Q1 looks in the csv file: 5 -6

This is how Q1 looks in the csv file:

5 -6 0
-6 3 -1
0 -1 1

Consider the following optimization problem over function fQ(x). Q-OPT:maxx{0,1}nfQ(x)=i=1nj=1iqijxixj=xQx with xi{0,1} and coefficients qijR for 1jin. (a) Implement a function that generates N candidate solutions randomly (e.g., as binary vectors such as x1= [1,0,0,0,1,,1],x2=[0,1,1,0,1,,0],) and enumerates those using fQ(x). Your function should return top 3 solutions and the corresponding values identified through enumeration. Sample function call and the expected outputs are provided below. \[ \begin{array}{l} \text { list_soln_vals, list_soln = runEnumeration }(\text { "Q1.csv", } N=100) \\ \text { \#list_soln_vals }=[(1,0,1),(1,0,0),(0,1,0)] \\ \text { \# list_soln }=[6.0,5.0,3.0] \end{array} \] (b) Implement the vanilla Hill Climbing algorithm provided below to find a "good" solution for Q-OPT. Pick initial state s // initialize randomly x=s // set as best solution while num_iter K neighbors Pick t in neighbors (s,K) with largest f(t) of the K neighbors if f(t)f(x) x=t end if s=t num_iter = num_iter +1 Some tips on the implementation, sample function call and the expected outputs are provided below. Consider the following optimization problem over function fQ(x). Q-OPT:maxx{0,1}nfQ(x)=i=1nj=1iqijxixj=xQx with xi{0,1} and coefficients qijR for 1jin. (a) Implement a function that generates N candidate solutions randomly (e.g., as binary vectors such as x1= [1,0,0,0,1,,1],x2=[0,1,1,0,1,,0],) and enumerates those using fQ(x). Your function should return top 3 solutions and the corresponding values identified through enumeration. Sample function call and the expected outputs are provided below. \[ \begin{array}{l} \text { list_soln_vals, list_soln = runEnumeration }(\text { "Q1.csv", } N=100) \\ \text { \#list_soln_vals }=[(1,0,1),(1,0,0),(0,1,0)] \\ \text { \# list_soln }=[6.0,5.0,3.0] \end{array} \] (b) Implement the vanilla Hill Climbing algorithm provided below to find a "good" solution for Q-OPT. Pick initial state s // initialize randomly x=s // set as best solution while num_iter K neighbors Pick t in neighbors (s,K) with largest f(t) of the K neighbors if f(t)f(x) x=t end if s=t num_iter = num_iter +1 Some tips on the implementation, sample function call and the expected outputs are provided below

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 Accounting Questions!