Package corn

Source Code of corn.RunCornSimulation

package corn;

import org.apache.commons.math3.random.RandomDataImpl;
import org.apache.commons.math3.random.RandomGenerator;
import org.apache.commons.math3.random.Well44497b;

public class RunCornSimulation {
  public static void main(String[] args){
    //parse the arguments
//    if(args.length<5){
//      System.err.println("Too fewer arguments were entered. Use CornSimulation as: java CornSimulation kernelNum rowNum hapNum groupNum neighborType simSize");
//    }
//    int kernelNum =Integer.parseInt(args[0]);
//    int rowNum = Integer.parseInt(args[1]);
//    int haploidNum = Integer.parseInt(args[2]);
//    int groupNum = Integer.parseInt(args[3]);
//    NeighborType ntype = NeighborType.FourNeighbor;
//    if(args[4].equals("8")){
//      ntype = NeighborType.EightNeighbor;
//    }
//    int simSize = 1000000;
//    if(args.length>5){
//      simSize = Integer.parseInt(args[5]);
//    }
    int kernelNum = 6;
    int rowNum = 2;
    int haploidNum = 2;
    int groupNum = 1;
    int simSize = 1000000;
    CornSurface myCornSurface = new CornSurface(kernelNum,rowNum,haploidNum,groupNum);
    RandomGenerator rg = new Well44497b();
    RandomDataImpl rng = new RandomDataImpl(rg);
//    CornSimulation myCornSimulation = new CornSimulation(myCornSurface,rng,simSize);
//    System.out.println("The pvalue for four neighbor group is: " + myCornSimulation.simulate(NeighborType.FourNeighbor)+".");
//
//    System.out.println("The pvalue for eight neighbor group is: "+ myCornSimulation.simulate(NeighborType.EightNeighbor)+".");
  //  CornsSimulation corns = new CornsSimulation(2,rng,10000);
    CornsSimulation corns = new CornsSimulation(rng,10000);
   
//    //System.out.println("The overall pvalue for 4 neighbor is: "+corns.overallSimulation(NeighborType.FourNeighbor));
//    //System.out.println("The overall pvalue for 8 neighbor is: "+corns.overallSimulation(NeighborType.EightNeighbor));
    double pvalues[] = corns.overallSimulationBoth();
//   
    System.out.println("The overall pvalue for 4 neighbor is: "+pvalues[0]);
    System.out.println("The overall pvalue for 8 neighbor is: "+pvalues[1]);
  }
}
TOP

Related Classes of corn.RunCornSimulation

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.