SLIDE 51 Mutation operator
Algorithm 1 Add a component Require: Ensure:
1:
✁
2: for all component in
do
3:
candidates
✁
4:
if (random(0,1)> Prob(component)) then
5:
allGroups
✁ getGroups(component)
6:
if (size(groupsOf Classes) > 1) t hen
7:
for all groupOf Classes in allGroups do
8:
if (size(groupOf Classes) = min) then
9:
✁ groupOf Classes
10:
end if
11:
end for
12:
end if
13:
end if
14:
newComp
✁ randomGroup(
)
15:
✁ component ✂
16:
✁
17: end for 18: if (newComp =
) then
19:
✁
20:
for all component in do
21:
for all class in component do
22:
if (random(0,1) > 0.5) then
23:
✁ class
24:
end if
25:
end for
26:
✁ component ✂
27:
newComp
✁
28:
✁
29:
end for
30: end if 31:
✁ newComp
32:
)
33: return
- ffspring
- ffspring
- ffspring
- ffspring
- ffspring
- ffspring
candidates candidates candidates candidates candidates candidates candidates candidates
parent parent parent
setInterfacesAndConnectors( Algorithm 2 Split a component Require: Ensure:
1:
✁
2:
✁
3: for all component in
do
4:
if (numberOfGroups(component) > 1) then
5:
✁ component
6:
end if
7: end for 8: if (size(
) > 0) then
9:
✁ randomComponent(
)
10:
for all in do
11:
if (random(0,1) > 0.5) then
12:
component1
✁
13:
else
14:
component2
✁
15:
end if
16:
end for
17: else 18:
✁ randomComponent(
)
19:
for all class in do
20:
if (random(0,1) > 0.5) then
21:
component1
✁ class
22:
else
23:
component2
✁ class
24:
end if
25:
end for
26: end if 27:
✁ ✂
28:
✁ component1
29:
✁ component2
30:
)
31: return
parent parent parent parent
- ffspring
- ffspring
- ffspring
- ffspring
- ffspring
- ffspring
- ffspring
groupOfClasses groupOfClasses groupOfClasses compToSplit compToSplit compToSplit candidates candidates candidates candidates compToSplit compToSplit setInterfacesAndConnectors( Aurora Ramírez Quesada Ph.D. Thesis 1 / 7