Question: (1) Implement, in a computer language of your choice, the method of local search for solving the following instance of the knapsack problem. Maximisez
(1) Implement, in a computer language of your choice, the method of local search for solving the following instance of the knapsack problem. Maximisez = 881 +1182 +983 +1284 + 1485 + 10s6+687 +788 +1389 such that s1+282 +383 +254 +385 +486 +87+588 +389 16, 81, 82, S3, S4, 85, 86, 87, 88, 89, $10. {0,1}. Encode candidate solutions as binary vectors of the form [81, 82, 83, 84, 85, 86, 87, 88, 89, $10], employ single-bit complement moves and use the method of best improvement for neighbour selection. Submit the following assignment elements: (a) A carefully commented print-out of your program source code, and (b) the output produced by your program, containing the same formation as that tabu- lated during the lecture on Local Search (formatted according to your preference), when applied to the following initial conditions: i. The vector s(0) = [0, 1, 1, 1, 0, 0, 1, 1, 1], ii. The vector s(0) = [0, 1, 0, 1, 0, 0, 0, 1, 0].
Step by Step Solution
3.44 Rating (160 Votes )
There are 3 Steps involved in it
import numpy as np def objectivefunction... View full answer
Get step-by-step solutions from verified subject matter experts
