function [res,maxes] = CS_EX1_large(num_trials,sat)
% CS_EX1_large - Experiment 1 results on large KBs (600 vars)
%    ~50K clauses; KBs in Experiment1: LARGE1, ...
% On input:
%     num_trials (int): number of KBs to test
%     sat (Boolean): 1 SAT; 0 UNSAT
% On output:
%     res (num_trials x 1 vector): 1 if soution found; else 0
%     maxes (num_trialsx1 vector): max distance projection
% Call:
%     [res,maxes] = CS_EX1_large(100,1);
% Author:
%     T. Henderson
%     UU
%     Fall 2022
%

TOL = 0.01;

res = zeros(num_trials,1);  % 1 if solution found; else 0
maxes = zeros(num_trials,1);
wb = waitbar(0,'Large Projections');
for t = 1:num_trials
    waitbar(t/num_trials);
    if sat==1
        KB = CS_SATCNF2KB(['LARGE',num2str(t),'.cnf']);
    else
        KB = CS_SATCNF2KB(['LARGE',num2str(t),'.cnf']);
    end
    n = max(CS_vars(KB,[]));
    max_dist = sqrt(n-2)/2 + TOL;
    pc = 0.5*ones(n,1);
    [p,proj] = CS_EX1_projections(KB);
    res(t) = max(p)>max_dist;
    maxes(t) = max(p);
end
close(wb);

tch = 0;
