Current location - Training Enrollment Network - Mathematics courses - Fair and reasonable allocation of mathematical modeling award places
Fair and reasonable allocation of mathematical modeling award places
First of all, the questions raised

We have encountered such a thing: there are 200 students in the school, including Grade One 103, Grade Two 63 and Grade Three 34. If 20 students are selected to get scholarships, they will be distributed in proportion to the number of students, and the three grades are 65,438+00.3, 6.3 and 3.4 respectively. After rounding off the allocated places, there are still 19 students left. Therefore, the three grades occupy 10, 7 and 4 places respectively. If students who choose 2 1 get scholarships, according to the above method, the three grades will occupy 1 1, 7 and 3 places respectively, but the third grade will reduce 1 places. So the students in grade three think it is unreasonable. In order to solve this contradiction, we propose to study a more "fair and reasonable" quota allocation model, and then use computer high-level language programming to realize it.

Second, establish a mathematical model.

Assuming that the number of Party A and Party B is respectively, and each party holds one quota, the number of people represented by each quota of both parties is respectively, obviously when

When the quota allocation is reasonable. But generally speaking, these two numbers are not equal. In order to be relatively fair, "relative error" is introduced. Xi, △ =, x 1 and x2 are the relative errors of Party A and Party B respectively. Then when A and B occupy n 1 and n2 places respectively, the total number of places will increase by 1. Should it be allocated to Party A or Party B? Without losing generality, let p1>; P2 means unfair to Party A, and x 1(n 1, n2) is meaningful. When allocating 1 quota again, three situations may occur:

It shows that it is unfair for Party A to add a quota. Obviously, the newly-increased line of 1 will be returned to Party A. ..

It shows that it is unfair to Party B for Party A to add 1 quota. At this time, there should be

Explain that it is unfair to Party A after Party B increases the quota of 1. At this time, it should be

(note: in P 1 >; Under the assumption of p2, it is impossible to be unfair to Party A, that is, after adding 1 quota to Party B, it is still unfair to Party B.)

If X 1 (N 1, N2+1) >; X2(n 1+ 1, n2), the newly added quota of 1 is allocated to Party A, and vice versa. Obtained by combining (1), (2) and (3).

That is, when Formula (4) holds, the extra 1 quota will be allocated to Party A, and vice versa. Settings, the new 1 quota should be allocated to the party with P=max{P 1, P2}.

We can generalize the problem more generally: the number of people on the Di side is mi, which has occupied ni≥ 1(i= 1, 2, …, k). When the total number of people increases by 1, the newly added 1 person is calculated and allocated to the party with the largest Pi value.

Third, program design.

Use an array to store the number of people at the party, the number of people allocated to each party, and the p value of each party. In order to make the whole distribution fair and reasonable, each party has at least one quota, so each party is given 1 quota first. Starting from k+ 1 quota, every quota is a new quota. After calculating the p-value, assign this quota to the largest one of the k p-values, modify the largest p-value at the same time, and then assign k+2 quotas until the quota is divided. This kind of repetitive work is realized by looping statements. In order to judge whether the quota is divided, yfrs is used to record the number of allocated quotas, where Q is the total quota and when YFRS is used.

The main program is shown above.

There is a movie icon in the congratulatory message. Play a dance to congratulate you. In the selection interaction, there are participants, project content, research process, project software and ending subroutine.

In the participant subroutine, the photo of the participant is displayed, and when the mouse points to the person's name, the photo of the comrade is displayed.

In the subroutine of the research process, the research content of the research process in the time period is recorded, and the related data pictures are displayed at the same time.

In the subprogram of engineering software, the calculation program is written according to the algorithm we designed. In order to make the computer accept the input data, the subroutine "input segment" is designed through text interaction, as shown in the right figure:

There is a calculation icon in "Enter the number of Parties", which is the main procedure for calculating the allocation quota. Its main contents are as follows:

zc:=EntryText

len:=CharCount(zc)

zc 1:= " "

zc2:= " "

ii:= 1

Wei Zi: =0

Repeat while ii & lt=len

zc 1:=SubStr(zc,ii,ii)

If zc 1= ","then

SZ:= real number (zc2)

Wei Zi: = Wei Zi+1

Array Kit (Wei Zi, Shenzhen)

zc2:= " "

other

zc2:=zc2^zc 1

If ... it will be over.

Two: = two+1

End repetition

Fang Shu: = Wei Zi

ii:= 1

Repeat while II < = Fang Shu.

Array set (ii+ Fang Shu, 1)

a:=ArrayGet(ii)

b:= 1

c:=a*a/(b*(b+ 1))

Array set (2 * Fang Shu +ii, C)

Two: = two+1

End repetition

Fang Shu

Repeat while yfrs & ltq

maxp:=0

kl:= 1

L:= Fang Shu+1

Repeat i:= 1 to Fang Shu.

If array get(2 * Fang Shu +i) > maxp then.

Maxp:= array get(2 * Fang Shu +i)

Me: = Fang Shu+me.

KL:= Me

If ... it will be over.

End repetition

b:=ArrayGet(l)+ 1

Array set (l, b)

a:=ArrayGet(kl)

c:=a*a/(b*(b+ 1))

Array set (2 * Fang Shu+Kuala Lumpur, C)

yfrs:=yfrs+ 1

End repetition

nn:=DeleteFile("aa.txt ")

Repeat l:= Fang Shu+1 to 2 * Fang Shu.

ss:=ArrayGet(l)

AppendExtFile("aa.txt ",ss)

AppendExtFile("aa.txt ",",")

End repetition

Guo Jie: = read text file(" aa. txt ")

By running the program, it can be concluded that it is reasonable to allocate 1 1, 6 and 4 scholarships for the first, second and third grades respectively.

This is a template. See for yourself. This is very simple