heuristics

Are all scheduling problems NP-Hard?

你。 提交于 2019-11-27 20:44:35
问题 I know there are some scheduling problems out there that are NP-hard/NP-complete ... however, none of them are stated in such a way to show this situation is also NP. If you have a set of tasks constrained to a startAfter , startBy , and duration all trying to use a single resource ... can you resolve a schedule or identify that it cannot be resolved without an exhaustive search? If the answer is "sorry pal, but this is NP-complete" what would be the best heuristic(s?) to use and are there

What are some algorithms for comparing how similar two strings are?

最后都变了- 提交于 2019-11-27 17:03:21
I need to compare strings to decide whether they represent the same thing. This relates to case titles entered by humans where abbreviations and other small details may differ. For example, consider the following two titles: std::string first = "Henry C. Harper v. The Law Offices of Huey & Luey, LLP"; As opposed to: std::string second = "Harper v. The Law Offices of Huey & Luey, LLP"; A human can quickly gauge that these are most likely one and the same. The current approach I have taken is to normalize the strings by lowercasing all letters and removing all punctuation and spaces giving: std:

Travelling Salesman with multiple salesmen?

风格不统一 提交于 2019-11-27 12:41:52
I have a problem that has been effectively reduced to a Travelling Salesman Problem with multiple salesmen. I have a list of cities to visit from an initial location, and have to visit all cities with a limited number of salesmen. I am trying to come up with a heuristic and was wondering if anyone could give a hand. For example, if I have 20 cities with 2 salesmen, the approach that I thought of taking is a 2 step approach. First, divide the 20 cities up randomly into 10 cities for 2 salesman each, and I'd find the tour for each as if it were independent for a few iterations. Afterwards, I'd

Consistent and Admissible Heuristics

笑着哭i 提交于 2019-11-27 01:36:30
问题 Any consistent heuristic is also admissible. But when is a heuristic admissible but not consistent (monotone)? Please provide an example in which this is the case. 回答1: As Russel and Norvig point out in Artificial Intelligence: A Modern Approach (the most commonly used AI textbook) it is challenging to come up with a heuristic that is admissible but not consistent. Obviously, you can select values for nodes in a graph such that the heuristic they represent is admissible but not consistent.

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

夙愿已清 提交于 2019-11-26 23:41:25
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? I've always made those decisions on a case by case basis, depending on the use case, such as: Do I need the ordering to remain? Will I have null key/values? Dups? Will it be accessed by multiple threads Do I need a key/value pair Will I need random access? And then I break out my handy 5th edition Java in a Nutshell and compare the ~20 or so

What are some algorithms for comparing how similar two strings are?

故事扮演 提交于 2019-11-26 15:09:25
问题 I need to compare strings to decide whether they represent the same thing. This relates to case titles entered by humans where abbreviations and other small details may differ. For example, consider the following two titles: std::string first = "Henry C. Harper v. The Law Offices of Huey & Luey, LLP"; As opposed to: std::string second = "Harper v. The Law Offices of Huey & Luey, LLP"; A human can quickly gauge that these are most likely one and the same. The current approach I have taken is

Design patterns for converting recursive algorithms to iterative ones

谁都会走 提交于 2019-11-26 12:06:48
Are there any general heuristics, tips, tricks, or common design paradigms that can be employed to convert a recursive algorithm to an iterative one? I know it can be done, I'm wondering if there are practices worth keeping in mind when doing so. Brian You can often entirely preserve the original structure of a recursive algorithm, but avoid the stack, by employing tail calls and changing to continuation-passing , as suggested by this blog entry . (I should really cook up a better standalone example.) CMS A common technique that I use where I'm on the process of replace a recursive algorithm

Design patterns for converting recursive algorithms to iterative ones

只谈情不闲聊 提交于 2019-11-26 02:51:11
问题 Are there any general heuristics, tips, tricks, or common design paradigms that can be employed to convert a recursive algorithm to an iterative one? I know it can be done, I\'m wondering if there are practices worth keeping in mind when doing so. 回答1: You can often entirely preserve the original structure of a recursive algorithm, but avoid the stack, by employing tail calls and changing to continuation-passing , as suggested by this blog entry. (I should really cook up a better standalone

Is there any rule of thumb to construct SQL query from a human-readable description?

落爺英雄遲暮 提交于 2019-11-25 22:57:39
问题 Whenever there is any description of query in front of us, we try to apply heuristics and brainstorming to construct the query. Is there any systematic step-by-step or mathematical way to construct SQL query from a given human-readable description? For instance, how to determine that, whether a SQL query would need a join rather than a subquery, whether it would require a group by, whether it would require a IN clause, etc.... For example, whoever studied Digital Electronics would be aware of