package base;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] home=new String[6000];
String[] visit=new String[6000];
int[] point_h=new int[6000];
int[] point_v=new int[6000];
String[] dic=new String[6000];
int[] count=new int[13];
int[] countx=new int[13];
double[] power=new double[21];
int[] p=new int[21];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
readfile sub=new readfile();
sub.makedata("data.csv","UTF-8");
data=sub.data;
datanumber=sub.datanumber;
int sx=0;
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
if(x.length>2){
sx=sx+1;
home[sx]=x[4];
visit[sx]=x[3];
point_v[sx]=Integer.parseInt(x[5]);
point_h[sx]=Integer.parseInt(x[6]);
}
}
int number=sx;
System.out.println(number);
int dicnumber=0;
for(s=1;s<number+1;s++){
int h=0;
for(sx=1;sx<dicnumber+1;sx++){
if(home[s].equals(dic[sx]))h=100;
}
if(h<50)dicnumber=dicnumber+1;
if(h<50)dic[dicnumber]=home[s];
}
for(s=1;s<13;s++){
for(sx=1;sx<number+1;sx++){
if(dic[s].equals(home[sx]))count[s]=count[s]+point_h[sx];
if(dic[s].equals(visit[sx]))count[s]=count[s]+point_v[sx];
if(dic[s].equals(home[sx]))countx[s]=countx[s]+point_v[sx];
if(dic[s].equals(visit[sx]))countx[s]=countx[s]+point_h[sx];
}
}
for(s=1;s<13;s++){
for(sx=1;sx<number+1;sx++){
int h=0;
if(dic[s].equals(home[sx]))h=h+1;
if(point_h[sx]>point_v[sx])h=h+1;
if(h==2)power[s]=power[s]+1;
h=0;
if(dic[s].equals(visit[sx]))h=h+1;
if(point_v[sx]>point_h[sx])h=h+1;
if(h==2)power[s]=power[s]+1;
}
}
double[][] x=new double[20][5];
for(s=1;s<13;s++){
x[s][1]=1;
x[s][2]=count[s]-countx[s];
}
double[] sol=new double[5];
ols sub3=new ols();
sub3.datanumber=12;
sub3.number=2;
sub3.x=x;
sub3.y=power;
sub3.makedata();
sol=sub3.sol;
for(s=1;s<13;s++){
System.out.println(dic[s]);
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package base;
public class ols {
int s,s1,s2;
int datanumber,number;
double x1;
double[][] a=new double[100][100];
double[] b=new double[100];
double[] y=new double[1000];
double[][] x=new double[1000][10];
double[] sol=new double[100];
void makedata(){
for(s1=1;s1<number+1;s1++){
for(s2=1;s2<number+1;s2++){
x1=0;
for(s=1;s<datanumber+1;s++){
x1=x1+x[s][s1]*x[s][s2];
}
a[s1][s2]=x1;
}
}
for(s1=1;s1<number+1;s1++){
x1=0;
for(s=1;s<datanumber+1;s++){
x1=x1+x[s][s1]*y[s];
}
b[s1]=x1;
}
double z;
for(s1=1;s1<number+1;s1++){
for(s2=1;s2<number+1;s2++){
z=a[s2][s1]/a[s1][s1];
if(s1==s2)z=0;
for(s=1;s<number+1;s++){
a[s2][s]=a[s2][s]-z*a[s1][s];
}
b[s2]=b[s2]-z*b[s1];
}
}
for(s1=1;s1<number+1;s1++){
sol[s1]=b[s1]/a[s1][s1];
}
}
}
最終更新:2016年04月07日 10:46