Disclosure of Invention
The invention aims to provide an edge server addressing deployment model, which not only can reduce the time delay between a base station and an edge server, but also can reduce the expenditure for deploying the edge server.
In order to achieve the above object, the present invention provides an edge server site selection deployment model, where the edge server site selection deployment model includes base stations and edge servers, where i denotes the edge server, j denotes the base station, and each edge server is connected to one or more base stations; establishing an edge server site selection deployment model to minimize the sum of the average delay and the expense between the edge server and the base station, wherein the edge server site selection deployment model is as follows:
Minimize:∑i,j∈N(t*cij*xij+(1-t)*costi) (1)
Subject to∑i∈Nxij=1 for each j∈N, (2)
xij≤yi for each i,j∈N, (3)
∑i∈N yi=k, (4)
xij∈{0,1},for each i,j∈N, (5)
yi∈{0,1}for each i,j∈N, (6)
wherein, yi(i e N) indicates that the edge server alternate address is selected, xi,j(i, j ∈ N) indicates that the edge server is connected to the base station, cijRepresents the distance, cost, between the edge server and the base stationiRepresenting the arrangement cost of each edge server, and t represents a weight coefficient;
constraint (2) indicates that each base station can only be connected with one edge server;
constraint (3) indicates that if the edge server i is connected to the base station j, the edge server i has been selected;
the constraint condition (4) represents that the number of the alternative points of the selected edge server is k;
the constraints (5) and (6) respectively represent xij,yiIs a variable from 0 to 1.
As a further improvement of the present invention, c isijThe calculation formula of (2) is as follows:
wherein l(s)i) Position coordinates representing the edge server, l (b)j) Representing the location coordinates of the base station.
As a further improvement of the present invention, the level node of the edge server is undirected graph G ═ V, E; wherein V represents a set of alternate points of the edge server and nodes of the base station, and E represents a link between the base station and the edge server.
As a further refinement of the present invention, the V ═ bhtwos, where B denotes a set of nodes of the base station and S denotes a set of alternate points of the edge server; bj∈B(j∈N+) Is a node of the base station, si∈S(i∈N+) Is an alternative point of the edge server.
The invention also aims to provide a solution method for edge server addressing deployment, which can solve the edge server addressing position of the optimal solution or the approximate optimal solution.
In order to achieve the above object, the present invention provides a solution method for edge server site selection and deployment, where the solution method is applied to the edge server site selection and deployment model, and the solution method includes the following steps:
step 1, the position coordinates of the base station and the position coordinates of the edge server are calculated according to a calculation formula:
converting the distance into the distance between the base station and the alternative point of the edge server; wherein l(s)
i) Position coordinates representing the edge server, l (b)
j) Representing the position coordinates of the base station, b
jE.b (j ═ 1, 2.. times, m) is the node of the base station, s
iE, S (i is 1,2, n) is a candidate point of the edge server;
step 2, setting genetic algorithm parameters; the genetic algorithm parameters comprise an initialized population scale, a base factor of each individual, a gene crossing probability, a gene variation probability and a maximum iteration number;
step 3, encoding the alternative points of the edge server;
step 4, initializing a population, and selecting k genes from the edge server alternative points as genes of one individual;
step 5, performing iterative evolution for specified times;
step 6, calculating the average time delay and the cost of each individual;
and 7, calculating the fitness: taking the average time delay and the reciprocal of the cost; the fitness is a scale for measuring the quality of the individual, and the number of individual reproduction or whether death is caused is determined according to the fitness;
step 8, selecting a survivor individual by adopting a roulette mode;
step 9, random cross mutation;
step 10, random mutation operation: randomly selecting variant individuals, and randomly selecting chromosome variants;
and step 11, turning to individual evaluation, and starting a new cycle: turning to step 6 to start circulation;
and step 12, finishing the circulation, and selecting the optimal individual as a solution.
As a further improvement of the present invention, in step 2, the population is a collection of individuals; the individual is a collection of genes; the gene cross probability is the partial codes of two individuals which are randomly exchanged; the genetic variation randomly changes one or more codes of one individual.
As a further improvement of the invention, the step 8 comprises the following specific steps:
step 8.1, calculate the fitness ratio, i.e. the selection probability of each individual
Step 8.2, calculating the cumulative probability of each individual, wherein the cumulative probability is equivalent to the 'span' on the turntable, and the larger the span is, the easier the selection is
Step 8.3, randomly generating r epsilon [0,1 ∈]If q isi>r, then select individual xi;
And 8.4, selecting the individuals selected by the roulette algorithm as survivors, eliminating the worst T individuals, and replacing the survivors with the optimal T individuals.
As a further improvement of the invention, the step 9 comprises the following specific steps:
step 9.1, randomly dividing individuals in the population into two groups, and randomly selecting two individuals for cross operation;
step 9.2, firstly, randomly generating two cross positions min and max (min < max) in the range of [1, sz ] (sz is the number of cities), namely in the length of the chromosome, and interchanging the [ min, max ] areas of two individuals;
and 9.3, processing the repeated part of the chromosome, and randomly mutating the repeated chromosome.
As a further improvement of the invention, a step is also arranged between the step 1 and the step 2: for the original data cijAnd costiNormalization processing is performed to map the result value to [0-1]To (c) to (d); the calculation formula of the normalization processing is as follows:
as a further improvement of the invention, the coding mode in step 3 is decimal coding.
The invention has the beneficial effects that: the invention not only can effectively reduce the placement cost of the mobile edge server, but also can reduce the communication delay between the edge server and the user and accelerate the service response through the geographical position of the mobile edge server. The model is an np-hard problem and is difficult to solve in constant time, and an optimal or near-optimal solution can be solved in constant time by adopting a genetic algorithm.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
The invention discloses an edge server site selection deployment model which comprises a base station and an edge server. Defining i to represent edge servers and j to represent base stations, wherein each edge server is connected with one or more base stations; establishing an edge server site selection deployment model to minimize the sum of the average delay and the expense between an edge server and a base station, wherein the edge server site selection deployment model comprises the following steps:
Minimize:∑i,j∈N(t*cij*xij+(1-t)*costi) (1)
Subject to ∑i∈Nxij=1 for each j∈N, (2)
xij≤yi for each i,j∈N, (3)
∑i∈N yi=k, (4)
xij∈{0,1},for each i,j∈N, (5)
yi∈{0,1}for each i,j∈N, (6)
wherein, yi(i e N) indicates that the edge server alternate address is selected, xi,j(i, j ∈ N) indicates that the edge server is connected to the base station, cijRepresents the distance, cost, between the edge server and the base stationiRepresents the placement cost per edge server, and t represents a weight coefficient. Constraint (2) indicates that each base station can only be connected with one edge server; constraint (3) indicates that if the edge server i is connected to the base station j, the edge server i has been selected; the constraint condition (4) represents that the number of the alternative points of the selected edge server is k; the constraints (5) and (6) respectively represent xij,yiIs a variable from 0 to 1.
The distance between the edge server and the base station is calculated according to the following formula:
wherein l(s)i) Position coordinates representing edge servers, l (b)j) Indicating the location coordinates of the base station. The edge server's level node can be viewed as an undirected graph G ═ V, E. Where V ═ bcu S denotes a set of alternate points of the edge server and nodes of the base station, where B denotes a set of nodes of the base station and S denotes a set of alternate points of the edge server. Definition bj∈B(j∈N+) Being a node of a base station, si∈S(i∈N+) Is an alternative point for the edge server. E denotes a link between the base station and the edge server. Each link not only represents a physical connection between a base station and a mobile edge server, but also describes a logical connection between a base station and a mobile edge server.
First a set of concepts is defined:
genotype: internal representation of the trait chromosome.
Evolution: the population is gradually adapted to the living environment, and the quality is continuously improved. The evolution of organisms has been in the form of populations.
Fitness is as follows: measure the adaptation of a species to the living environment. Selecting: several individuals are selected from the population with a certain probability. Generally, the selection process is a process based on the eligibility of fitness.
Copying: during cell division, the genetic material DNA is transferred by replication to newly produced cells, and the new cells inherit the genes of the old cells.
And (3) crossing: the DNA of the same position of the two chromosomes is cut off, and the two front and rear strings are respectively combined in a crossed manner to form two new chromosomes. Also known as gene recombination or hybridization; the gene crossover probability encodes the random exchange of portions of two individuals.
Mutation: some replication errors may occur (with little probability) during replication, and the mutation generates a new chromosome and shows a new trait. Genetic variation is the random alteration of one or several codes of an individual.
And (3) encoding: the genetic information in DNA is arranged in a pattern over a long strand. Genetic coding can be viewed as a mapping from phenotype to genotype.
Individual: refers to an entity with characteristics of chromosome, namely, a gene set.
Population: a collection of individuals, the number of individuals in the collection being referred to as a population.
The solution method for edge server addressing deployment will be described in detail below.
The concrete solving method comprises the following steps:
step 1, the position coordinates of the base station and the position coordinates of the edge server are calculated according to a calculation formula:
converting the distance into the distance between the base station and the alternative point of the edge server; wherein l(s)
i) Position coordinates representing edge servers, l (b)
j) Bits representing base stationsSet coordinates, b
jE.b (
j 1, 2.. multidata., m) is a node of the base station, s
iE, S (i is 1,2, n) is an alternative point of the edge server;
step 2, setting genetic algorithm parameters; the genetic algorithm parameters comprise an initialized population scale, a base factor of each individual, a gene crossing probability, a gene variation probability and a maximum iteration number;
step 3, encoding the alternative points of the edge server;
step 4, initializing a population, and selecting k genes from the edge server alternative points as genes of one individual;
step 5, performing iterative evolution for specified times;
step 6, calculating the average time delay and the cost of each individual;
and 7, calculating the fitness: taking the average time delay and the reciprocal of the cost; the fitness is a scale for measuring the quality of the individual, and the number of individual reproduction or whether death is caused is determined according to the fitness;
and 8, selecting the surviving individuals by adopting a roulette mode:
(8.1) calculating the fitness ratio, i.e., the selection probability of each individual
(8.2) calculating the cumulative probability of each individual, wherein the larger the span is, the easier the selection is
(8.3) randomly generating r ∈ [0,1 ]]If q isi>r, then select individual xi;
(8.4) the individuals selected by the roulette algorithm were surviving, the worst T individuals were eliminated, and the best T individuals were substituted.
Step 9, random cross mutation:
(9.1) randomly dividing individuals in the population into two groups, and randomly selecting two individuals to carry out cross operation; (9.2) first randomly generating two crossover sites min and max (min < max) within the range of [1, sz ] (sz is the number of cities), i.e., within the length of the chromosome, and interchanging the [ min, max ] regions of the two individuals;
(9.3) processing the repeated part of the chromosome, and randomly mutating the repeated chromosome.
Step 10, random mutation operation: randomly selecting variant individuals, and randomly selecting chromosome variants;
and step 11, turning to individual evaluation, and starting a new cycle: turning to step 6 to start circulation;
and step 12, finishing the circulation, and selecting the optimal individual as a solution.
Specifically, as shown in fig. 1, initially, the candidate points of the mobile edge server and the topology of the base station network have a total of 7 base stations and 5 deployment candidate points of the mobile edge server. Suppose we need to select 3 points as actual deployment points from the deployment alternatives of 5 mobile edge servers. Each base station and mobile edge server candidate point have a coordinate (x, y), and each mobile edge server candidate point has a deployment costi. The Euclidean distance c between each base station and each mobile edge server is calculated by using formula (7)ij。
If there is a normalization requirement on the data, then cijAnd costiAnd (6) carrying out normalization processing. As shown in fig. 2, the genetic algorithm parameters are determined according to step 2. Namely, determining the maximum iteration number m, the initial population size num, each individual gene factor k, the gene cross probability cross and the gene mutation probability mutate. As shown in fig. 6, the maximum number of iterations may affect the solution result.
The decimal encoding of gene in step 3, for example [0,1,2] represents that the individual has selected edge server alternate points 0,1, 2. And creating num x k two-dimensional arrays as an initialization population array in the step 4. And randomly initializing each individual gene, and randomly selecting k points from alternative points of the edge server as the genes of one individual. And then, in steps 5 to 7, traversing the sum of the shortest time delay and the cost from each base station to the edge server, and then solving the sum of the average time delay and the cost of the individual. And then sorting the individuals from large to small according to the sum of the average time delay and the cost.
The surviving individuals are then calculated by the roulette algorithm at step 8, as shown in figure 3. The worst n individuals are eliminated and replaced by the best n individuals.
Randomly swapping genes of any individual in step 9, for example: the exchange of [0,1,2] with [1,3,4] yields [0,2,3] and [1,1,4 ]. If a chromosome duplication occurs, the chromosome is mutated, for example: [1,1,4] to [1,2,4 ]. Step 10 random chromosomal variation of random individuals is performed. A certain gene segment of a certain individual is randomly selected and then randomly altered, for example: the [1,2,4] variation is [1,2,3 ]. And continuing to calculate the fitness and starting the next iteration until reaching the specified iteration times. And outputting the optimal individuals. I.e., edge server deployment scenarios.
As shown in fig. 4 and fig. 5, through comparing different algorithms by experiments, it is shown that the present invention not only can solve the optimal solution or the near optimal solution of the np problem within a constant time, but also can reduce the average delay and cost between the edge server and the base station at the edge server deployment stage. Meanwhile, the problem that the problem is difficult to solve in constant time in the aspect of time complexity is avoided.
In summary, the invention can effectively reduce the placement cost of the mobile edge server by setting an edge server addressing deployment model and a solving method thereof, and can reduce the communication delay between the edge server and the user and accelerate the service response by moving the geographical position where the edge server is placed. The model is an np-hard problem and is difficult to solve in constant time, and an optimal or near-optimal solution can be solved in constant time by adopting a genetic algorithm.
Although the present invention has been described in detail with reference to the preferred embodiments, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted for elements thereof without departing from the spirit and scope of the present invention.