Question: Modify the code in the hill_climbing file. The main.py is just for your reference so you know what is going on, I have two files

Modify the code in the hill_climbing file. The main.py is just for your reference so you know what is going on, I have two files in my python project. hill_climbing.py and main.py. I'm also reading in csv files for boards. This is a modified sliding tiles puzzle. I want to modify my code so that I can run the code in the command line as follows. The two parameters in the command line are the file where the board is and the number of seconds to run the algorithm. Example : python hill_climbing.py board1.csv 10

You can find what the output is supposed to be in the code.

I also want to modify my code such that random restarts occur if the same iterations are being run again and again. This should happen if the algorithm gets stuck at a particular hill. ll the adjacent moves after the first move are to be explored until the specified time is up.

The simulated annealing is to be done accepting boards that are upto 20% worse than the current board by the heuristic parameters in my code.

The code needs to be modified, not rewritten.

main.py

Modify the code in the hill_climbing file. The main.py is just for

your reference so you know what is going on, I have twofiles in my python project. hill_climbing.py and main.py. I'm also reading incsv files for boards. This is a modified sliding tiles puzzle. Iwant to modify my code so that I can run the codein the command line as follows. The two parameters in the commandhill_climbing.pyline are the file where the board is and the number ofseconds to run the algorithm. Example : python hill_climbing.py board1.csv 10 Youcan find what the output is supposed to be in the code.I also want to modify my code such that random restarts occur

if the same iterations are being run again and again. This should

legalMoves. append ([ row, col +1, row, col ], str( board [ row ][col+1])+ Left" ]) \#print (str (board [ row ][ col +1])+ "Left") return legalMoves def move(board, moveTuple): new_board = board . copy ( ) new_board[moveTuple[2] [moveTuple[3]] = new_board[moveTuple [0]][moveTuple [1]] new_board [moveTuple [0] [ moveTuple [1] ]=0 return new_board \# Press the green button in the gutter to run the script. if if len(sys.argv) >4 or len(sys.argv)

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!