% Random generator for qpmm testproblems
% Provide sizes:
% n: number of variables
% m: number of selection functions
% l: number of min-functions
% then call gen

% Length parameter ls; the larger ls the smaller the average set N_j 
ls=3;
Q=randn(n,n);
Q=Q'*Q;          % make Q positive definite
q=randn(1,n);
G=randn(m,n);
b=randn(m,1);
generateN=0;
while generateN==0
   %fprintf('  Generating N\n');
   N=zeros(l,ls*m);
   for i=1:l 
      N(i,:)=randperm(ls*m);
   end;
   N=N(:,1:m);
   if max(min(N'))<=m %every row of N contains at least one feasible index 
      generateN=1;
   end;
end;
for i=1:l
   N(i,:)=sort(N(i,:));
end;


