function [mu,sigma2,ci] = CS_driver_small_gen(n1,n2,m,k,num_samps,...
    num_trials)
% CS_driver_small_gen - driver function for small consistent general KBs
% On input:
%     n1 (int): lower number of atoms
%     n2 (int): upper number of atoms
%     m (int): max number of clauses
%     k (int): max number of literals in a clause
%     num_samps (int): number of KBs in a trial
%     num_trials (int): number of trials
% On output:
%     mu ((n2-n1+1)x1 vector): average success rate
%     sigma2 ((n2-n1+1)x1 vector):variance in success trials
%     ci ((n2-n1+1)x1 vector): confidence interval half-length
% Call:
%     [mu,sigma2,ci] = CS_driver_small_gen(10,20,20,5,100,10);
% Author:
%     T. Henderson
%     UU
%     Fall 2022
%

t_100_0_95 = 1.833;
num_n = n2 - n1 + 1;
mu = zeros(num_n,1);
sigma2 = zeros(num_n,1);
ci = zeros(num_n,1);

res = zeros(num_trials,1);
rng('default');

for n = n1:n2
    for t = 1:num_trials
        [n,t,num_trials]
        r = CS_EX1_small_gen(n,m,k,num_samps);
        res(t) = sum(r>0)/num_samps;
    end
    
    mu(n-n1+1) = mean(res);
    sigma2(n-n1+1) = var(res);
    ci(n-n1+1) = t_100_0_95*sqrt(sigma2(n-n1+1)/num_trials);
end
