Ralph Vince - Portfolio Mathematics

(Brent) #1

The Leverage Space Portfolio Model in the Real World 405


public MaxTWR4VARWithProbs(String[] args){
super(args);
}

public static void main(String[] args){
MaxTWR4VARWithProbs maxTWR4VARWithProbs = new
MaxTWR4VARWithProbs(args);
}

protected void getinputdata(String fileName){
String filetext = readInputFile(fileName);
lines = getArgs(filetext,”\r\n”);
N=lines.length-2;
NL=(long)N;
plays=new double[N][];
probs=new double[N][lines.length-2];
for(int i=0;i<lines.length;i++){
System.out.println(”line ”+i+” : ”+lines[i]);
if(i==0){
msnames = getArgs(lines[i],”,”);
}else if(i==1){
f=
convertStringArrayToDouble(getArgs(lines[i],”,”));
}else{

plays[i-2]=
convertStringArrayToDouble(getArgs(lines[i],”,”),i-2);
}
}
System.out.println(”b : ”+b);
if(usedrawdowninsteadofruin){
System.out.println(”pr of : drawdown”);
}else{
System.out.println(”pr of : ruin”);
}

}

protected double [] convertStringArrayToDouble(String
[] s,int lineno){
double [] d = new double[s.length];
probs[lineno]= new double[s.length];
for(int i = 0; i<s.length; i++){
String ss[] = getArgs(s[i],”;”);
try{
d[i]=Double.parseDouble(ss[0]);
probs[lineno][i]=Double.parseDouble(ss[1]);
Free download pdf