%% Generate data for portfolio with chance constraint problem
n=50;
mu_base=1.05;
% mu is linearly spaced from 1.05 + .25~ 1.05 with n points excluding first entry
mu = linspace(mu_base+0.25*((n-1)/n),mu_base,n); 
Sigma=zeros(n,n);
sigma_base=.25;
% We make each asset be positively and negatively correlated with one element.

S_pre_permute = (circshift(eye(n), 1) + circshift(eye(n), -1) ...
                 - circshift(eye(n), 2) - circshift(eye(n), -2));

% Random permutation matrix
perm = randperm(n);
P = eye(n);
P = P(perm, :);
S = P' * S_pre_permute * P;

% Make sure covariance matrix is positive semidefinite
sigma_diag = linspace(sigma_base, 0, n);
Sigma = (diag(sigma_diag) +...
         diag(sigma_diag.^(.5)) * S * diag(sigma_diag.^(.5)) / 4);
Sigma(:, n) = 0;
Sigma(n, :) = 0;

epsilons = [.1, .05, .01, .005];


