Questions tagged [heuristics]

Heuristics refers to the use of algorithms to deal with highly complex problems.

Heuristics refers to the use of algorithms to deal with highly complex problems. A heuristic approach seeks to provide an approximate solution for a problem that is otherwise unsolvable.

683 questions
6
votes
3 answers

A* manhattan distance

I searched for the algorithm/pseudocode of A* I followed it and coded it. I used Manhattan distance for h(n). ( f(n) = g(n) + h(n) ) And this is the result, (source: uploadir.com) This always happen when there are no walls blocking the way, but…
Zik
  • 1,556
  • 7
  • 22
  • 31
5
votes
2 answers

Heuristic function for finding the path using A star

I am trying to find a optimal solution for the following problem The numbers denoted inside each node are represented as (x,y). The adjacent nodes to a node always have a y value that is (current nodes y value +1). There is a cost of 1 for a…
Vamsi
  • 4,237
  • 7
  • 49
  • 74
5
votes
2 answers

Quick alternatives to floating point multiplication to calculate percentages

I'm writing some code on an Arduino that needs to run fast and make rough approximations to percentages of integers. For example, given a number I want to find 90% of it, or 70% or 30% etc. The obvious way to do it is multiply by a floating point…
interstar
  • 26,048
  • 36
  • 112
  • 180
5
votes
1 answer

Is there any "Hello World" example type basic tutorial for heuristics or Meta Heuristics or optimization techniques

I am trying hard but still i have not found a very basic tutorial from where i can start with Meta heuristics and optimization problems. I have seen many books but they are full of Maths. I know that eventually i have to do that but if al least i…
Mirage
  • 30,868
  • 62
  • 166
  • 261
5
votes
1 answer

Heuristic Function for Rubik's cube in A* algorithm Artificial Intelligence

So I am trying to solve a Rubik's Cube by different algorithms using C++. I have tried the Iterative Deepening Search (IDS) and got it right but now I am stuck at A* algorithm. I have done some research and found that 3D Manhattan distance for…
5
votes
5 answers

How can we implement Artificial Intelligence in Javascript games?

i am working on a two player board game in html5/JavaScript. the two player version is almost complete. i want to add single player mode, where computer would be opponent. this game will be played in single browser (no server side integration). i am…
bhu1st
  • 1,282
  • 11
  • 23
5
votes
1 answer

How would A* search a graph?

An A* search will start at node S and continue to node G. At node S, the open list will contain A and B with values 7 and 6 respectively. Create a table showing the open list for each node that is visited as the A* algorithm …
blazing
  • 557
  • 2
  • 4
  • 20
5
votes
2 answers

Algorithm for computing the relevance of a keyword to a short text (50 - 100 words)

I want to compute the relevance of a keyword to a short description text. What would be the best approach in terms of efficiency and ease of implementation. I am using C++?
fgungor
  • 479
  • 4
  • 15
5
votes
2 answers

Manhattan Heuristic function for A-star (A*)

I found this algorithm here. I have a problem, I cant seem to understand how to set up and pass my heuristic function. static public Path AStar(TNode start, TNode destination, Func distance, …
Shawn Mclean
  • 56,733
  • 95
  • 279
  • 406
5
votes
1 answer

Assigning x,y coords in networkx/python for a* search heuristic

I am trying to implement an a* search algorithm in python on a 6*6 interconnected node grid, using networkx to organize nodes and matplotlib to display. I've got it working so it finds the shortest path, but without the heuristic, it's just brute…
fianchi04
  • 65
  • 6
5
votes
9 answers

Where are strings more useful than a StringBuilder?

Lot of questions has been already asked about the differences between string and string builder and most of the people suggest that string builder is faster than string. I am curious to know if string builder is too good so why string is there?…
DJay
  • 2,457
  • 2
  • 18
  • 22
5
votes
3 answers

Understanding A* heuristics for single goal maze

I have a maze like the following: |||||||||||||||||||||||||||||||||||| | P| | ||||||||||||||||||||||| |||||||| | | || | | ||||||| || | | || | | | | |||| ||||||||| || ||||| | || | | | | || ||…
MrDuk
  • 16,578
  • 18
  • 74
  • 133
5
votes
1 answer

fast heuristic algorithm for n queens (n > 1000)

I write two program : put together n queens in chess board without any threatening by backtracking algorithm. but that is very heavy for big n . at last you can run that for 100 queens. put together n queens in chess board without any threatening…
user1892659
5
votes
2 answers

Thread management advice - Is TPL a good idea?

I'm hoping to get some advice on the use of thread managment and hopefully the task parallel library, because I'm not sure I've been going down the correct route. Probably best is that I give an outline of what I'm trying to do. Given a Problem I…
Ian
  • 33,605
  • 26
  • 118
  • 198
5
votes
1 answer

How can I define a heuristic function for water jug?

I am trying to put a water jug problem into a heuristic function but I am finding some problems. There are 2 jugs, one that can hold 5(x) and other that can hold 3(y) gallons of water. The goal is (y,x)=(0,4). I can't figure out how to put it into a…