heuristics

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

拜拜、爱过 提交于 2019-12-17 07:01:21
问题 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? 回答1: 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

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

ぐ巨炮叔叔 提交于 2019-12-17 07:01:05
问题 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? 回答1: 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

Heuristic function for applying A* sudoku

只谈情不闲聊 提交于 2019-12-13 20:13:39
问题 I need a good heuristic function for A star for sudoku solving. The sudoku grid is 4X4 and by definition the legal operation from each state is to insert a new number to the next free cell (the order is left to right and up to down). for example, this is the input grid: and we should now fill the cell (1,2). All the nodes are different grids that represents different states. The branching factor is 4, so we have 4 possibilities for the next cell:1, 2, 3 or 4, i.e. 4 children for each node.

Algorithm to avoid obvious costly combinations when splitting n values to m groups

梦想与她 提交于 2019-12-13 05:13:01
问题 I have 7 values and I need to split them into 5 groups. Each group should contain atleast one value. There are 15 ways to group those values into 5. Mon- 13 Tue- 5 Wed- 4 Thu- 4 Fri- 11 Sat- 2 Sun- 1 When grouping, ordering of Mon, Tue, Wed, Thu, Fri, Sat, Sun should be preserved. Suppose there is a function which decides how good a grouping is. 13, 5, 4, 4, 11, 2, 1 Function Grouping 1 - 13, 5, [4,4], 11, [2,1] 13 added, 13 withdrawn, 0 remaining 5 added, 5 withdrawn, 0 remaining [4,4] added

What kind of heuristics for BFS use to solve this 'game' (find path)?

谁说胖子不能爱 提交于 2019-12-13 02:33:33
问题 I want to solve a 'game'. I have 5 circles, we can rotate circles into left or into right (90 degrees). Example: Goal: 1,2,3,....,14,15,16 Ex. of starting situations: 16,15,14,...,3,2,1 I'm using BFS to find path but I can't invent heuristic function (my every solutions are not good). I was trying manhattan distance and others... (Maybe idea is good but something wrong with my solution). Please help! 回答1: One trick you might try is to do a breadth-first search backward from the goal state.

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

我的梦境 提交于 2019-12-12 09:44:50
问题 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: I have "Barack Hussein Obama" in my list, so I have to check for occurrences of that name in the following texts: ...The candidate Barack Obama was elected

ai: Determining what tests to run to get most useful data

≯℡__Kan透↙ 提交于 2019-12-12 04:31:05
问题 This is for http://cssfingerprint.com I have a system (see about page on site for details) where: I need to output a ranked list, with confidences, of categories that match a particular feature vector the binary feature vectors are a list of site IDs & whether this session detected a hit feature vectors are, for a given categorization, somewhat noisy (sites will decay out of history, and people will visit sites they don't normally visit) categories are a large, non-closed set (user IDs) my

how to bypass 'dictionary changed size during iteration'

血红的双手。 提交于 2019-12-12 01:24:42
问题 I'm writing a heuristic function for a problem that can be presented by a table (a tuple of tuples) and I'm starting with some random cells in my table which I give a 0 value, then adding 1 to its neighbors and so on - this value is later can be shown in a dictionary - where the key is the cell's coords and the value is its value. everytime I get into a new cell, I save it into my dic. The problem - for this BFS-ish method which I made, I need some kind of a dynamic sized dictionary. There

Most efficient implementation for a complete undirected graph

喜夏-厌秋 提交于 2019-12-10 21:14:34
问题 Problem background I am currently developing a framework of Ant Colony System algorithms. I thought I'd start out by trying them on the first problem they were applied to: Travelling Salesman Problem (TSP). I will be using C# for the task. All TSP instances will consist of a complete undirected graph with 2 different weights associated with each edge. Question Until now I've only used adjacency-list representations but I've read that they are recommended only for sparse graphs. As I am not

How to design the heuristic for A* when there are multiple goals in the grid map?

落爺英雄遲暮 提交于 2019-12-10 21:12:18
问题 I am facing a problem that I have to use A* to search through the map, and there are multiple goals in this map to reach. My aim is to expand the least nodes in the map, any idea on how to design the heuristic for this A* algorithm? thanks 回答1: Assuming by "multiple goals" you mean you want to reach any one , just take the minimum of all the heuristics. Assuming your heuristic is consistent, this is still a consistent heuristic. If instead you're trying to reach all of them , this is