global MAXF
global MINF

MINF = 10;
MAXF = 20;

% 2 symbols fudged to be one -- same cb for each
%cb = (MAXF-MINF)*rand(3,1) + MINF;
%cb = [cb cb];
% 2 symbols in random posns
%cb = (MAXF-MINF)*rand(3,2);

% 3 symbols along diagonal: 1 random, other 2 in corners
%cb = [MINF MINF; (MAXF-MINF)/2 (MAXF-MINF)/2; MAXF MAXF];
% 3 symbols: 1 random, other 2 in corners
%cb = [MINF MAXF; (MAXF-MINF)*rand(1,2) + MINF;MAXF MINF];

% 5 symbols: 1 random, other 4 in corners
cb = [MINF MAXF; (MAXF-MINF)*rand(1,2) + MINF;MAXF MINF; MINF MINF; MAXF MAXF];
% 5 symbols: random
%cb = (MAXF-MINF)*rand(5,2) + MINF;

M = size(cb, 1); % number of symbols
N = size(cb, 2); % number of neurons

eps = .01;
pr = UnEvenP(M, 1/M);
iters = 5000;
printIters = iters/100; % print every printIters iterations

for it=1:iters
  if ~(rem(it,printIters)-1)
    [MI, miDeriv] = miPois(cb,pr);
    fprintf('\n%d: %.4f:  ',it,MI);
    for s=1:M
      fprintf('[%.3f %.3f] ',cb(s,:));
    end
  end
  % cb = cb + eps*miDeriv;
  cb(2,:) = cb(2,:) + eps*miDeriv(2,:);

  cb = min(cb,MAXF);
  cb = max(cb,MINF);
 end
 fprintf('\n%d: %.4f:  ',it,MI);
 for s=1:M
   fprintf('[%.3f %.3f] ',cb(s,:));
 end
