C++ easy work
Budget: $30 – $250 CAD
We can get better results by enabling numerous hill climbers to search in simultaneously, because a single hill climber isn't particularly sophisticated. We'll do this by giving each climber their own thread.
So, here's how we'll formulate our hill-climbing algorithm:
1) We'll have a global "best answer so far" notion. This will include the lowest minimum thus far, as well as the x and y values that produced it. You could want to set the lowest minimum to something unnaturally high and then leave it to the algorithm. climbers to set it up properly for you right away.
2) A menu will appear, prompting the user to select the number of climbers (threads) to run.
3) The user will be presented with a menu asking for the number of climbers (threads) to run concurrently. You can assume a maximum of 8 climbers/threads if the user selects 0.
4) Each climber has a current position (with corresponding current calculated height) • Each climber will generate four possible moves at each step The best possible move (i.e. the one that generates the lowest calculated value) is the climber's possible next move If the generated value would improve on the climber's current calculated height, make the move
5) Otherwise, randomise the climber's position within the established [-512..+512] domain and rec
Whenever a climber discovers a new global best minimum, the global "best answer so far" is updated. Of course, this will necessitate some form of mutual exclusion.
6) When the user presses ctrl+c, execution is halted and the user is returned to the menu.
If the user selects a number of threads to try again, the "global best" thus far is not lost.
7)At the very least, whenever the user presses ctrl+c to suspend, the "global best" height (and corresponding x and y) thus far must be displayed. You may also want to include support for SIGUSR1, which allows you to display the current progress without pausing the search.
The ability of the climber to improve its results is heavily influenced by how you generate your possible moves from a given position.
Consider adding two random modifiers (one for x and one for y) in the range [-5.0..5.0] to the coordinates. Then, if they've gone beyond the bounds (-512..512), clamp them.
• In practise, you should be able to solve this function very quickly. It's not too difficult (especially since we're using the variation with only two parameters) If you want to see how much the threading and hill climber actually help, feel free to broaden to the generalised form of the function, which allows for more dimensions.
The input will only include
◦ The user will only enter numbers a zero to quit, or a number from one to eight
◦ no other signals other than SIGINT and SIGUSR1
So, here's how we'll formulate our hill-climbing algorithm:
1) We'll have a global "best answer so far" notion. This will include the lowest minimum thus far, as well as the x and y values that produced it. You could want to set the lowest minimum to something unnaturally high and then leave it to the algorithm. climbers to set it up properly for you right away.
2) A menu will appear, prompting the user to select the number of climbers (threads) to run.
3) The user will be presented with a menu asking for the number of climbers (threads) to run concurrently. You can assume a maximum of 8 climbers/threads if the user selects 0.
4) Each climber has a current position (with corresponding current calculated height) • Each climber will generate four possible moves at each step The best possible move (i.e. the one that generates the lowest calculated value) is the climber's possible next move If the generated value would improve on the climber's current calculated height, make the move
5) Otherwise, randomise the climber's position within the established [-512..+512] domain and rec
Whenever a climber discovers a new global best minimum, the global "best answer so far" is updated. Of course, this will necessitate some form of mutual exclusion.
6) When the user presses ctrl+c, execution is halted and the user is returned to the menu.
If the user selects a number of threads to try again, the "global best" thus far is not lost.
7)At the very least, whenever the user presses ctrl+c to suspend, the "global best" height (and corresponding x and y) thus far must be displayed. You may also want to include support for SIGUSR1, which allows you to display the current progress without pausing the search.
The ability of the climber to improve its results is heavily influenced by how you generate your possible moves from a given position.
Consider adding two random modifiers (one for x and one for y) in the range [-5.0..5.0] to the coordinates. Then, if they've gone beyond the bounds (-512..512), clamp them.
• In practise, you should be able to solve this function very quickly. It's not too difficult (especially since we're using the variation with only two parameters) If you want to see how much the threading and hill climber actually help, feel free to broaden to the generalised form of the function, which allows for more dimensions.
The input will only include
◦ The user will only enter numbers a zero to quit, or a number from one to eight
◦ no other signals other than SIGINT and SIGUSR1