• Aucun résultat trouvé

Service Composition Generation

In this chapter, tasks submitted by customers are described by a Task Graph. As-suming that Task Graph is given, the next step is how to get each candidate service to form a SCG and how to get an optimal service executable plan by service selec-tion. A service search algorithm and a service selection algorithm are introduced as below, which are inspired by Ant Colony Systems.

3.5.1 Service Search and Composition Plan Generation

For mapping the subtask to corresponding candidate services, it is necessary to gain information on the services. Services are usually maintained by the creator and in-formation is deployed to a service register depository provided to the service com-position organization. The service register depository can be either centralized or distributed. The advantage of the centralized model is that it is easily implemented, but it has a bottleneck. If the centralized register depository is corrupted, the running of the system would be affected. The distributed model has many different service register depositories, which are responsible for service registries in distinct domains.

These nodes compose an overlay network. There is a routing table in each service register depository node, which is used to locate other nodes

There are two types of agents incorporated to query services in the register depos-itory network: SA and RA. An algorithm is needed to guide a SA to search services in order to reduce the total search time and improve efficiency. In this chapter, we adopt the mechanism of ant colony algorithm and use a pheromone to label the path to guide the search path of a SA. This is indirect coordination, which needs no direct communication or message passing.

A SA roams in the service register depository network and queries services be-longing to its own ontology domain. Its behaviors are shown as follows:

1. If a new service, which the SA never discovered before, is found in the service register depository, a report about this service will be given to the DA. The report contains information on the function, QoS attributes and the physical location of this service. The life of the SA will be increased and it also informs the RA in the last hop register depository node that a new service has been found.

2. If a SA cannot find a new service, its life value will be decreased.

3. If the life value of a SA is 0, it will kill itself.

4. If there is more than one service ontology in the table, an SA compares the amount of pheromones and chooses the path that has the most pheromone.

5. If there is not any related service ontology, an SA will randomly choose any node as next hop.

The RAs mainly maintain the service routing tables. Its behaviors are described as follows:

1. Receive the reports from an SA. If there is no such service that a SA finds in the table, a new item is added. Otherwise, the corresponding pheromone amount is increased.

2. Regularly update the table to decrease the pheromone amount in all items. If an items pheromone amount is 0, it will be discarded.

In the above method, the path that has the highest pheromone amount would be chosen. The drawback of this method is the path which has the least pheromone will never been chosen. So roulette wheel selection can be applied to improve it. Every time, the wheel location is partitioned by the value of the pheromone in the route table. The higher the pheromone is, the bigger the area in the roulette wheel. As the area is bigger, the probability that the corresponding path is chosen is greater.

Then a point from roulette wheel is chosen randomly, and the corresponding path is also chosen. After adopting this method, the paths with low pheromones also get the chance to be chosen, even if the probability is smaller.

3.5.2 QoS-Aware Service Selection

Ant system algorithms have been applied to the shortest-path problem [12] and the packet routing problem in communications networks [4] successfully. For these complex combinatorial optimization problems, Ant system algorithms may provide a good solution. The goal of our algorithm is to discover an optimal service exe-cutable plan in a SCG. Different from the generic shortest-path problem, the service executable plan includes parallel sub-paths, and the parallel execution part of that is also a critical path problem. The difficulty of our solution is how to process parallel paths.

Informally, the algorithm works as follows. In SCG, mants are initially posi-tioned on the source vertex. The task of each ant is to find a path from the source to the destination. While finding the path, if the ant is in an OR-vertex, it will apply a state transition rule to choose the successor. And if the ant is in an AND-vertex, it will clone several new ants and each ant will choose one of the successors re-spectively. The ant also modifies the amount of pheromone on the visited edges by applying the local updating rule. Once all ants have terminated their tour, the ver-texes visited by all ants, which belong to the same clone matrix, compose a service executable plan. Then the amount of pheromone on edges of the optimal service executable plan are modified by applying the global update rule. In the algorithm, ants should be guided by both heuristic information and pheromones. An edge with a higher amount of pheromone will have more chance to be chosen.

The key to the algorithm is the state transition rule, the ant clone rule, the global updating rule and the local updating rule.

3.5.2.1 State Transition Rule

When an ant is at an OR-Vertex i, it will choose and move to a successor j by applying the rule given by formula 3.2,

j=

arg maxu∈J

K(i){[τ(i,j)][η(i,u)]β}ifq≤q0

S otherwise (3.2)

whereqis a random number uniformly distributed in[0..1],q0is a parameter(0≤ q0≤1), andSis a random variable selected according to the probability distribution given in formula 3.3.

pk(i,j) =

( [τ(i,j)][η(i,j)]β

u∈JK(i)[τ(i,u)][η(i,u)]β ifj∈Jk(i)

0 otherwise

(3.3) pk(i,j)is the probability with which antkat OR-Vertexichooses and moves to its successors.

In formulas 3.2 and 3.3,τis the pheromone,Jk(i)is the successor set ofi, and β is a parameter which determines the relative importance of the pheromone versus the heuristic information (β >0). The heuristic function isη =uj, where utility functionujis introduced as the heuristic information.

According to definitions 2 and 3,uj=wc.scost(j)+wi.stime(j)+wa.savai(j)where scost(j) =scost(c(i,j)),stime(j) =stime(t(i,j))andsavai(j) =savai(a(i,j)).

3.5.2.2 Ant Clone Rule

When an ant is at an AND-Vertex, it will firstly clonen−1 ants, wheren equals the number of this vertex’s successors. Then each ant will choose and move to a successor vertex. The rule is that only one of successor vertexes belonging to the same task will be chosen by each ant respectively according to the state transition rule depicted above. In other words, an ant could only choose one of successor vertexes belonging to the same task, and a different ant does not choose successors from the same task.

3.5.2.3 Global Updating Rule

Just like ACS, this algorithm also has a global pheromone updating rule. It is exe-cuted after all ants have arrived at the destination vertex. The amount of pheromone is updated according to:

τ(i,j) = (1−α).τ(i,j) +α.∆ τ(i,j) (3.4) where

∆ τ(i,j) =

U if(i,j)∈owsp 0 otherwise

0<α <1 is the pheromone decay parameter, owsp denotes the optimal ser-vice executable plan and U =wc.scost(C) +wt.stime(T) +wa.savai(A) is a util-ity function of owsp. In formula U, C=∑(i,j)∈owspc(i,j), T =max(Tk), and A=∏(i,j)∈Pathka(i,j)iffk=arg max(Tk)whereTk=∑(i,j)∈Pathkt(i,j)and Pathk is the path that thek-th ant has passed by, which belongs to a clone group having found owsp.

Formula 3.4 indicates that only pheromones on the edges belonging to the opti-mal plan will be reinforced.

3.5.2.4 Local Updating Rule

While finding the plan, ants change the pheromone levels on the passing edges using τ(i,j) = (1−ρ).τ(i,j) +ρ.∆ τ(i,j) (3.5) where∆ τ(i,j) =τ00 is the initial pheromone level, andρ (0<ρ <1) is a parameter.

The detailed algorithm is depicted as follows:

1. Sett=0, and randomly set as a positive constant for all edges(i,j);

2. mants are positioned at the source vertex;

3. If antkis at an AND-Vertex, it executes the ant clone rule. Otherwise, if antkis at an OR-Vertex, it will choose a successor according to formulas 3.2 and 3.3;

4. Apply the local updating rule;

5. If antkarrives at the destination vertex, goto (6), or else goto (3);

6. When all ants arrive at the destination vertex, a group of ants having the same clone matrix will get a service executable plan;

7. Apply the global updating rule;

8. t=t+1;

9. If the optimal service executable plan satisfies the customer’s requirements, the process is completed, otherwise goto (2).