Code covered by the BSD License  

Highlights from
Supply Chain Risk Simulator (SCRS)

from Supply Chain Risk Simulator (SCRS) by Marco Anisetti
Supply Chain simulator for risk assessment and incentive schemes.

A1=coalition(n);
 function A1=coalition(n);
  %  This program calculates the 2^2-2 coalition constraints for
  %  cooperative game.If the no of players are more than 15 the execution
  %  time will be more.
 
for i=1:n-1
    k(i)=nchoosek(n,i);
end
A=zeros(2^n-2,n);
A1=A;
k1=1:n;
nn1=1;
for  i=1:n
x=nchoosek(k1,i);
[n1 n2]=size(x);
A(nn1:nn1+n1-1,1:n2)=x;
nn1=nn1+n1;
end
 m=sum(k);
for i=1:m
    for j=1:n
        kk=A(i,j);
        if kk>0
         A1(i,kk)=1;
        else
        end
        end
end

    
    
    

Contact us at files@mathworks.com