Questions tagged [hill-climbing]

Hill climbing is a mathematical optimization technique which belongs to the family of local search. It is an iterative algorithm that starts with an arbitrary solution to a problem, then attempts to find a better solution by incrementally changing a single element of the solution. If the change produces a better solution, an incremental change is made to the new solution, repeating until no further improvements can be found.

Hill climbing is a mathematical optimization technique which belongs to the family of local search. It is an iterative algorithm that starts with an arbitrary solution to a problem, then attempts to find a better solution by incrementally changing a single element of the solution. If the change produces a better solution, an incremental change is made to the new solution, repeating until no further improvements can be found.

For example, hill climbing can be applied to the travelling salesman problem. It is easy to find an initial solution that visits all the cities but will be very poor compared to the optimal solution. The algorithm starts with such a solution and makes small improvements to it, such as switching the order in which two cities are visited. Eventually, a much shorter route is likely to be obtained.

Hill climbing is good for finding a local optimum (a solution that cannot be improved by considering a neighbouring configuration) but it is not guaranteed to find the best possible solution (the global optimum) out of all possible solutions (the search space). The characteristic that only local optima are guaranteed can be cured by using restarts (repeated local search), or more complex schemes based on iterations, like iterated local search, on memory, like reactive search optimization and tabu search, on memory-less stochastic modifications, like simulated annealing.

The relative simplicity of the algorithm makes it a popular first choice amongst optimizing algorithms. It is used widely in artificial intelligence, for reaching a goal state from a starting node. Choice of next node and starting node can be varied to give a list of related algorithms. Although more advanced algorithms such as simulated annealing or tabu search may give better results, in some situations hill climbing works just as well. Hill climbing can often produce a better result than other algorithms when the amount of time available to perform a search is limited, such as with real-time systems. It is an anytime algorithm: it can return a valid solution even if it's interrupted at any time before it ends.

Source: Wikipedia(Hill Climbing)

70 questions
0
votes
1 answer

8 queen with hill climbing algorithm doesn't return anything?

I know this is kinda long but do you know why my 8 queen algorithm doesn't return anything. I created an empty board, similar neighbour board, and queens (for following where they are) I put one queen for each column and put them into random rows…
0
votes
1 answer

My code is taking too long, how to imrpve it?

I have the following algorithm: I have a graph and a related I have a topological sorting (In graph theory, "a topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv…
Best_fit
  • 165
  • 7
0
votes
1 answer

Problems using Common LISP running a hill-climbing search

This is code from my book that I need to use to run a hill-climb search using our predefined nodes. I was able to run a few other search functions successfully such as Best-first-- (which "looks" similar). Upon running this hill-climb search, it…
dantheDude
  • 21
  • 2
0
votes
1 answer

Example of problems in Simple Hill Climbing algorithm

What are some examples that cause Simple Hill Climbing to reach problems like local maxima, ridges and alleys, and plateau problem(s)? I have tried searching: Link one: which gives a fairly good example of Simple Hill Climbing stuck-in-local-maxima…
Richard
  • 7,037
  • 2
  • 23
  • 76
0
votes
1 answer

"TypeError: only integer scalar arrays can be converted to a scalar index" on Hill-RSA cryptography

I'm trying to code a Hill-RSA cryptography program that you can see a part of here: q2=31 alphabet=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",",","…
0
votes
2 answers

Simple hill climbing algorithm?

I'm trying to use the Simple hill climbing algorithm to solve the travelling salesman problem. I want to create a Java program to do this. I know it's not the best one to use but I mainly want it to see the results and then compare the results with…
0
votes
0 answers

user input , user inputs data into the list

I have a eval solution , that the user need to input the names of the people and give a certain value , i am trying to make it work but the input part is not working.…
0
votes
1 answer

Multiple local search algorithms to find global optima

So I'm fairly new to the whole evolutionary and genetic algorithm world and I'm in the process of writing one now that will optimize an array and return the best possible solution - the fitness. My algorithm right now is optimized through simulated…
0
votes
0 answers

How do I fill an ArrayList with random generated products?

I'd like some help with getting a randomizer working for my code. I am working on a hill-climbing algorithm for a school project. The algorithm works only I don't know how I can make it add random product(locations it needs to visit.) Here is the…
0
votes
0 answers

Efficiency of Gradient Ascent vs Hill Climbing

I'm running both gradient ascent and hill climbing on a landscape to assess which one can reach the greatest height in less steps. The outcome of my test is that hill climbing always manages to reach greater heights in less increments in comparison…
PRCube
  • 566
  • 2
  • 6
  • 19
0
votes
2 answers

How is a genetic algorithm with only selection and mutation same as a hill climbing algorithm?

Consider a genetic algorithm that uses only selection and mutation(no crossover). How is this similar to a hill climbing algorithm ? I found this statement in an article, but I dont seem to understand why?
0
votes
0 answers

Random Restart Hill Climbing (Sudoku - switching field values)

I need to create a program (in C#) to solve Sudoku's with Random Restart Hill Climbing and as operator switching values of two fields. The start solution of the sudoku will always have each field assigned a value to (from 1 to nn) where each…
user2999349
  • 859
  • 8
  • 21
0
votes
0 answers

grow shrink in bnlearn package gives same predictions

I am using the bnlearn package in R to predict certain outcomes. However, for all rows in my data set, I get the same predictions. Training buildModel <- function() { #building bn model #for Hill Climbing, works fine #hcbn = hc(bndf, blacklist =…
saltmangotree
  • 171
  • 4
  • 11
0
votes
1 answer

netlogo - Randomly select a neighbour patch that has a higher elevation, any? command

I've been tasked with a question of "randomly selecting a neighbour patch that has a higher elevation." My code is found below. I believe I am required to use the "any?" command to prevent getting the 'nobody' issue. to move-up let myelevPatch…
0
votes
1 answer

Optimisation of hill climbing algorithm in c# for training neural networks

I have written a small project in C# that creates and trains neural networks. For more details see my previous question here: (https://scicomp.stackexchange.com/questions/19481). The neural networks perform well after enough training, but I realise…
F Chopin
  • 574
  • 7
  • 23