i have a task which is create an algorithm from a java code.and i need help from u guys to check on my algo put a comment on what should i change or why it is wrong.
I really appreciate if u could help me on this matter...
thanks a lot.
here is my algorithm:
Input: input configuration set,S (number of value for p1(v1), number of value for p2(v2),.....number of value for pn (vn)); number of interaction strength, t; number of parameter, p; Output: test case suite , A; begin initialize binary_list as empty binary set; choose binary sets (in parameter order p1,p2,... pn) where number of bit '1' equal to t; push binary sets into binary_list; while binary_list not empty for each binary_list: b = binary set //count number of value combination base on b; initialize count = 1; for (i <= p) if b(i) = '1'; v(i); count = count * v(i); end if end for initialize repetition = 1; for (i<= p) if b(i) = '1' initialize current_combination = 0; initialize temp as an empty set of temporary test set; while (current_combination < count) initialize v_o_p = 0; choose value where parameter (i); insert or update v_o_p into temp; repeat same value for repetition time; end while repetition = repetition * v(i) end if else if b(i) = '0' choose value from parameter (i) randomly; update temp; end for end for each end while //write candidates into final test set while temp is not empty pop 1st test case in temp and push into A; for each of test case in temp: tc = test case compare tc to test case in A; if (compare == 0) insert tc into A; else remove tc in temp; end for each end while
the brief explanation by example:
set of parameter: A:a1,a2,a3; B:b1,b2,b3; C:c1,c2,c3
number of parameter= 3
the value of each parameter = 3 for A, 3 for B, 3 for C
number of strength,t = 2
the set of binary in this case is = 3 (base on parameter orientation ABC)
operates for each binary set:
example for binary set no 1= 011;
starts from last bit which is '1';
so in empty set named temp for first bit should have:
2nd bit, temp should have (updated temp):
last round for 1st bit is '0', so should select randomly from parameter A's values:
this repeated until all binary sets operated with same operation.
then all data in temp will be compared to each other if no duplicate data, push into final_set.