function test_KB = BR_gen_study_KB_gen(num_KB,n,max_sentences,max_clause)
%

count = 0;
while count<num_KB
    [KB,ccp] = BR_gen_test_KB(n,max_sentences,max_clause);
    num_vars = length(BR_vars(KB,[]));
    if ~isempty(KB)&(num_vars==n)
        count = count + 1
        test_KB(count).KB = KB;
        test_KB(count).ccp = ccp;
        ap = BR_cc_probs2ap(ccp);
        test_KB(count).ap = ap;
    end
end
