heuristics

Rule of thumb for choosing an implementation of a Java Collection?

Anyone have a good rule of thumb for choosing between different implementations of Java Collection interfaces like List, Map, or Set? For example, generally why or in what cases would I prefer to use a Vector or an ArrayList, a Hashtable or a HashMap? ...

Algorithm to decide if digital audio data is clipping?

Is there an algorithm or some heuristic to decide whether digital audio data is clipping? ...

What are some games with fairly simple heuristics to evaluate positions?

I'm teaching a kid programming, and am introducing some basic artificial intelligence concepts at the moment. To begin with we're going to implement a tic-tac-toe game that searches the entire game tree and as such plays perfectly. Once we finish that I want to apply the same concepts to a game that has too many positions to evaluate eve...

How to pick what unit to display a value in?

I have a value and I known that it's units is meters^(mn/md) * kg^(kn/kd) * s^(sn/sd) * K^(Kn/Kd) * A^(An/Ad) Note: the exponents are rational, units of m^0.5 are valid The question is how to pick how to break down the units into something more compact for instance if md=kd=sd=Kd=Ad=1 mn=Kn=An=0 kn=1 sn=-1 I can use N/m I suspec...

Heuristic for sliding tile problem.

The idea is to move all of the right elements into the left and the left into the right with an empty space in the middle. The elements can either jump over one or two pieces into an empty space. LLL[ ]RRR I'm trying to think of a heuristic for this task. Is the heuristic meant to aid in finding a possible solution, or actually retur...

How to search for a person's name in a text? (heuristic)

I have a huge list of person's full names that I must search in a huge text. Only part of the name may appear in the text. And it is possible to be misspelled, misstyped or abreviated. The text has no tokens, so I don't know where a person name starts in the text. And I don't if know if the name will appear or not in the text. Example:...

Optimizing locations of on-disk data for sequential access

I need to store large amounts of data on-disk in approximately 1k blocks. I will be accessing these objects in a way that is hard to predict, but where patterns probably exist. Is there an algorithm or heuristic I can use that will rearrange the objects on disk based on my access patterns to try to maximize sequential access, and thus ...

Traveling Salesman - Nearest Neighbor vs Genetic DEATHMATCH

Over the last few days I have noted a few web sites that demonstrated TS solution using genetic algorithms. I am looking for your opinion which is better for this particular problem. Heuristics vs Genetic. By better, I mean will yield a shorter/lower cost path. Explain why you feel the way that you do. Examples, and off-site links a...

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 advertising (e.g. click fraud), and community sites (e.g. Digg, reddit), but surprisingly little ...

When to use and not to use each development paradigm?

Given the various methodical approaches to development, can we get some heuristics together on which ones are appropriate in what circumstances, e.g. case-driven development model-driven development behavior-driven development test-driven development Rational Unified Process Jackson Structured Design et al No method is too old, speci...

What is the state of the art in computer chess tree searching?

I'm not interested in tiny optimizations giving few percents of the speed. I'm interested in the most important heuristics for alpha-beta search. And most important components for evaluation function. I'm particularly interested in algorithms that have greatest (improvement/code_size) ratio. (NOT (improvement/complexity)). Thanks. PS ...

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 becoming more reusable, but I've always struggled with naming Controller classes. For t...

How do the Antivirus programs detect the EICAR Test Virus?

The EICAR test virus is used to test the functionality of the anti virus programs. In order to detect it as a virus, Should the antivirus program have the virus definition for the test virus OR The heuristics detect it as a suspicious pattern and detect it as a virus. (I have seen an occasion that an AV program deletes the file whil...

Heuristics to discover spammers/bots (In forums, blogs etc).

The ways I can think of are: Measure the time between actions. Compare the posts' content (if they're too similar to each other) or, better yet, only the posted links. Checking the distribution over a period of time the user is active (if the user is active, say posting once every hour, for a week, then either we have a superman ...

Extracting bitmap from a file

Hi all, given a somewhat complex file of unknown specification that among other things contains an uncompressed bitmap file (.BMP), how would you extract it in Python? Scan for the "BM" tag and see if the following bytes "resemble" a BMP header? ...

Algorithm to detect photo orientation

I would like to rotate photos automatically, even when EXIF metadata about the image orientation is not available. Are there any good algorithms for detecting the orientation of a photo? The images are photographs from a digital camera. The algorithm doesn't have to work perfectly, but any reduction in the amount of human interaction r...

Yahoo-Pipes, Best Practices: 'Loop with a String Regex' vs. 'Regex'

What is a useful heuristic to consider when deciding between a 'Loop with a String Regex' and a 'Regex' module? ...

Finding the content of HTML section document

This is not really a programming question, more of an algorithmic one. The problem: Finding the "content" section of an HTML page. By "content" I mean the dom that contains the page content as seen by humans, without the noise, simply the "page actual content". I know the problem is not well defined, but let's continue... For example ...

Accurate A* search heuristic for isometric maps?

I have written an implementation of the A* search algorithm. The problem is that the heuristic I'm currently using only works accurately on square grids. As my map is isometric, the heuristic doesn't take into account actual the layout of the map and thus, the distance between cells. Update: After extensive logging and analysis (read as...

How to strip headers/footers from Project Gutenberg texts?

I've tried various methods to strip the license from Project Gutenberg texts, for use as a corpus for a language learning project, but I can't seem to come up with an unsupervised, reliable approach. The best heuristic I've come up with so far is stripping the first twenty eight lines and the last 398, which worked for a large number of...