function [error] = min_ratio(X, I)
pts = I.pts;
index = I.index;
ind = setdiff(1:size(pts,1), index);
pts_x = pts(:,1);
pts_y = pts(:,2);
pts_x(ind) = X(:,1);
pts_y(ind) = X(:,2);



% cla
% plot(pts_x, pts_y, 'or'); hold on;
% text(pts_x, pts_y, num2str((1:length(pts_x))'));
% plot(I.O(:,1), I.O(:,2), 'og');
% axis([-3 3 -3 3]);
% axis tight;
% drawnow;

error = 0;
for i=1:size(pts_x,1)
    for j=1:length(pts_x)
        RATIO(i, j) = sqrt((pts_x(j) - pts_x(i))^2+ (pts_y(j) - pts_y(i))^2);                
    end
end
error = sum(sum((RATIO - I.ratio).^2));
error = sqrt(error);

