Summary of the invention
The purpose of the embodiment of the invention is, a kind of implementation method and system of network dynamic load balancing is provided, and this method adopts distributed strategy, has avoided the problem of centralized algorithm complexity height and single point failure, and has had good adaptability.
To achieve these goals, the embodiment of the invention provides a kind of implementation method of network dynamic load balancing, it is characterized in that, comprising:
Large-scale distributed grid is divided into several regional areas, the network topology structure in the described regional area of initialization, and the individuality of selecting the described network topology structure of even number at random is as initial population;
In described regional area, make up multiple objective function, calculate ideal adaptation degree individual in the population, and select the higher individuality of fitness as parent according to described multiple objective function according to a plurality of constraintss;
Described parent is carried out genetic operator, form filial generation;
Will be in the described multiple objective function of described filial generation substitution calculate and regret value thereafter, and whether the regret value of judging described filial generation is less than the regret value of described parent;
When judged result is the regret value of the regret value of described filial generation less than described parent, then replace described parent and form new population with described filial generation, and judge whether to satisfy end condition, if, then export described filial generation as optimal result, if not, then return and calculate ideal adaptation degree individual in the population, and select the step of the higher individuality of fitness as parent;
When judged result is the regret value that the regret value of described filial generation is not less than described parent, then give up described filial generation, and judge whether to satisfy end condition, if, then export described parent as optimal result, if not, then return described parent is carried out genetic operator, form the step of filial generation.
Further, described a plurality of constraints is respectively: resource cost, communication delay, network jitter value and transmission packet loss.
Further, the step according to a plurality of constraintss structure multiple objective functions also comprises in described regional area: the regret value that the multiple objective function that makes up is calculated turns to same magnitude by method for normalizing.
Further, described genetic operator comprises that single-point intersects and the exchange variation.
Further, individual ideal adaptation degree in the described calculating population, and select the higher individuality of fitness to be specially as the step of parent: calculate the ideal adaptation degree, and adopt the roulette mode to select the higher individuality of fitness as parent.
Accordingly, the invention provides a kind of realization system of network dynamic load balancing, described system comprises:
Preparation unit is used for large-scale distributed grid is divided into several regional areas, the network topology structure in the described regional area of initialization, and the individuality of selecting the described network topology structure of even number at random is as initial population;
Construction unit is used for making up multiple objective function according to a plurality of constraintss in described regional area;
Selected cell is used for calculating the individual ideal adaptation degree of population according to described multiple objective function, and selects the higher individuality of fitness as parent;
Computing unit is used for described parent is carried out genetic operator, forms filial generation;
Judging unit is used for the described multiple objective function of described filial generation substitution calculated and regrets value thereafter, and whether the regret value of judging described filial generation is less than the regret value of described parent;
Control unit, the regret value that is used for judged result when judging unit and is described filial generation is during less than the regret value of described parent, control is replaced described parent with described filial generation and is formed new population, and judge whether to satisfy end condition, if, then export described filial generation as optimal result, if not, then control by described selected cell and calculate ideal adaptation degree individual in the population, and select the higher individuality of fitness as parent;
When the judged result of judging unit is that the regret value of described filial generation is when being not less than the regret value of described parent, described filial generation is given up in control, and judge whether to satisfy end condition, if, then export described parent as optimal result, if not, then control by described computing unit described parent is carried out genetic operator, form filial generation.
Further, described a plurality of constraints is respectively: resource cost, communication delay, network jitter value and transmission packet loss.
Further, the regret value that calculates of the described construction unit multiple objective function that also is used for making up turns to same magnitude by method for normalizing.
Further, described genetic operator comprises that single-point intersects and the exchange variation.
Further, described selected cell adopts the roulette mode to select the higher individuality of fitness as parent.
Implement the embodiment of the invention, have following beneficial effect:
1, use distributed strategy, each network node both can be worked in coordination with executable operations, again can be mutually the running of interfering with an opponent not, avoided the high problem with single point failure of centralized algorithm complexity.
2, use genetic algorithm, the approximate optimal solution that the assurance scheme can must go wrong in rational time range.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
Fig. 1 is the flow chart of an embodiment of the implementation method of network dynamic load balancing of the present invention, as shown in Figure 1, said method comprising the steps of:
Step S100: large-scale distributed grid is divided into several regional areas, the network topology structure in the described regional area of initialization, and the individuality of selecting the described network topology structure of even number at random is as initial population.
Concrete, establishing whole large-scale distributed grid is that G=(V, E), G is the complete graph in the two dimensional surface.Wherein, V={ v
1, v
2..., v
nBe the vertex set of G, the network node in the expression system; E={ e
1, e
2..., e
mBe the limit set of G, the link between the expression network node; Every limit e
iBe associated with q weight, be expressed as Ω i={ ω
I1, ω
I2..., ω
Iq(i=1,2 ..., m).The single-hop route maximum delay threshold value of setting node communication again is t
MaxWith node v
iBe example, definition v
iRegional area for figure G in v
iBe the center of circle, t
MaxTwo-dimentional disc for radius is designated as G
i=(V
i, E
i), and G
iIn all nodes of network are coupled together but the connection branch road collection that do not constitute the loop constitute to generate tree, described generation tree is designated as T
i, so whole network G is divided into several regional areas G
i
It should be noted that total n in a complete graph that comprises n node
N-2Tree, thereby the arrangement of available n-2 number comes unique expression one tree, wherein each number all is the integer between 1 to n, this arrangement is called the Prufer number, this coded system can the only table diagrammatic sketch in all possible generation tree, and after any intersection or mutation operation, still represent one tree.
Network topology structure in the described regional area of initialization, promptly make up and all nodes in the regional area are coupled together but do not constitute the connection branch road collection in loop, it also is the Prufer number that described generation tree is represented in initialization, and select even number Prufer number at random as initial population, simultaneously, the various parameters that need use in the cycle-index calculated, the computational process are carried out initialization.
Step S101: in described regional area, make up multiple objective function, calculate ideal adaptation degree individual in the population, and select the higher individuality of fitness as parent according to described multiple objective function according to a plurality of constraintss.
Concrete, it is as follows to make up the multiple objective function process according to a plurality of constraintss in described regional area:
If make X=(x
1, x
2... x
m) linking status of arbitrary generation tree T of expression G, then X is defined as follows:
All generate the set of tree among S (T) the presentation graphs G if make, and for n rank complete graph, must have so | S (T) | and=n
N-2
Make f again
i(X) (i=1,2 ..., q) expression target function, then based on above definition, the multiple target minimum spanning tree problem can be expressed as follows:
For arbitrary regional area G
i, if V
i={ v
I1, v
I2..., v
In, Ei={ e
I1, e
I2..., e
Im, X
i=(x
I1, x
I2..., x
Im), then, target function can be defined as follows according to the form of formula (2):
Wherein, ω
J1=deg (x
j), expression link e
jThe end system resource cost sum of two ends institute connected node; ω
J2=time (x
j), expression link e
jCommunication delay; ω
J3=jet (x
j), expression link e
jThe network jitter value; ω
J4=loss (x
j), the network packet loss rate of expression transfer of data.
When above-mentioned a plurality of target functions are optimized, need carry out balance and compromise between a plurality of targets, this programme adopts regret function to describe:
Wherein, q is the target number, and is described suc as formula (2); P is the norm parameter; z
jIt is the value of j target; z
j* the ideal value of representing j target, its expression formula are z
j*=z
j Min
The parameter p representative is to the degree of attentiveness of big regret value, and the big more then degree of attentiveness to big regret value of its value is high more.
Further, described step according to a plurality of constraintss structure multiple objective functions also comprises: the regret value that the multiple objective function that makes up is calculated turns to same magnitude by method for normalizing.
For the regret value that makes each target all can be taken into account, by method for normalizing each regret value is turned to same magnitude earlier, make its all value between [0,1], select suitable parameter p again.In view of the above, formula (3) is as follows according to the regret function of formula (4) formal definition:
Wherein, parameter γ is the arithmetic number between (0,1), except that avoiding formula (5) to produce by 0 except that mistake, selection mode can also be adjusted to purely and select at random.For many challenges, seek relatively difficulty of ideal point, therefore Z* is converted into and acts on behalf of ideal point and substitute ideal point.Act on behalf of the ideal point that ideal point is not given problem, but work as corresponding ideal point in the former generation.If establishing P represents current population, the account form of then acting on behalf of ideal point is as follows:
Obviously, z
j Min=min { z
j(X) | X ∈ P, j=1,2,3,4}, z
j Max=max { z
j(X) | X ∈ P, j=1,2,3,4}.
It is as follows to spend journey according to individual ideal adaptation in the described multiple objective function calculating population:
Above-mentioned regret function (5) is converted into fitness function has bigger adaptive value to guarantee excellent individual.The definition fitness function is as follows:
Wherein, r
MaxAnd r
MinMaximum regret value and the minimum regret value in the former generation worked as in expression respectively.
Adopt the roulette mode to select the higher individuality of fitness as parent, concrete, described roulette mode is a prior art, repeats no more herein.
Step S102: described parent is carried out genetic operator, form filial generation.
Concrete, described genetic operator comprises crossover operator and mutation operator, and is concrete, comprises that single-point intersects and the exchange variation.Crossover operator is a genetic operator the most essential in the genetic algorithm, can play the effect of acceleration search in evolution.Single-point intersects, and promptly produces a crosspoint at random, with the whole exchange of the gene of the parents crosspoint right-hand member in the parent, forms two new individualities.The purpose of mutation operator is to carry out local random search, and when approaching optimal solution, but also accelerating ated test of variation makes the offspring population have diversity.The exchange variation, the coded strings that is about to the parents in the parent selects two positions to exchange the new filial generation of back formation at random.
Step S103: will be in the described multiple objective function of described filial generation substitution calculate and regret value thereafter, and whether the regret value of judging described filial generation is less than the regret value of described parent.
Concrete, calculate in the described regret function formula (5) that described filial generation substitution is transformed by described multiple objective function and regret value thereafter, and compare with the regret value of described parent.
Step S104: when judged result is the regret value of the regret value of described filial generation less than described parent, then replace described parent and form new population with described filial generation, and execution in step S106.
Step S105: when judged result is the regret value that the regret value of described filial generation is not less than described parent, then give up described filial generation, and execution in step S107.
Step S106: judge whether to satisfy end condition, if then execution in step S108 if not, then returns step S101.
Concrete, described end condition is the cycle-index of the calculating set in step S100.When reaching maximum cycle, stop calculating execution in step S108.
Step S107: judge whether to satisfy end condition, if then execution in step S109 if not, then returns step S102.
Concrete, described end condition is the cycle-index of the calculating set in step S100.When reaching maximum cycle, stop calculating execution in step S109.
Step S108: export described filial generation as optimal result.
Step S109: export described parent as optimal result.
The false code major part of said method is as follows:
WHILE(v
i?∈?V)?{
Init (); // parameter and initialization of population
for(k?=?1;?k?<=?Maxgen;?k?=?k?+1)?{
Evaluate (); // calculating fitness
for(j?=?2;?j?<=?size;?j?=?j?+?2)?{
f
1=selection (); f
2=selection (); // selection operator
Crossover (f
1, f
2); // hybridization operator
Mutation (); // mutation operator
}
if(Zmin(X)?<?Zmin(X
0))
X
0=X; // X
0Be noninferior solution
}
}
Implement the embodiment of the invention, have following beneficial effect:
1, use distributed strategy, each network node both can be worked in coordination with executable operations, again can be mutually the running of interfering with an opponent not, avoided the high problem with single point failure of centralized algorithm complexity.
2, use genetic algorithm, the approximate optimal solution that the assurance scheme can must go wrong in rational time range.
3, can be by the value of setup parameter, at the optimization of different network environments and the adaptation of application demand do.
Accordingly, the invention also discloses a kind of realization system of network dynamic load balancing.See also Fig. 2, be the structured flowchart of an embodiment of the realization system of network dynamic load balancing of the present invention.Described system 1 comprises continuous preparation unit 11, construction unit 12, selected cell 13, computing unit 14, judging unit 15 and control unit 16.
Described preparation unit 11 is used for large-scale distributed grid is divided into several regional areas, the network topology structure in the described regional area of initialization, and the individuality of selecting the described network topology structure of even number at random is as initial population.
Concrete, establishing whole large-scale distributed grid is that G=(V, E), G is the complete graph in the two dimensional surface.Wherein, V={ v
1, v
2..., v
nBe the vertex set of G, the network node in the expression system; E={ e
1, e
2..., e
mBe the limit set of G, the link between the expression network node; Every limit e
iBe associated with q weight, be expressed as Ω i={ ω
I1, ω
I2..., ω
Iq(i=1,2 ..., m).The single-hop routing delay threshold value of setting node communication again is t
MaxWith node v
iBe example, define its regional area for scheming among the G with v
iBe the center of circle, t
MaxTwo-dimentional disc for radius is designated as G
i=(V
i, E
i), and G
iIn all nodes of network are coupled together but the connection branch road collection that do not constitute the loop constitute to generate tree, described generation tree is designated as T
i, so whole network G is divided into several regional areas G
i
It should be noted that total n in a complete graph that comprises n node
N-2Tree, thereby the arrangement of available n-2 number comes unique expression one tree, wherein each number all is the integer between 1 to n, this arrangement is called the Prufer number, this coded system can the only table diagrammatic sketch in all possible generation tree, and after any intersection or mutation operation, still represent one tree.
Network topology structure in the described regional area of initialization, promptly make up and all nodes in the regional area are coupled together but do not constitute the connection branch road collection in loop, it also is the Prufer number that described generation tree is represented in initialization, and select even number Prufer number at random as initial population, simultaneously, the various parameters that need use in the cycle-index calculated, the computational process are carried out initialization.
Described construction unit 12 is used for making up multiple objective function according to a plurality of constraintss in described regional area.
Concrete, it is as follows to make up the multiple objective function process according to a plurality of constraintss in described regional area:
If make X=(x
1, x
2... x
m) linking status of arbitrary generation tree T of expression G, then X is defined as follows:
All generate the set of tree among S (T) the presentation graphs G if make, and for n rank complete graph, must have so | S (T) | and=n
N-2
Make f again
i(X) (i=1,2 ..., q) expression target function, then based on above definition, the multiple target minimum spanning tree problem can be expressed as follows:
For arbitrary regional area G
i, if V
i={ v
I1, v
I2..., v
In, Ei={ e
I1, e
I2..., e
Im, X
i=(x
I1, x
I2..., x
Im), then, target function can be defined as follows according to the form of formula (2):
Wherein, ω
J1=deg (x
j), expression link e
jThe end system resource cost sum of two ends institute connected node; ω
J2=time (x
j), expression link e
jCommunication delay; ω
J3=jet (x
j), expression link e
jThe network jitter value; ω
J4=loss (x
j), the network packet loss rate of expression transfer of data.
When above-mentioned a plurality of target functions are optimized, need carry out balance and compromise between a plurality of targets, this programme adopts regret function to describe:
Wherein, q is the target number, and is described suc as formula (2); P is the norm parameter; z
jIt is the value of j target; z
j* the ideal value of representing j target, its expression formula are z
j*=z
j Min
The parameter p representative is to the degree of attentiveness of big regret value, and the big more then degree of attentiveness to big regret value of its value is high more.
Further, the regret value that calculates of the described construction unit multiple objective function that also is used for making up turns to same magnitude by method for normalizing.
For the regret value that makes each target all can be taken into account, by method for normalizing each regret value is turned to same magnitude earlier, make its all value between [0,1], select suitable parameter p again.In view of the above, formula (3) is as follows according to the regret function of formula (4) formal definition:
Wherein, parameter γ is the arithmetic number between (0,1), except that avoiding formula (5) to produce by 0 except that mistake, selection mode can also be adjusted to purely and select at random.For many challenges, seek relatively difficulty of ideal point, therefore Z* is converted into and acts on behalf of ideal point and substitute ideal point.Act on behalf of the ideal point that ideal point is not given problem, but work as corresponding ideal point in the former generation.If establishing P represents current cluster, the account form of then acting on behalf of ideal point is as follows:
Obviously, z
j Min=min { z
j(X) | X ∈ P, j=1,2,3,4}, z
j Max=max { z
j(X) | X ∈ P, j=1,2,3,4}.
Described selected cell 13 is used for calculating the ideal adaptation degree according to described multiple objective function, and selects the higher individuality of fitness as parent.
Concrete, the above-mentioned regret function that is transformed by multiple objective function (5) is converted into fitness function, have bigger adaptive value to guarantee excellent individual.The definition fitness function is as follows:
(7)
Wherein, r
MaxAnd r
MinMaximum regret value and the minimum regret value in the former generation worked as in expression respectively.
Adopt the roulette mode to select the higher individuality of fitness, concrete, described roulette mode is a prior art, repeats no more herein.
Described computing unit 14 is used for described parent is carried out genetic operator, forms filial generation.
Concrete, described genetic operator comprises crossover operator and mutation operator, more specifically, comprises that single-point intersects and the exchange variation.Crossover operator is a genetic operator the most essential in the genetic algorithm, can play the effect of acceleration search in evolution.Single-point intersects, and promptly produces a crosspoint at random, with the whole exchange of the gene of parents crosspoint right-hand member, forms two new individualities.The purpose of mutation operator is to carry out local random search, and when approaching optimal solution, but also accelerating ated test of variation makes the offspring population have diversity.The exchange variation, the coded strings that is about to parental generation selects two positions to exchange the new filial generation of back formation at random.
Described judging unit 15 is used for the described multiple objective function of described filial generation substitution calculated and regrets value thereafter, and whether the regret value of judging described filial generation is less than the regret value of described parent.
Concrete, calculate in the described regret function formula (5) that described filial generation substitution is transformed by described multiple objective function and regret value thereafter, and compare with the regret value of described parent.
Described control unit 16, the regret value that is used for judged result when judging unit and is described filial generation is during less than the regret value of described parent, control is replaced described parent with described filial generation and is formed new population, and judge whether to satisfy end condition, if, then export described filial generation as optimal result, if not, then control by described selected cell and calculate ideal adaptation degree individual in the population, and select the higher individuality of fitness as parent;
When the judged result of judging unit is that the regret value of described filial generation is when being not less than the regret value of described parent, described filial generation is given up in control, and judge whether to satisfy end condition, if, then export described parent as optimal result, if not, then control by described computing unit described parent is carried out genetic operator, form filial generation.
Concrete, described end condition is the cycle-index of the calculating of setting in preparation unit 11.When reaching maximum cycle, stop calculating, exporting current result is optimal result.
Implement the embodiment of the invention, have following beneficial effect:
1, use distributed strategy, each network node both can be worked in coordination with executable operations, again can be mutually the running of interfering with an opponent not, avoided the high problem with single point failure of centralized algorithm complexity.
2, use genetic algorithm, the approximate optimal solution that the assurance scheme can must go wrong in rational time range.
3, can be by the value of setup parameter, at the optimization of different network environments and the adaptation of application demand do.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method, be to instruct relevant hardware to finish by computer program, described program can be stored in the computer read/write memory medium, this program can comprise the flow process as the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
Above disclosed only is preferred embodiment of the present invention, certainly can not limit the present invention's interest field with this, one of ordinary skill in the art will appreciate that all or part of flow process that realizes the foregoing description, and, still belong to the scope that invention is contained according to the equivalent variations that claim of the present invention is done.