D
Denis Palas
Hi everybody
I am working on a search algorithm which involves certain categories:
A = {A11,A12,A13,A14,A15}
B= {B21,B22,B23}
C= {C31,C32,C33,C44}
and so on (Different Number of categories may exist for different problems)
The main function is a recursive function , and at each round , one category
is taken, some elements chosen according to certain criteria, and this
result is
joined with previous result, for example:
At first round , from A , A11,A14,A15 are chosen.
At second round , from B , B22,B23 is chosen and joined with A11,A14 and
A15:
Result Array:
A11 B22
A14 B22
A15 B22
A11 B23
A14 B23
A15 B23
and this process continues and this two dimensional result array contains
all the joined chosen elements of sets of categories.My code to use the
result array from previous round and join it with new values is working
fine. However , I need to have multiple versions of result array as
explained below:
My Question : Since at any point, the algorithm needs to backtrack , and
choose different values , I must keep a search tree of all the result arrays
found so far. I need to find a way to keep a version of my result array at
each round (result array which contains join of A and B , result array which
contains the join of A,B and C , result array which contains the join of
A,B,C and D , and so on ) so at any point I will be able to backtrack and
choose the appropriate result set.
Could you please advise how I can do this ?
Most Appreciated
Denis
I am working on a search algorithm which involves certain categories:
A = {A11,A12,A13,A14,A15}
B= {B21,B22,B23}
C= {C31,C32,C33,C44}
and so on (Different Number of categories may exist for different problems)
The main function is a recursive function , and at each round , one category
is taken, some elements chosen according to certain criteria, and this
result is
joined with previous result, for example:
At first round , from A , A11,A14,A15 are chosen.
At second round , from B , B22,B23 is chosen and joined with A11,A14 and
A15:
Result Array:
A11 B22
A14 B22
A15 B22
A11 B23
A14 B23
A15 B23
and this process continues and this two dimensional result array contains
all the joined chosen elements of sets of categories.My code to use the
result array from previous round and join it with new values is working
fine. However , I need to have multiple versions of result array as
explained below:
My Question : Since at any point, the algorithm needs to backtrack , and
choose different values , I must keep a search tree of all the result arrays
found so far. I need to find a way to keep a version of my result array at
each round (result array which contains join of A and B , result array which
contains the join of A,B and C , result array which contains the join of
A,B,C and D , and so on ) so at any point I will be able to backtrack and
choose the appropriate result set.
Could you please advise how I can do this ?
Most Appreciated
Denis