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
11
votes
3 answers

Fast algorithm for checking if binary arrays can be rotated to not have an elementwise sum over 1

Let's say I have a set of constant-length arrays containing only zeroes and ones. My goal is to find out whether, after any rotation of any of the arrays, the element-wise sums of the arrays will not exceed 1. For instance, let's say I have the…
VarmirGadkin
  • 311
  • 2
  • 5
11
votes
2 answers

How can I adapt the Levenshtein Distance algorithm to limit matches to a single word?

I'm using the Levenshtein Distance algorithm in C++ to compare two strings to measure how close they are to each other. However, the plain Levenshtein Distance algorithm does not distinguish word boundaries as delimited by spaces. This results in…
WilliamKF
  • 41,123
  • 68
  • 193
  • 295
11
votes
2 answers

In game programming, how can I test whether a heuristic used is consistent or not?

I have thought of some heuristics for a big (higher dimensions) tic-tac-toe game. How do I check which of them are actually consistent? What is meant by consistency anyways?
Lazer
  • 90,700
  • 113
  • 281
  • 364
10
votes
2 answers

Algorithm for the game of Chomp

I am writing a program for the game of Chomp. You can read the description of the game on Wikipedia, however I'll describe it briefly anyway. We play on a chocolate bar of dimension n x m, i.e. the bar is divided in n x m squares. At each turn the…
Giacomo d'Antonio
  • 2,215
  • 3
  • 19
  • 23
10
votes
3 answers

System design: Preventing/detecting vote fraud

In light of the recent vote fraud incident here, I was wondering if anyone out there is familiar with building systems for preventing or detecting undesirable voting behavior. I imagine the technology is widely used in search engines, online…
Zach Scrivena
  • 29,073
  • 11
  • 63
  • 73
10
votes
4 answers

Find set of numbers in one collection that adds up to a number in another

For a game I'm making I have a situation where I have a list of numbers – say [7, 4, 9, 1, 15, 2] (named A for this) – and another list of numbers – say [11, 18, 14, 8, 3] (named B) – provided to me. The goal is to find all combinations of numbers…
JUST MY correct OPINION
  • 35,674
  • 17
  • 77
  • 99
10
votes
1 answer

Given a document, select a relevant snippet

When I ask a question here, the tool tips for the question returned by the auto search given the first little bit of the question, but a decent percentage of them don't give any text that is any more useful for understanding the question than the…
BCS
  • 75,627
  • 68
  • 187
  • 294
10
votes
2 answers

Difference between a stochastic and a heuristic algorithm

Extending the question of streetparade, I would like to ask what is the difference, if any, between a stochastic and a heuristic algorithm. Would it be right to say that a stochastic algorithm is actually one type of heuristic?
orestis21
  • 203
  • 1
  • 2
  • 5
10
votes
3 answers

Any references for parsing incomplete or incorrect code?

Can anybody point me at references on techniques for parsing code that contains syntax errors, or is missing necessary punctuation, for example? The application that I'm working on is an IDE, where we'd like to provide features like "jump to…
Mark Bessey
  • 19,598
  • 4
  • 47
  • 69
9
votes
2 answers

What should you name your controller in MVC? When should you create a new one?

I have a question that really applies to any MVC framework, I'm using the Zend Framework MVC. When exactly should you create a new controller? What exactly should the Controller layer define? I've created several apps with the MVC, progressively…
AndreLiem
  • 2,031
  • 5
  • 20
  • 26
9
votes
3 answers

What are some good methods to finding a heuristic for the A* algorithm?

You have a map of square tiles where you can move in any of the 8 directions. Given that you have function called cost(tile1, tile2) which tells you the cost of moving from one adjacent tile to another, how do you find a heuristic function h(y,…
user1234
  • 101
  • 1
  • 1
  • 4
9
votes
2 answers

How is Manhattan distance an admissible heuristic?

Ain't it true that while counting the moves for 1 tile can lead to other tiles getting to their goal state? And hence counting for each tile can give us a count more than the minimum moves required to reach the goal state? This question is in…
Akhil
  • 2,269
  • 6
  • 32
  • 39
9
votes
4 answers

How to traverse through all possible paths to a solution and pick the optimum path

I am not good at programmatically implementing a heuristic search algorithm / Dijkstra's algorithm/ A* search algorithm mentioned. However, while solving a problem mentioned in one of my post (Matrix manipulation: logic not fetching correct answer…
yeppe
  • 679
  • 1
  • 11
  • 43
9
votes
2 answers

Finding minimum cut-sets between bounded subgraphs

If a game map is partitioned into subgraphs, how to minimize edges between subgraphs? I have a problem, Im trying to make A* searches through a grid based game like pacman or sokoban, but i need to find "enclosures". What do i mean by enclosures?…
Tore
  • 579
  • 1
  • 6
  • 19
9
votes
3 answers

Need heuristic function for Reversi(Othello) ideas

I have just studied about heuristic functions but I cant find an idea for heuristic function for reversi(Othello), I just need a good idea for grading some state of the board I thought about : count the number of moves count the number of discs…
john smith
  • 93
  • 1
  • 1
  • 3
1 2
3
45 46