Miscellaneous about thinking in solving problems (thinking, analogy, and heuristic)

Source: Internet
Author: User
Tags lenovo

Miscellaneous about thinking in solving problems (thinking, analogy, and heuristic)

 

By Liu weipeng (pongba)

C ++'s Luo Yun (http://blog.csdn.net/pongba)

Toplanguage (http://groups.google.com/group/pongba)

 

The topic on toplanguage has been discussed for a while, with many gains. The purpose of our discussion is not to solve the problem, but to reflect on the general and cross-problem thinking rules in the process of solving the problem. Simply resolving a question (or failing to understand the answer, and then "suddenly enlightened") can only get the least things. It can certainly strengthen the thought process and method that can lead to the solution, however, without reflection, you cannot extract general things for more problems. However, looking at the answer and then "oh" is equivalent to no gains, because the difference between "Understanding" and "application" is more than 108,000. Everyone has had this experience: a question is hard to learn, and a key step in it is suddenly enlightened by a person's guidance. -- This is understanding. But this understanding is because someone else has put new knowledge (that key step) in your mind, so you can understand it. If you want to use it, you need to come up with the key step. Therefore, it makes sense to speculate on and summarize how others' thinking touches that key step, and why your own thinking does not reach it. We often find that a question cannot be solved. After the prompt below is displayed, we find that it does not use any knowledge we do not know, since that knowledge is in our minds, why can't we extract it? Why Can someone else extract it? How can I extract the corresponding knowledge like others? In fact, this involves the deepest principle of memory. (I personally sum up and guess this, but it is not mature. If you are interested in your own research, please refer to the following books: trace of memory, find the lost self, synaptic self, and psychology of problem solving.) in addition to assisting Lenovo (key knowledge), the general rule of thinking is to assist in deduction/induction (exploring, basically, we should first understand the question conditions and make some obvious interpretations. If you haven't pushed the answer, you can only wait for the key step to pop up from your mind. In this case, the so-called heuristic thinking method can be used to explore the knowledge contained in the problem by using some general methods that apply to all questions, this increases the possibility of successful problem solving. There are many heuristic ways of thinking, from general to special, and most general. This is basically all introduced in polia's how to solve it. Some of the more special features (for example, the rule for dividing search spaces in the last example below) need to be summarized, abstracted, and organized in the exercise.

The following are two notes posted on the discussion group (not long texts such as Q & A with polia ).

[1] Analysis of Several Thinking Methods for two typical algorithm questions

The questions are different, but the ways of thinking behind them are almost the same. How to sum up the most general thinking rules in each question determines the exercise efficiency.

The following are two classic questions that are widely used. If you know the answer, you may think that re-analyzing such questions has no value, but the value of the questions is not new or old, the difference lies in how many things can be summed up. The value of these two questions lies in that the thinking rules involved in their solving process are very typical and not too difficult.

Question 1: celebrity issues

A celebrity means that everyone else knows him, and he doesn't know anyone else. There is now a collection of N people and their cognitive relationships. Find out the celebrities (if any) or determine whether there are no celebrities (if not ).

Method 1: Special example. Consider two people. It is found that neither a nor B can be celebrities if they know each other or do not know each other. If one of them knows the other (without losing the general sense, we make a know B), then a is eliminated.

Method 2: Reverse method. Assume that a celebrity already appears. Considering the celebrity definition, a celebrity p is a person who meets the following two conditions:

  • Ask a person Q and Q to know p.
  • Ask a person Q. P doesn't know Q.

Then, out of the question of "who do not comply with celebrity standards, we can directly eliminate them when searching for Space Solutions ?" Ask this question. We examine the opposite of the above conditions. That is, if _ is used, P is not a celebrity:

  • Q does not know p.

Or

  • There is a person Q, P knows Q.

Based on these two conditions, we can actually optimize the exhaustive search, because when comparing the relationship between P1 and P2 between two people, we find that using the above two rules, only one person can have the "Celebrity potential", because according to the above rules, no matter whether the two people have known or do not know the relationship, there is always one person to be brushed off.

Method 3: Lenovo method. Lenovo may be

  • This is a problem involving n. We try to use induction to consider its subproblems. How to define subproblems? Two obvious methods: 1, and 2 are subproblems of two n/2 scales. A celebrity must be a celebrity in these two sub-questions. Therefore, the problem is reduced to solve two sub-problems, and the solution of these two sub-problems is merged in the last step. 2. Consider the subproblem of level n-1. A celebrity must be a celebrity in the n-1 subproblem. The problem is reduced to solve the n-1 subproblem, and the result is compared with the relationship between the n-1 subproblem and the last person. Finally, no matter which of the two induction methods is used, the optimization in the last step is the same, that is, the recursive solution is converted into an iterative solution.
  • This is a problem involving N. It directly associates with Recursive Algorithms and tries to assemble a recursive program. The result is the same as in the above 2nd solutions.
  • Because a celebrity is "competing" among N people, I think of a competition and try to join the traditional competition algorithm, that is, a comparison and elimination solution, the elimination rules in the process are discovered.
  • Etc. (Can someone add it ?)

Problem 2 Description: And the least continuous subsequence Problem

There are n numbers, and there are positive and negative values. Then we can find the smallest continuous subsequence. (Continuous subsequence is a [I] ~ A [J] a sequence formed by all continuous elements, where I and j are optional)

Method 1: Reverse push. Assuming that the minimum and subsequence have been found, we try to explore the minimum and subsequence properties as much as possible. Each nature helps us to intelligently search in the solution space. It is not difficult to find that the minimum and the elements at both ends of this hypothetical subsequence must be negative. Otherwise, we can cut them off to obtain a smaller and subsequence. Further, we will find that, in fact, the sum of the prefixes/suffixes of the smallest and subsequences counted from any segment is also negative, otherwise, we can cut it off to obtain a smaller and subsequence. In addition, the sum of any interval adjacent to the minimum and subsequence must be positive. Otherwise, we can add it to the minimum and sequence we assume, in order to get a smaller and subsequence. Once the above three conditions are found in the conclusions, we can search for space in a more intelligent manner.

Method 2: This is a problem involving N. Try to examine its subproblems. Can we reduce the problem to n-1? What is the correlation between the minimum and subsequences in the n-order question and those in the n-1 order? If the minimum and sub-sequences in the n-order question do not contain the last element, they must also be the minimum and sub-sequences in the n-1 Order question. In this case, we have completely reduced the problem to level n-1. But if it contains the last element, a natural problem is, is the minimum and subsequence in the n-1 level question included in the sequence that is left after the last element is cut off in the n-level smallest subsequence? If yes, in this case, the problem can also be reduced to n-1 order, that is, only the minimum and sequence in n-1 order has the potential to grow to the minimum and sequence of n order. However, in the second case, the answer is No (try to find a counterexample ). So it seems that this path does not work. In general, after a road fails, the first thing we need to do is to reflect on our ideas and find out where the problem has occurred. It may be possible to get the correct answer after repairing and completing the problem-think about it, we are trying to reduce the problem to n-1 level. So, why must it be n-1? For example, the Division is to try to reduce the problem to two subproblems of n/2 level. Why is it ineffective to reduce the problem to n-1 level? This downgrading cannot guarantee that we can construct the solution of the n-order problem based on its solution after solve the n-1 subproblem. Let's take a closer look at our method. We may find that the problem lies in the fact that the minimum and subsequence may jump from n-1 to n-order. In other words, the possible solution of the problem may span two subproblems. Such subproblems are not completely resolved. Apart from the need for solve, we also need to consider the potential solutions to these two subproblems, which is a hassle. The best sub-problem decomposition is to simply solve the sub-problem. For example, we are familiar with fast sorting, after a quick sorting splits an interval into two intervals based on a central axis element, the problem is divided into two subproblems, then, you only need to sort the two subproblems (sort these two intervals), and the two subproblems are settled directly. Its two subproblems are completely separated, so we don't have to worry about any elements in the left interval and those in the right interval in disorder. Then, the key to our problem is to break it down into two complete sub-problems. We imagine that we can break down n numbers into two segments by some means, to obtain the global minimum and subsequence, we only need to calculate the minimum and subsequence respectively for the two segments, and then look at which small one. We do not need to examine subsequences that span these two intervals. In this way, we can easily break down the problem into complete sub-problems step by step. However, how can we break down these two segments? Let's see what our unknowns are. The unknown is looking for such splitting. But now we are very confused. N-1 cannot be followed by a single knife, nor can we use a binary method. How can we cut it? It seems that this blind attempt will not work. Try upstreaming. We assume that this cutting has already appeared, and it meets the condition that the "minimum and sequence will definitely not cross its cut boundary", that is, to take a subsequence that spans its cut boundary, it must not be a minimum or a sequence. So how can we make a sequence not a minimum and a sequence? Think about the result derived from method 1 above. The suffix sequence of any prefix of the minimum and sequence must be negative, and the sequence of outward extension at both ends must be positive. Therefore, to minimize the sum of a sequence, we only need to make the situation unable to meet these two conditions. Based on this condition, be patient and quickly derive the desired nature of the cut.

Method 3: It is directly associated with dynamic planning. Then it is hard to implement dynamic planning. The hard-covering process will inevitably be frustrated (you will know why it is not a simple dynamic planning after reading the following practices), and you may have tried and made some mistakes, think of the question about Course Arrangement in introduction to algorithms, and think of classifying the intervals according to different ending elements: (this idea is copied online, the key is that "considering all subsequences terminated with a certain a [x]" is hard to figure out. Can anyone provide the thinking process behind this practice ?)

Set f [x] to the sum of the minimum sequence ending with a [X] and containing a [X], including:
F [1] = A [1];
F [x + 1] = f [x] <0? F [x] + A [x + 1]: A [x + 1]
Then the sum of the smallest subsequences is the smallest of F [1]. f [N.

Update: DengBytesA good point is mentioned in the discussion group:

With regard to dynamic planning, I would like to remind some students who are used to directly writing functions when looking at Dynamic Planning: some dynamic planning questions are not suitable for designing recursive functions using the final answer as the function value, some intermediate results are often used. For example, if we want to find the optimal solution of the entire solution space, but the optimal solution space does not have a direct recursive relationship, can we consider designing a solution space that ends with this position, the optimal solution may have a recursive relationship. Then, we will make a comprehensive comparison of the solution space to obtain the overall optimal solution. (Of course, in an algorithm, you can find and solve it) in this way, when thinking about an algorithm, make sure that your recursive process traverses the entire solution space.

Obviously, if I have the above principles in my mind, I should be able to divide the search space by the end of the interval. However, summary afterwards does not mean that the event actually happened beforehand. The summary of this question is certainly a very important principle (that is, the above section), but is it impossible for the author to solve the question because he does not know this principle? Chicken and egg problems. Obviously, people who first thought of this method may use a more general way of thinking. While weAfter knowing the answer to a question, in addition to summarizing the principles of domain knowledge provided by this question, we should also summarize more general and cross-question questions, rules of the Nature of thinking.

[2] role of abstraction in analogy Association

Psychology of problem solving provides an example to illustrate how the abstraction of the nature of the problem can increase. Later, the essence is similar (but not similar on the surface) when the question is associated with the possibility of the previous question. The example is as follows:

Chapter 1 of Psychology of problem solving provides an example of how to read a piece of military material first (for college students, this document describes how a small army uses several small-scale attacks in different directions to defeat a strong defensive military bastion. In fact, the essence of this example is that at the same time a weak attack on a point can combine into a powerful force. The patients were asked to solve the problem: a doctor wants to use X-rays to kill a malignant tumor that can only be killed by High-Intensity X-rays, however, this will hurt the surrounding good organizations. What Should doctors do? Only 10% thought of the answer in the test that did not give the previous military example, which is the control baseline. Then, in the trial of the military example, this proportion is only increased to 30%, that is, only an additional 20% of people "automatically" transferred knowledge. The last group was done with a reminder, reaching 75%, Which is 45% more than the "Automatic" Transfer Group. This example shows that the appearance and details of knowledge will confuse our eyes and hinder our use of knowledge. In this example, it is a hindrance to the analogy between problems.

However, this example is slightly artificial. The following is a more realistic example:

Problem: calculate the maximum K number in N.

Analysis: First, many people think of a similar problem: finding the maximum number of N numbers. However, the latter's superficial knowledge (such as the detailed process and details of the algorithm) cannot be directly borrowed. This will largely prevent the use of solutions to existing problems to solve new problems. The more you understand the non-essential (superficial) details of an algorithm, the more detailed it is, the more likely it is to impede the analogy Association.

However, if we abstract the knowledge of the first question at that time and extract the essence of the question: as long as one number is smaller than any other, it is certainly not the biggest, so it can be eliminated. It is not difficult to apply it to the maximum K number: as long as there is a number smaller than any K number, it certainly does not belong to the maximum K number column, and thus can be eliminated. There are two abstract elements: "elimination method" and "one elimination criterion ". (The more vague the abstraction, the better (as long as it is not vague), because basically, the more vague the abstraction, the closer it is to the essence, the larger the Lenovo space. Perhaps one sentence from Einstein can be applied here:The abstraction should be as vague as possible, as long as it is not vague .)

(Of course, there are other ways to think about this question. For example, using the reverse method mentioned above, we assume that a number that belongs to the maximum K number has been found, so as to X, we will examine its nature: at most there is a number of K-1 greater than it. By turning this attribute back, we will get a more intelligent search space: As long as any k Number is greater than X, X will be eliminated from the search space. In addition, the variable "N" can also be associated with sub-governance (basically, all problems involving N can be considered for sub-Governance-Dynamic Planning and greedy methods are special cases of sub-governance ), that is to say, what is the maximum K number in the number of N-1? What is the relationship with the global maximum K number? In addition to decomposition into N-1 subproblems, is there any other decomposition method? N/2? Or according to a rule? And so on .)

There are many examples. (Note: This question is included in the beauty of programming)

[3] limitations of heuristic methods

(Note: I am not quite sure what the inspiration is. Please refer to polia's how to solve it or Wikipedia (search for heuristics) and this article .)

First of all, it is certain that the heuristic method can compensate for the lack of knowledge to a certain extent (the knowledge here mainly refers to the "connection" in the brain ", hard knodge dge ). For example, for a question, someone else can directly think of a question that has been solved by analogy, and use one of the key properties to solve the question directly. You have not done that question, which leads to two possible results: 1. You just don't know the nature. 2. Although you "know" the nature, you have not linked the nature with the "clues" in your previous problem solving experience, so you still can't think of it ". The last one can be called soft knowledge, that is, you "know", but Lenovo cannot. This is the case in some cases, that is, what kind of knowledge connections are provided in books, and what you remember in your mind, instead of exploring the essential links between knowledge more extensively afterwards (The Role of summarization ). The previous one can be called hard knowledge, that is, you just don't know, it's not in your mind.

The heuristic method works on two levels:

  • Associate with Soft knowledge: For example, special law is a heuristic method of thinking. It introduces a simple special case, which usually contains more "clues, it may stimulate the association of existing knowledge. Another powerful supplementary association method is to deform the question. After deformation, new visual and semantic clues are generated, for example, the symmetry of the formula, from the Cartesian coordinate to the polar coordinate, which leads to the association of the latter's knowledge, etc. A large number of heuristic methods are actually used to assist Lenovo. By exploring clues in the question, the emergence of known knowledge in the brain is aroused. In this sense, compared to those who can directly think of a certain nature, those who do not know but can think of it through heuristic thinking, heuristic thinking provides a strategic association of "smooth and smooth. In a classic example: the purpose of bricks. Someone can immediately think of "hitting people ". Someone may not. However, the heuristic association policy "abstraction" can help the latter also think of "hitting people", because the "abstraction" policy inspires people to consider the various dimensions of bricks, such as "texture ", "shape", when you find that "texture is hard", "Angular", will it be far from "hitting people? Essentially, A person who can directly think of the "knock on people" function is because the neural path between the two concepts of the brain from the brick to the knock on people has been passed through many times (for example, because people often use bricks to knock on people), the relationship between neurons is quite rough (for more information about the image, see trace of memory for strict facts), rather than hitting people with bricks, this connection is very weak, and even it cannot trigger a nerve impulse at all. So why can we think of it through heuristic methods? Because the heuristic method is equivalent to bringing in a new neural control loop, it first increases the possibility of connecting you to the attribute dimension of the brick, enable the semantic concepts "Hard Texture" and "Angular" (note that this will not happen if no heuristic method is involved). Once the latter is activated, the connection from the latter to the "Knocking" is activated. In essence, this is what inspires Lenovo in solving problems. The more general the heuristic method, the more helpful it is to a wide range of problems (for example, the ones described in how to solve it, for example, the classification discussion, governance, and even the one that I think is very important: write down your own thinking process and break down each step in detail, check whether there are other possibilities in the thinking path (it is easy for us to get a question and be impulsive to bring it into a specific idea, and following the "most likely" derivation path, we tend to unconsciously ignore other possibilities, so those possibilities are "restrained" by our attention .)).
  • Helping to explore hard knowledge: The Reverse lookup method is a heuristic way of thinking. It focuses your attention on the knowledge contained in the conclusions of the problem. Once you start to focus on the knowledge that may be deduced from the conclusions, you may get hard knowledge, that is, it does not exist in your mind earlier, but it can be obtained through deduction. The inverse method in the minimum and subsequence in the preceding section is an example.

The limitations of heuristic methods also exist in these two aspects:

  • No matter how "inspired", some connections cannot be thought.For example, "When a cloth is stabbed, it is important to have a dry straw." How do you explain this sentence? If someone prompts "parachute", everyone will suddenly realize it. This is because the one-way connection between "cloth" and "parachute" is almost nonexistent. Even if the heuristic method is used, for example, to consider all the things made by cloth, it is almost impossible to think of a parachute, because, similarly, the association between "cloth-made things" and "parachute" is also extremely weak. We can only keep the most important connections in our minds. (If the "parachute", "Clothes", "sheets", "Curtains" and other daily items flash at an equally important level, it will be messy .) Why can we think of cloth from a parachute? In fact, we can't. Why can we sometimes, for example, if someone asks you to "think about the material of the parachute", the latter inspires the semantics of "material of the parachute, the latter guided us to investigate the material structure of the parachute, so we thought of cloth. Otherwise, the "cloth" will not be directly stimulated. So why can we establish a connection from the cloth to the parachute once someone mentions the parachute? This is because the excitement of the two semantic units "parachute" and "cloth" increases the possibility of association between them, just like increasing the voltage of the other end and thus breaking down. In essence, the same is true for solving mathematical problems. The process of solving the ferma theorem is a good example. The grain village conjecture is equivalent to the "parachute" prompt. We also heard many such stories (or our own experiences): Meditation on a problem is not necessary. One day we walk on the road, seeing something or hearing something, and then suddenly, A piece of Lightning broke the sky, and the problem was solved (didn't Archimedes think of the buoyancy principle because he was lying in the bathtub ?). I can assure you that if a person has long threw the question out of his mind (no longer excited), it is impossible to have an epiphany even when clues appear. We all know that finding answers with a question (making it excited in the brain) is more likely to be found, as long as the question is still in the mind, any clues that may be related to it will not be missed by the brain, because the excitement at the same time increases the possibility of association. If the problem has been removed from the brain (consciousness or subconscious) for a long time, it will not be captured even if there is a prompt around it.
  • Many hard knodge DGE cannot be inspired to explore.At least it cannot be explored by directly hitting the target. A problem may be related to trigonometric functions. Maybe you can only explore all the properties of trigonometric functions with the problem, so as to discover the key nature. The ferma theorem is related to the elliptic equation. It may only be necessary to explore all the properties of the elliptic equation. This process is blind to some extent. Instead of directly targeting the target. Smart people cannot directly reverse the ferma theorem to the grain village conjecture. In these cases, the heuristic method can only provide a general direction for exploration: for example, to explore the nature of trigonometric functions, and pay attention to which one may be helpful to my problem at any time. For example, explore the nature of the modulo operation to see which features may be useful. For example, exploring the properties of an elliptic curve. Heuristic methods do not allow us to precisely hit our targets. You can only define a rough range. No wonder some people say that mathematics is blind.

However, in other words, the limitations of heuristic methods cannot deny the huge help of heuristic methods in a large number of occasions. In many cases, heuristic methods alone can bring about breakthroughs. In addition, once there are as many intellectual things available, the ability to use better ways of thinking determines the ability to compete. There are many books about thinking methods.

 

P.s.

1. the article "solving problems with Bolia" was added twice (Rev #2). Three sections were added in the last section (about the role of exercises, and the limitations of the heuristic method mentioned above ). Click here.

2. Now we have discussed:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.