027 Linear programming

Su Hao replied calmly: "The student has only heard of Mr. Wu's talent for a long time, but he doesn't know what kind of knowledge Mr. Wu is proficient in, so he can't say whether he has the knowledge that can make Mr. Wu look good." The student wants to ask Mr. Wu a question, and Mr. Wu only needs to say that you will or will not, without delaying your time, what do you think? ”

The students sitting below all looked at Su Hao and Wu Zhicheng with wide eyes, Su Hao's words sounded polite, but there was a sharp edge hidden in them. Su Hao's request is very simple: I will give you a question to do, you just need to say yes or no. As a young man who only took the last place in the exam, saying such things to a learned Confucian is simply a naked provocation.

"If I could, what would you do? What if I can't? Wu Zhicheng asked with anger. A young man can calmly and calmly under his own derogation, if he is provoked by a word from others, wouldn't he be planted first? With this in mind, he decided not to explode yet.

Su Hao said: "If Mr. will, then the student will immediately hide his face and leave, because this is the only thing that the student feels can take out and ask Mr. to pass the purpose." If the sir won't ......"

"Then I will immediately resign from my post as an instructor, go home and study behind closed doors, and no longer mislead people's children." Wu Zhicheng was forced into a corner by Su Hao and had to say cruel words. He thought to himself, if Su Hao's question was about dignified knowledge, then there was no reason why he didn't understand. If Su Hao had to find an unpopular question to test him, presumably Fang Mengjin would also reprimand Su Hao for being shameless, so he didn't have to worry about this.

Su Hao said: "It's not necessary, there is a specialization in the art industry, and it is normal for Mr. Wu to encounter things that he doesn't understand." The students just wanted to get a chance to ask Mr. Wu for advice. ”

"Don't talk too much, you can talk about your problems." Wu Zhicheng said.

Su Hao said: "This problem is a problem encountered by our workshop in the project. Today, I want to make 150 pieces of bamboo utensils, each of which requires a bamboo pole of 4 feet, 2 feet 6 inches and 1 foot 7 feet. There are a number of 1 zhang long bamboo, ask how to cut the material, can make the amount of long bamboo the least, at least geometry? ”

"This ......"

As soon as Su Hao's question was finished, the faces of the people in the room changed, this question sounded very clear, but everyone knew that such a question was something they couldn't solve at all.

1 zhang of long bamboo, can be cut into 2 4 feet, the rest of the part into 1 1 foot 7 inches, so that there will be 3 inches of bamboo; In another cutting method, you can cut it into 1 4-foot one, one 2-foot-6-inch one, and two 1-foot-7-inch one, so that it is not wasted. The problem is that the quantity required is 150 pieces of each of the three sizes, which requires a combination of various cutting methods. As for how to combine them optimally, in the minds of everyone, there is no better way than to experiment one by one.

Obviously, Su Hao did not ask Wu Zhicheng to solve such a problem by experimental methods, but Wu Zhicheng did not know how to solve it. If you want to say that this problem is unpopular, it seems that it is impossible to say, and it is completely possible to encounter problems like this in daily life.

In the weather in the middle of April of the lunar calendar, everyone else was so hot that they were sweating, but Wu Zhicheng felt that his vest was full of cold sweat. As a high-minded and arrogant Confucian, the most unbearable thing is to be asked by others in terms of learning. Wu Zhicheng has not been asked by others in his life, but there has never been a time like now, he obviously thinks this is a very simple question, but he can't even touch the doorway.

"Su Hao, this is a matter of arithmetic, but I can't remember which book has a mantra available. You have this problem, can you solve it? Fang Mengjin could hear from Wu Zhicheng's panting voice beside him that he was in embarrassment, so he broke the silence and asked Su Hao a question. Fang Mengjin didn't bet anything with Su Hao, it was very appropriate for him to ask.

When Su Hao came up with the question, he didn't expect Wu Zhicheng to be able to do it, you know, this is a linear programming problem, hundreds of years ahead of this era. Even in the West, the problem of linear programming was proposed 200 years later, at the beginning of the 19th century. The first to propose this problem was the famous French mathematician Fourier, but at the level of Francis Fourier, he could not find a good solution, but waited until more than 100 years later, until the 50s of the 20th century, there was a corresponding algorithm.

Su Hao used such a question to test Wu Zhicheng, to put it bluntly, he used the golden finger to bully the ancients. Then again, you don't need a golden finger to cross the crowd, are you embarrassed to say that you are from time travel?

Seeing Wu Zhicheng's old face flushed, Su Hao smiled slightly, and the other party Meng Jin said: "Master Fang, there is no way to solve this problem in my Ming knowledge, but Yiren has the technique of matrix, which can solve this problem." ”

"Brother Su can do this?" Fang Mengjin asked.

"A little bit of it." Su Hao said unceremoniously.

Fang Mengjin said: "Then please ask Brother Su to show me a demonstration, how about it?" ”

"Yes." Su Hao bowed his hand, and then asked the students, "Which brother can borrow a few blank pieces of paper from the younger brother." ”

"I have it!"

"Use mine!"

Several students scrambled to hand over the paper, and Su Hao thanked him and took the paper. Another student took out the pen and ink and wanted to hand it to Su Hao, Su Hao waved his hand, took out a few pieces of charcoal from his sleeve, and said with a smile: "I'm ashamed, when my little brother is doing arithmetic, he is used to using this thing as a pen." ”

Isn't this nonsense, no one can take a brush to solve the matrix problem. Su Hao took a simple charcoal pen and began to write the formula on the paper, and everyone gathered around to watch. Although Wu Zhicheng couldn't wipe off his face, he also wanted to know what kind of method Su Hao used to solve this kind of problem, so he also stood aside and watched.

"Brother Su, what you wrote is the counting method of Yiren, right?" Fang Mengjin looked at the string of Arabic numerals written by Su Hao and couldn't help asking.

"Exactly." Su Hao said, "This kind of counting method, called Arabic numerals, was actually invented by the Tianzhu people, and it was transmitted to the Buddha Lang machine by the Tianfang people. The heavenly side we speak of is called Arabian in the Francophone language. In fact, Arabic numerals were introduced to China in the Southern Song Dynasty, but no one used them. ”

"You also learned this from the Franc Man?" Fang Mengjin asked.

"Yes, the Franc machine missionary I have met is quite knowledgeable and has told me a lot."

Su Hao was talking in his mouth, and he was still writing formulas in his hands. He uses the simplex method to solve the linear programming problem, which is quite troublesome, but it only involves simple addition, subtraction, multiplication and division, and it is quite fast to calculate. After a while, Su Hao listed the final formula, and he pointed to the result and said to everyone:

"Look, that's what the calculations turn out of. We set a 4-foot bamboo pole as A, a 2-foot-6-inch pole as B, and a 1-foot-7-inch pole as C.

Take 21 long bamboos, cut into 2 A 1 C, can get 42 A, 21 C; Take 45 long bamboos, cut into 1 A 2 B, 45 A, 90 B; take 60 long bamboos, cut into 1A, 1B, 2C, can obtain 60A, 60B, 120C; Take 3 long bamboos, cut 1 A and 3 C, you can get 3 A, 9 C.

The total cost of the above is 129 long bamboos, and 150 A, B and C can be obtained, which is the most economical method. ”

Everyone looked at each other, as students of the academy, they usually have to learn some arithmetic, which is called mathematical art in the academy, including Fang Tian, Li Bu, Difference, Shaoguang, Shang Gong, Even, Yingyu, Equation, Pythagorean and other contents. Some students who consciously learned mathematics and art well immediately began to check the numbers calculated by Su Hao, and the result was, of course, no problem at all. As for whether 129 long bamboos is the best result, we can't verify it, but when they try to cut it with other combination methods, the values they get are greater than 129.

"Brother Riqian, do you think Su Hao's result ......" Fang Mengjin turned his head to look at Wu Zhicheng and asked for his opinion.

As a great Confucian, Wu Zhicheng also has some attainments in mathematical arts. Su Hao used the simplex method to solve this planning problem, he stood aside and watched carefully, and faintly realized some Taoism, and because of this, he was even more shocked. You know, this is a completely new field that he has never seen or even thought about, and in this world, there is such a wonderful algorithm that can solve such a difficult problem with simple addition, subtraction, and subtraction.

"Su Gongzi, the old man sat in the well and watched the sky, forgetting to learn endless ancient precepts, it is really ashamed. Previously, the old man was quite disrespectful to Su Gongzi, and asked Gongzi to forgive him. Su Gongzi, please bow to the old man. ”

Wu Zhicheng is arrogant, but at the same time, he is also a responsible person. Once he realized his mistake, he could admit it immediately, and he was not afraid to apologize to a young man like Su Hao in front of all the students.

Seeing that Wu Zhicheng was so humble, where did he dare to accept his great gift, Su Hao hurriedly bowed down and returned the salute, and said: "Mr. Wu has tormented the student, the student has just learned some tricky and obscene skills, how can it be compared with Mr. Wu's great talent." ”

"Master Su, the old man is very envious of your method of mathematical arts, I wonder if Master Su is willing to grant his method to the old man?" Wu Zhicheng apologized, and immediately had the cheekiness to learn from Su Hao. This is also the character of an old intellectual like him, Chaowen said, he died at night, and when he saw what he didn't understand, he didn't even have the patience to wait for a few days.

Su Hao said: "Mr. has asked, students should know everything, and they should say everything. However, Mr. Wu, now is not the time to teach this mathematical art, and the matter of digging wells is the most important thing. The student dared to ask Mr. to lend me some disciples to help me. ”

"Well said, well said." Wu Zhicheng nodded, he walked up to the podium, looked at the students in the entire lecture hall, and said loudly: "Ladies and gentlemen, today there is Su Haogongzi who has been appointed by Lord Han of Zhixian County to be responsible for the county's well drilling affairs. Mr. Su wants to hire a number of students in our academy to help him survey the well location. Who would like to participate? ”

Before the words fell, I saw a room full of students raising their right hands in unison, like a forest.