Chapter 57 Teach or not? (Seek to follow up)

Lin Wan heard Jiang Fan's words, and hurriedly dragged the dinner plate to the position next to Jiang Fan,
Jiang Fan put the phone between the two of them and explained to her:

"This is a traveling salesman problem, using the knowledge of graph theory,
We can abstract it into a dot-line graph, where the dots represent 7 cities, and the lines represent the voyages between each other.

The line has weight, which represents the air ticket between them."

What Jiang Fan said is the general idea of ​​mathematical modeling, abstracting real problems into mathematical problems,

With the help of some methods of mathematics and the computing power of computers, it can be used to guide the production of reality.

And the traveling salesman problem in their hands is a classic problem with a wide range of practical applications. It belongs to the category of optimal combination and is a classic NP problem.

Including circuit wiring, oil pipeline laying, chain store goods distribution routes, etc., modeling can become a traveling salesman problem after simplification, so it has great application value.

Of course, there are many solutions, but Jiang Fan didn't want to explain too complicated ones to Lin Wan, so he chose the "brute force algorithm" which is the easiest to understand to explain to her.
So he continued: "After abstracting this problem into a complete graph, calculate the number of its full permutations, list all these possibilities, and compare their sizes."

At the same time, I also used the mobile phone drawing software to draw the point-line weight map.

Then he asked Lin Wan a question: "How many combinations do you think there are?"

Lin Wan still knows how to do this simple thing, the calculator on her mobile phone calculates:
7!=7*6*5*4*3*2=5040种。

"So many." Lin Wan's mouth twitched.

"Do you really need so many?" Jiang Fan guided, seeing that she couldn't figure it out, he explained directly:
"This problem will eventually form a Hamiltonian circuit, um, which means that all of them can be connected together.

So it doesn't matter which point you start from, that is, you only need to calculate the full arrangement of 6, so there are only 720 possibilities.

And because the loop we care about has no directionality, only one of the two symmetrical ones needs to be considered in these arrangements, so it can be divided by 2, so that there are only 360 left. "

Jiang Fan followed the advice carefully.

"But there are a lot of 360, so we need to calculate them one by one." Lin Wan was still distressed.

"Listen to what your senior said just now, you just need to give the idea of ​​​​solving the problem." Jiang Fan knew that the result of modeling is not important. Anyway, there is a computer to calculate, and the important thing is the idea.

"That's right." Lin Wan also realized that she was overjoyed, and patted Jiang Fan's arm: "Brother Fan, you are amazing."

Jiang Fan thought that my arm was about to be crippled by you in the past two days.

The problem was solved. After lunch, the two found a classroom to rest on their stomachs for a while, and went to the computer room on time in the afternoon.
The two seniors were already inside, Jiang Fan found a corner to continue playing his game,
Lin Wan went to Huang Wei's senior and explained to him the analysis of the problem in the morning.

Huang Wei also asked derivative questions such as how to make an incomplete graph and whether there is a conflict between the minimum cost and visiting each node exactly once,

Because Jiang Fan guessed that the other party might mention it, he also told Lin Wan in advance, so Lin Wan still answered fluently,
This made Senior Huang Wei feel a little surprised. Before asking her questions, all she gave was a superficial understanding, and sometimes the ideas given did not even read the whole question.
As a result, although the question this time was very basic, compared to her previous performance, it was a bit different. She has improved a lot.

Lin Wan could sense the slight surprise on the senior's expression, and she was also very proud in her heart, it had to be Brother Fan.

Huang Wei nodded his head rarely, and said: "Yes, the idea is completely correct, but you can consider whether there are other algorithm ideas besides the 'brute force algorithm'."

Huang Wei looked at the time: "I'll give you an hour to think about it first, and after an hour, tell me your thoughts."

"Okay." Lin Wan agreed face to face, but her heart groaned, and she had to make it more difficult to answer.

Getting up from the seat next to the senior, Lin Wan saw Jiang Fan sitting in the corner, and walked over to sit next to him.

"How's it going?" Jiang Fan just won a round and asked after putting down his phone.

"Hey, I was praised." Lin Wan snickered.

Jiang Fan nodded, it is normal to be praised.

However, Lin Wan changed the subject and looked at Jiang Fan with a small mouth: "But it gave me a new problem, and asked me to think about whether there are other algorithmic ideas to solve this problem."

Jiang Fan looked at Lin Wan: "Then what are you going to do?"

Lin Wan smiled and said, "Hehe, then it depends on you, Brother Fan."

Jiang Fan knew that she was going to do this, and just took this opportunity to beat and beat. This girl has been too arrogant recently, and said quietly:
"Rely on me? Who used my parents' words to blackmail me before?"

Jiang Fan could remember that when he came to school to accompany her in class, he was coerced by her in front of his parents.

Lin Wan raised her eyelids, looked at Jiang Fan and smirked, "I'll forget if you don't tell me, if you don't teach me, I'll tell my uncle and aunt."

"Teach, teach~" Jiang Fan hesitated, digging a hole for himself.

Lin Wan glanced at the two seniors. They were both operating on the computer in the other corner of the computer room, with their backs to the two of them.

Lin Wan lowered her voice and said, "Keep down, don't be overheard by the seniors."

Jiang Fan took the notebook and explained to her in a low voice that there are actually many ways to solve the traveling salesman problem, including the backtracking method, branch and bound method, greedy algorithm, etc.

He first told Lin Wan what kinds of methods are commonly used and what are their characteristics.
Then I picked a method that she probably understood and explained it to her in detail.

It took half an hour to understand her, but Lin Wan dragged it off for an hour.

Explained the whole idea to Senior Huang Wei again, Senior Huang Wei couldn't help nodding this time,

The answer is indeed okay, with such a professional taste.

After Lin Wan finished answering, Huang Wei asked her a few more questions, one of which was tricky and Jiang Fan didn't mention it beforehand.
Lin Wan was at a loss for words for a while, subconsciously and unconsciously she kept glancing in Jiang Fan's direction,
Huang Wei noticed this and looked in the direction of Jiang Fan, who was playing a game with his mobile phone.

"What do you think your friend is doing?" Huang Wei and Zhou Jian saw that Jiang Fan was Lin Wan's boyfriend, but they didn't take the initiative to mention it, so they still called them friends.

"Ah, I, uh~, no." Lin Wan didn't know what to say.

"He taught you?" Huang Wei asked suspiciously, and he also felt that Lin Wan had performed too well today.

"Uh~, that's right." Lin Wan forced a smile and admitted that she had already taken the initiative to mention it, so she still didn't dare to be too foolish.

Huang Wei looked at Jiang Fan again, turned around and said to Lin Wan, "You asked your friend to come over and have a chat."

(End of this chapter)

Tap the screen to use advanced tools Tip: You can use left and right keyboard keys to browse between chapters.

You'll Also Like