function out = optNodes2(deltaRatio, to, from, step, maxNodes, maxPerNode)
if nargin < 6, maxPerNode = 4; end
if nargin < 5, maxNodes = 6; end
if nargin < 4, step = 4; end
if nargin < 3, from = 4; end
if nargin < 2, to = 24; end

out = cell(0,0);
i = 0;

for p = from:step:to

  [valid, perNode, nodes] = getNodePerNode(p,maxNodes,maxPerNode);
  if (valid)
    i = i + 1;

    if (deltaRatio<0)
      delta = round(-deltaRatio);
    else
      delta = round(p * deltaRatio);
    end
    delta = max(delta, 1);
    delta = min(delta, p-1);

    out{i} = [ struct('key','perNode','value',num2str(perNode)) struct('key','nodes','value',num2str(nodes)) struct('key','delta','value',num2str(delta)) ];
  else
    disp(sprintf('Warning: Cannot decompose P=%g into {perNode,nodes} pair using maxNodes=%g,maxPerNode=%g',p,maxNodes,maxPerNode));
  end

end

end
