アットウィキロゴ

beni

public class gin02{
public static void main(String[] args) {
double cs1,cs2,xs1,xs2,uc1,ux1,uc2,ux2;
double x[][]=new double[10][14];
double op[]=new double[14];
double h;
double maxv,minv;
int m,n;
int maxn,maxm;
int t1,t2,t3;
int p,mx;
double x1,x2;
double z;
int px,j;
cs1=0.6;
xs1=0.4;
cs2=0.4;
xs2=0.6;
h=0.02;
t3=0;
while(t3<10){
h=h/2;
t2=0;
while (t2<30){
uc1=1/cs1;
ux1=1/xs1;
uc2=1/cs2;
ux2=1/xs2;
for (m=0;m<10;m++){
for (n=0;n<14;n++){
x[m][n]=0;
}
}

x[0][1]=uc1;
x[0][2]=ux1;
x[0][3]=uc2;
x[0][4]=ux2;

x[1][1]=1;
x[1][5]=1;
x[1][0]=cs1+h;

x[2][1]=-1;
x[2][6]=1;
x[2][0]=-cs1+h;

x[3][2]=1;
x[3][7]=1;
x[3][0]=xs1+h;

x[4][2]=-1;
x[4][8]=1;
x[4][0]=-xs1+h;

x[5][3]=1;
x[5][9]=1;
x[5][0]=cs2+h;

x[6][3]=-1;
x[6][10]=1;
x[6][0]=-cs2+h;

x[7][4]=1;
x[7][11]=1;
x[7][0]=xs2+h;

x[8][4]=-1;
x[8][12]=1;
x[8][0]=-xs2+h;

x[9][1]=1;
x[9][2]=1;
x[9][3]=1;
x[9][4]=1;
x[9][13]=1;
x[9][0]=2;

maxv=0;
maxn=999;
for (n=1;n<14;n++){
if (x[0][n]>maxv)maxn=n;
if (x[0][n]>maxv)maxv=x[0][n];
}

t1=0;
while(t1<100){
maxm=999;
minv=999;
for (m=1;m<10;m++){
x1=x[m][maxn];
px=0;
if (x1==0)px=100;
if (px>50)x1=100;
x2=x[m][0]/x1;
if (x2<0)x2=9999;
if (px>50)x2=9999;
if (x2<minv)maxm=m;
if (x2<minv)minv=x2;
}

for (m=0;m<10;m++){
z=x[m][maxn]/x[maxm][maxn];
if (m==maxm)z=0;
for (n=0;n<14;n++){
x[m][n]=x[m][n]-z*x[maxm][n];
}
}

maxv=0;
maxn=999;
for (n=1;n<14;n++){
if (x[0][n]>maxv)maxn=n;
if (x[0][n]>maxv)maxv=x[0][n];
}
t1=t1+1;
if (maxn>100)t1=1000;
}


for (n=1;n<14;n++){
op[n]=-999;
}

for (n=1;n<14;n++){
p=0;
mx=0;
for (m=0;m<10;m++){
if (x[m][n]>0)mx=m;
if (x[m][n]<0)mx=m;
if (x[m][n]==0)p=p+1;
}
if (p==9)op[n]=x[mx][0]/x[mx][n];
}

if (op[1]>-100)cs1=op[1];
j=0;
if (op[1]<-100)j=j+1;
if (op[5]>-100)j=j+1;
if (j==2)cs1=cs1+h-op[5];
j=0;
if (op[1]<-100)j=j+1;
if (op[5]<-100)j=j+1;
if (op[6]>-100)j=j+1;
if (j==3)cs1=cs1-h+op[6];
System.out.println(cs1);

if (op[2]>-100)xs1=op[2];
j=0;
if (op[2]<-100)j=j+1;
if (op[7]>-100)j=j+1;
if (j==2)xs1=xs1+h-op[7];
j=0;
if (op[2]<-100)j=j+1;
if (op[7]<-100)j=j+1;
if (op[8]>-100)j=j+1;
if (j==3)xs1=xs1-h+op[8];
System.out.println(xs1);

if (op[3]>-100)cs2=op[3];
j=0;
if (op[3]<-100)j=j+1;
if (op[9]>-100)j=j+1;
if (j==2)cs2=cs2+h-op[9];
j=0;
if (op[3]<-100)j=j+1;
if (op[9]<-100)j=j+1;
if (op[10]>-100)j=j+1;
if (j==3)cs2=cs2-h+op[10];
System.out.println(cs2);

if (op[4]>-100)xs2=op[4];
j=0;
if (op[4]<-100)j=j+1;
if (op[11]>-100)j=j+1;
if (j==2)xs2=xs2+h-op[11];
j=0;
if (op[4]<-100)j=j+1;
if (op[11]<-100)j=j+1;
if (op[12]>-100)j=j+1;
if (j==3)xs2=xs2-h+op[12];
System.out.println(xs2);
t2=t2+1;
}
t3=t3+1;
}



}
}
最終更新:2010年06月11日 08:40