[Mathematical Modeling] Understanding and Application of State Transition Model


It is not easy to understand the theory directly, so let's explain this model in detail through an example

First understanding of the state transition model: the problem of crossing the river with wolf sheep and vegetables

The human-wolf sheep dish problem should be a very classic example of the state transition model. The content of the topic:

A man took a wolf, a sheep, and a basket of vegetables to cross the river, but the boat can only accommodate one creature other than humans. When no one is guarding, the wolf eats the sheep, and the sheep eats vegetables. When crossing the river, people must be in the boat. Ask: How can people cross the river safely?

image-20230309154341621

To solve this problem, the first thing we think of is to try it out and make assumptions. For such a small number of variables, we can easily use the violent method to get the result

  1. man and sheep go
  2. people come back
  3. man and wolf go
  4. man and sheep come back
  5. people and food
  6. people come back
  7. man and sheep go

The diagram is as follows:

image-20230307222911827

For simple problems, we can easily give solutions, but if it is more complicated, we can't see it at once, so we need to extract effective information from simple problems and describe this type of problem in an abstract way. Then give a more general solution . When you encounter this type of problem in the future, you can directly use the conclusion of the general solution to solve the problem easily and quickly. This is the essence and purpose of mathematical modeling .

So, for the human-wolf sheep dish problem, let's use an abstract way to describe the problem

We regard people, wolves, sheep, and vegetables as four variables, and their positions are represented by numbers. Assuming that the left bank is 1 and the right bank is 0, then the following table can be obtained

image-20230309171248123

In this table, all the states of the four objects of Renlang Yangcai are listed, but there are illegal states among them. What we need to do now is to remove all the illegal states, and then we get the following table

image-20230309171447895

These ten are the safe state, and then our purpose becomes to change the variable state from 1111 to 0000

Then in the next step, since these states are transformed by people, we classify the above ten security states according to the state of people, and we get the following results

image-20230309171828670

The current state seems to be expressed in binary, so would it be better to use decimal?

image-20230309171940223

As you can see, we changed the binary state to decimal, and renumbered them, so now, our problem has changed to 1 -> 10, there are so many lines in total, we simplify this diagram Come on, it's easier for us to see

image-20230309172229038

Therefore, it finally became this state. At this time, we can clearly draw conclusions: 1. The problem has a solution 2. The problem has two solutions 3. 7 steps to complete

So far we have established a model in a scientific way to solve this problem. This is our most basic understanding of mathematical modeling.

Conclusion of the state transition model

1. Features:

A simple abstraction over a step-by-step process

2. State machine

A state machine is a binary relationship on a set, and the elements in the set are "states". This relationship is called a transition relationship. In the transition relationship diagram, an arrow represents a transition. The expression form of the state machine:

V = {q -> r | q, r is an element in E}

Where E represents the collection of states, that is, the state space.

3. State diagram

All the transition relations on the set become the state diagram of the state machine, and all state machines have an initial state , which is expressed in the form of two circles in the state diagram

image-20230421144822329

4. Description of the state machine

The description of the state machine has the following key points: state space, initial state, transition relationship

For example: There is an unbounded counter starting from 0, and his state machine is described as:

State space: {0, 1, 2....}

Initial state: 0

Transfer: {n -> n+1}

Application of state transition model: n-person bridge problem

Question : There are 4 people who intend to cross the bridge, and this bridge can only pass at most two people at the same time. Assuming that they are all at one end of the bridge, and it is at night, a flashlight is needed to cross the bridge, and they only have one flashlight, which means that after two people cross the bridge, one of them must bring the flashlight back. Everyone walks at a different speed: A takes 1 minute to cross the bridge, B takes 2 minutes to cross the bridge, C takes 5 minutes to cross the bridge, and D takes 10 minutes to cross the bridge. Clearly, two people walk at the same speed as the slower of them. Ask, how long will it take them all to cross the bridge at least?

✅First analyze the variable set here, {A, B, C, D} , according to the description of the problem, assuming that the four people are initially on the left side of the bridge, and eventually want to go to the right side of the bridge, so the state of each variable is two , on the left or right

✅Set these four variables as (x1, x2, x3, x3), which correspond to A, B, C, D respectively, and set the value to 0 or 1, representing the left or right side respectively

✅So it can be obtained that the state set of all states is:

(0,0,0,0) (0,0,0,1) (0,0,1,0) (0,0,1,1) (0,1,0,0) (0,1,0,1) (0,1,1,0) (0,1,1,1)
(1,0,0,0) (1,0,0,1) (1,0,1,0) (1,0,1,1) (1,1,0,0) (1,1,0,1) (1,1,1,0) (1,1,1,1)

✅Due to the constraints of the topic, the decision sets we can get are {A B, A C, A D, B C, B D, C D, A, B, C, D}

Through the method of state + decision set, we can also write the state transition equation. According to this method, the transition process is expanded, and finally a weighted graph of state transition can be obtained. There are many paths in it, and the weight of each path It is different. In the end, the optimal solution we are looking for is the shortest path in the graph. This involves the knowledge of data structures, so I won’t go into details here.
State transition equation. According to this method, the transition process is expanded, and finally a weighted graph of state transition can be obtained. There are many paths in it, and the weight of each path is different. Finally, the optimal solution we are looking for is the graph The shortest path, here involves the knowledge of data structures, so I won't go into details here.

Regarding the learning and use of the model, the author is still on the road. If there is any mistake, please correct me in the comment area.

Guess you like

Origin blog.csdn.net/weixin_63249832/article/details/130288751