/** * Created with IntelliJ IDEA. * User: rebeccamancy * Date: 07/11/2013 * Time: 11:32 * To change this template use File | Settings | File Templates. */ public class QSDOld { // QSD slice contains a 2xN array containing time spent (row 1) in states (row 2); states in decimal private double[] QSDTimes; // 2 row array of times and states private String[] QSDStates; // Store as strings as there could be lots of patches / states private int[] QSDNumActive; // Store num patches active to help with indexing private int arrPointer; // Pointer to the current number of states stored (array index) private double totalTime; private double maxTime; /** * This doesn't appear to be used ... * @param QSDTimes * @param QSDStates * @param QSDNumActive */ public QSDOld(double[] QSDTimes, String[] QSDStates, int[] QSDNumActive) { this.QSDTimes = QSDTimes; this.QSDStates = QSDStates; this.QSDNumActive = QSDNumActive; } public QSDOld(int maxIndexed) { this.QSDTimes = new double[maxIndexed]; this.QSDStates = new String[maxIndexed]; this.QSDNumActive = new int[maxIndexed]; arrPointer = 0; totalTime = 0; } /* *//** * Construct the QSD * @param eco * @param numSims * @param timeWindowLength * @param numDraws * @param rhatThreshold *//* public QSD(Ecology eco, int numSims, int timeWindowLength, int numDraws, double rhatThreshold, int maxIndexed) { this.QSDTimes = new double[maxIndexed]; this.QSDStates = new String[maxIndexed]; this.QSDNumActive = new int[maxIndexed]; arrPointer = 0; totalTime = 0; int numPatches = eco.getHab().getNumPatches(); double[] rhat = new double[numPatches]; // assume zero initialisation far enough away from one // Initialise the simulators (one per "run") Simulator[] sims = new Simulator[numSims]; // one per "run" for (int sim=0; sim rhatThreshold) { // Simulate the next time window, collecting states at sample points into an array (rows=sample points; cols=seqs) for (Simulator sim:sims) { testqsd = sim.runDeOliveira(numSims, timeWindowLength, false, maxIndexed); } // For each patch, collect current excerpts per patch from sim into array, update sequences, and calculate rhat for (int patch = 0; patch numEvents) { numEvents = sim.getNumEvents(); } } numEvents = 10*numEvents; // Run forward on simulator 0, resetting time to zero for start sims[0].setTime(0); sims[0].run4QSD(this,numEvents,false); // Using the first simulator //Util.print(QSDTimes); // Output as binary strings for (int i=0; i