Fix mistake in the logic of the algorithm

Signed-off-by: 's avatarHenrique Varella Ehrenfried <hve13@inf.ufpr.br>
parent 0e754a0b
......@@ -26,19 +26,20 @@ matrix_no_header.shift
matrix_t = matrix_no_header.transpose
matrix_size = matrix.size
matrix_numbers = matrix_t
matrix_numbers.shift
matrix_numbers.pop(3)
test_cases = Array.new
test_cases = (0..matrix_size).to_a
i = 0
limit = matrix_numbers.size
# This loop finds out which mutants are not killed by each test case
# This loop finds out which mutants are killed by each test case
while i < limit do
temp_array = Array.new
matrix_numbers[i].each_with_index do |test_case, mutant|
if test_case.to_i == 0
if test_case.to_i == 1
temp_array << mutant
end
end
......@@ -54,7 +55,7 @@ all_lines.each do |al|
split_line.each do |sl|
temp_array << test_cases_failure[sl.split("_").last.to_i-1]
end
mutants_not_killed << temp_array.map{ |x| x }.reduce(&:|).uniq
mutants_not_killed << (test_cases - temp_array.flatten.uniq.compact)
end
# This loop returns the score and the number of mutants alive
......@@ -63,7 +64,7 @@ score_of_not_killed = Array.new
i = 0
limit = mutants_not_killed.size
while i < limit do
m_size = mutants_not_killed[i].size
m_size = matrix_size-mutants_not_killed[i].size
number_of_not_killed[i] = m_size
score_of_not_killed[i] = m_size.fdiv(matrix_size)
i = i.next
......@@ -103,4 +104,4 @@ result.each_with_index do |r, i|
when 7
puts("Random mix: #{r}")
end
end
\ No newline at end of file
end
\ No newline at end of file
BISECT
The avarege
Random 100%: 0.46464646464646464
Random 10%: 0.42378787878787877
Random 20%: 0.43787878787878787
Random 50%: 0.44257575757575757
Diferent operator: 0.36363636363636365
Each choice: 0.36363636363636365
First to Last: 0.46464646464646464
Random mix: 0.45454545454545453
Random 100%: 0.8434343434343434
Random 10%: 0.7990909090909091
Random 20%: 0.8064646464646466
Random 50%: 0.8341414141414141
Diferent operator: 0.7878787878787878
Each choice: 0.7878787878787878
First to Last: 0.7878787878787878
Random mix: 0.7878787878787878
---
BUB
The avarege
Random 100%: 0.9302325581395349
Random 10%: 0.8097093023255815
Random 20%: 0.8205232558139535
Random 50%: 0.9373255813953488
Diferent operator: 0.936046511627907
Each choice: 0.9476744186046512
First to Last: 0.936046511627907
Random mix: 0.936046511627907
Random 100%: 0.7093023255813954
Random 10%: 0.6840697674418604
Random 20%: 0.6969767441860465
Random 50%: 0.7066279069767443
Diferent operator: 0.7034883720930233
Each choice: 0.6918604651162791
First to Last: 0.6918604651162791
Random mix: 0.6918604651162791
---
FIND
The avarege
Random 100%: 0.45484949832775917
Random 10%: 0.42026755852842806
Random 20%: 0.4162207357859532
Random 50%: 0.43946488294314384
Diferent operator: 0.4414715719063545
Each choice: 0.431438127090301
First to Last: 0.46488294314381273
Random mix: 0.431438127090301
Random 100%: 0.903010033444816
Random 10%: 0.8738795986622074
Random 20%: 0.8743478260869565
Random 50%: 0.9006020066889632
Diferent operator: 0.8862876254180602
Each choice: 0.8862876254180602
First to Last: 0.8896321070234113
Random mix: 0.8862876254180602
---
FOURBALLS
The avarege
Random 100%: 0.9383561643835616
Random 10%: 0.9353767123287671
Random 20%: 0.934486301369863
Random 50%: 0.9354794520547947
Diferent operator: 0.9315068493150684
Each choice: 0.9383561643835616
First to Last: 0.9315068493150684
Random mix: 0.934931506849315
Random 100%: 0.8321917808219178
Random 10%: 0.819486301369863
Random 20%: 0.820958904109589
Random 50%: 0.8300000000000001
Diferent operator: 0.8253424657534246
Each choice: 0.8287671232876712
First to Last: 0.8287671232876712
Random mix: 0.821917808219178
---
MID
The avarege
Random 100%: 0.9810725552050473
Random 10%: 0.9747003154574133
Random 20%: 0.9786119873817035
Random 50%: 0.9805993690851735
Diferent operator: 0.9873817034700315
Each choice: 0.9810725552050473
First to Last: 0.9873817034700315
Random mix: 0.9716088328075709
Random 100%: 0.7255520504731862
Random 10%: 0.6498422712933754
Random 20%: 0.6914511041009463
Random 50%: 0.7230914826498422
Diferent operator: 0.7129337539432177
Each choice: 0.7255520504731862
First to Last: 0.7255520504731862
Random mix: 0.7255520504731862
---
TRIANGULO
The avarege
Random 100%: 0.9983471074380166
Random 10%: 0.9945289256198347
Random 20%: 0.9966776859504133
Random 50%: 0.9983471074380166
Diferent operator: 0.9983471074380166
Each choice: 0.9983471074380166
First to Last: 0.9983471074380166
Random mix: 0.9983471074380166
Random 100%: 0.7636363636363637
Random 10%: 0.6923305785123968
Random 20%: 0.7297190082644628
Random 50%: 0.7553223140495868
Diferent operator: 0.71900826446281
Each choice: 0.7041322314049587
First to Last: 0.7057851239669422
Random mix: 0.7090909090909091
BISECT
The avarege
Random 100%: 0.3664670658682635
Random 10%: 0.3205988023952096
Random 20%: 0.34161676646706585
Random 50%: 0.3395808383233533
Diferent operator: 0.0658682634730539
Each choice: 0.0658682634730539
First to Last: 0.0658682634730539
Random mix: 0.0658682634730539
Random 100%: 0.9940119760479041
Random 10%: 0.941437125748503
Random 20%: 0.9501796407185629
Random 50%: 0.9829940119760479
Diferent operator: 0.9281437125748503
Each choice: 0.9281437125748503
First to Last: 0.9281437125748503
Random mix: 0.9281437125748503
---
BUB
The avarege
Random 100%: 0.9049180327868853
Random 10%: 0.6560655737704919
Random 20%: 0.8262295081967213
Random 50%: 0.9119672131147541
Diferent operator: 0.9098360655737705
Each choice: 0.9098360655737705
First to Last: 0.9016393442622951
Random mix: 0.9016393442622951
Random 100%: 0.9918032786885246
Random 10%: 0.9563934426229509
Random 20%: 0.9744262295081967
Random 50%: 0.988032786885246
Diferent operator: 0.9836065573770492
Each choice: 0.9672131147540983
First to Last: 0.9672131147540983
Random mix: 0.9672131147540983
---
FIND
The avarege
Random 100%: 0.3792592592592593
Random 10%: 0.3526666666666667
Random 20%: 0.3592222222222222
Random 50%: 0.37974074074074077
Diferent operator: 0.35555555555555557
Each choice: 0.3851851851851852
First to Last: 0.35555555555555557
Random mix: 0.34814814814814815
Random 100%: 0.9962962962962963
Random 10%: 0.9640370370370371
Random 20%: 0.9645555555555556
Random 50%: 0.9936296296296295
Diferent operator: 0.9777777777777777
Each choice: 0.9777777777777777
First to Last: 0.9814814814814815
Random mix: 0.9777777777777777
---
FOURBALLS
The avarege
Random 100%: 0.9209876543209877
Random 10%: 0.9224279835390947
Random 20%: 0.9209876543209877
Random 50%: 0.9226748971193416
Diferent operator: 0.9135802469135802
Each choice: 0.9218106995884774
First to Last: 0.9176954732510288
Random mix: 0.9259259259259259
Random 100%: 0.9958847736625515
Random 10%: 0.9806172839506172
Random 20%: 0.9823868312757201
Random 50%: 0.9932510288065844
Diferent operator: 0.9876543209876543
Each choice: 0.9917695473251029
First to Last: 0.9917695473251029
Random mix: 0.9835390946502057
---
MID
The avarege
Random 100%: 0.9752173913043479
Random 10%: 0.9647826086956522
Random 20%: 0.9703043478260869
Random 50%: 0.9737826086956521
Diferent operator: 0.9739130434782609
Each choice: 0.9695652173913043
First to Last: 0.9739130434782609
Random mix: 0.9739130434782609
Random 100%: 0.9956521739130435
Random 10%: 0.8921739130434783
Random 20%: 0.9489130434782609
Random 50%: 0.9923478260869566
Diferent operator: 0.9782608695652174
Each choice: 0.9956521739130435
First to Last: 0.9956521739130435
Random mix: 0.9956521739130435
---
TRIANGULO
The avarege
Random 100%: 0.9978354978354979
Random 10%: 0.9923809523809525
Random 20%: 0.996103896103896
Random 50%: 0.9978354978354979
Diferent operator: 0.9458874458874459
Each choice: 0.9458874458874459
First to Last: 0.9458874458874459
Random mix: 0.9458874458874459
Random 10%: 0.9049567099567098
Random 20%: 0.9538744588744589
Random 50%: 0.986948051948052
Diferent operator: 0.9393939393939394
Each choice: 0.922077922077922
First to Last: 0.922077922077922
Random mix: 0.9264069264069265
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment