%define the number of spheres the model has to place
n=7;
K=2;

% Define a symmetric matrix P
P = sdpvar(n,n) ;
%objective function
alpha=sdpvar(1,1);

%SDP matrix
Constraints =[P>=0,diag(P)==eye];

%Schur complement
%X=sdpvar(K,n);
%Constraints = Constraints + [X(i,j)>=-1, X(i,j)<=1];
%M = [ eye(K) X; X' P ];
%Constraints = Constraints+[ M >= 0 ];

%non-overlapping interior
for i = 1:n
	for j = 1 : n
		if (i != j)
			Constraints= Constraints+[P(i,j)<=1/2, 2-2*P(i,j)>=alpha(1,1), P(i,j)>=-1, P(i,j)<=1 ];
		end
	end
end

Objective= [-alpha];
optimize(Constraints,Objective);

Pfeasible = value(P);
display('Solution:');
display(Pfeasible);