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
1
vote
0 answers

8-Puzzle Using Hill climbing always caught infinite loop

i am trying to write algorithm to solve random 8-puzzles with hill climbing. i have wrote it using first choice,best choice and random restart but they always caught in infinite loop.any way to prevent that? also when generating random puzzles i…
user1768685
1
vote
2 answers

How do I copy an object by value instead of by reference in C#

I am writing a simple hillclimber algorithm in C# and am trying the following approach: Get initial Solution Copy solution to new object Apply algorithm to copy Compare obj value of initial solution with obj value of copy if better - copy back into…
bml
  • 59
  • 8
1
vote
0 answers

Using pybrain optimization algorithm to solve search problems

I recently started using pybrain library for classification problems using neural networks and with some struggle and documentation I made it work. Now, I would like to use blackbox optimization algorithms from the same library, but not applied to…
1
vote
1 answer

Heuristic function for Water Jug

I have a problem in Hill Climbing algorithm with Water Jug Problem : Given two jugs, one of which can accommodate X liters of water and the other which can accommodate Y liters of water, determine the number of steps required to obtain exactly D…
1
vote
0 answers

Issue with random mutation hill climbing

Hi I'm trying to write some simple code to use random mutation hill climbing for the travelling salesman problem. I have created a Tour class as such:- import java.util.ArrayList; import java.util.Collections; public class Tour { private…
1
vote
1 answer

Is there a way to use a custom learning function for Artificial Neural Networks in R?

Is there a way (using just the R programming language) to implement an ANN algorithm with using a custom learning function (instead of backpropagation)? All of the R packages I have tested (nnet, neuralnet, AMORE) seem to have options for learning…
jfalkson
  • 3,471
  • 4
  • 20
  • 25
1
vote
1 answer

How come my stack is getting overwritten after a for loop execution?

I am doing an algorithm for a hill climbing search, and for some reason, the stack that I'm supposed to have at the end of the loop seems to be overwritten with the last iteration of the state that the loop generated. Basically, here is a rundown of…
azdiiv
  • 383
  • 5
  • 17
1
vote
2 answers

Playfair Hillclimbing crack

I'm writing a python script to crack a playfair cipher, with only the ciphertext. First i generate about 30-100 decryption keys and run them on the ciphertext, ranking each one on it's digraph frequencies. To the next 'generation'/iteration I copy…
Michal
  • 1,300
  • 2
  • 14
  • 22
1
vote
3 answers

Hill-climbing algorithm to generate a string using Levenshtein distance as heuristic in Python?

I have been following this ebook and I am stuck at one of their Self Check questions, which goes on like this: Self Check Here’s a self check that really covers everything so far. You may have heard of the infinite monkey theorem? The theorem…
0
votes
1 answer

Random Mutation Hill Climber & Simulated Annealing - Which is Fastest?

I have used a random mutation hill climbing algorithm as part of a project that I am working on, but was wondering whether it would be better to use simulated annealing to minimise the chance of getting stuck in any local optima. The question I have…
Mus
  • 7,290
  • 24
  • 86
  • 130
0
votes
1 answer

How can I implement hill climbing using DRL exclusively?

I'm trying to build a local search algorithm using rules (DRL) only in order to always apply the "best" possible rule out of a rule-base at a given point in time which maximizes a fitness value. Therefore, I need to simulate the application of the…
0
votes
1 answer

Hill climbing algorithm with steps proportional to derivative?

I am writing a hill climbing algorithm where I want the step size to be proportional to the local derivative/gradient at a specific point. However, the algorithm seems to get stuck in a trough that I can't really understand, for example given a…
0
votes
1 answer

Hill Climbing non global maximum with Manhattan Distance

Consider a shortest-path finding problem, such that the shortest path from green to red must be found. For this, I would like to use the Hill Climbing approach and using the Manhattan Distance as my heuristics. I calculated some of those distances…
kklaw
  • 452
  • 2
  • 4
  • 14
0
votes
0 answers

Questions about a research paper on salient region detection and segmentation

I am reading this paper in an attempt to recreate the salient region detection and segmentation model employed. I have the following questions pertaining to section 3 of the paper and I would highly appreciate it if someone could provide clarity on…
user15505342
0
votes
0 answers

Random letter generator stuck at last iteration

I am trying to generate a random sequence of letters and it should equal a specific string. A completely random iteration does take ages, so I tried a hill-climbing approach. It works find, until the similarity of the target and the generated…
christheliz
  • 176
  • 2
  • 15