Simple GIS

GISプログラムの練習

最適非線形価格

package non4;



public class pro {

     int s,t;
    double th=new double[101];
int x=new int[101];
int p=new int[101];
int cost;


    public static void main(String args) {
        pro test=new pro();
    }

 pro(){


    for(s=1;s<101;s++){
     th[s]=5*s;
    }

     cost=20;
     
    linear sub=new linear();
    sub.cost=cost;
    sub.th=th;
    sub.makedata();
    x=sub.x;
    p=sub.p;

    int h,time;
    
 for(time=1;time<10;time++){

non sub2=new non();
sub2.cost=cost;
sub2.x=x;
sub2.p=p;
sub2.th=th;
sub2.makedata();
x=sub2.x;
p=sub2.p;
     

 }     
 
 double pp;
 pp=0;
 for(s=1;s<100;s++){
 if(x[s+1]>x[s])pp=(p[s+1]-p[s])/(x[s+1]-x[s]);
 if(x[s+1]>x[s])System.out.println(x[s]+","+pp);
 }
 
 
}
}