List of usage examples for java.util Scanner hasNext
public boolean hasNext()
From source file:unalcol.termites.boxplots.ECALMessages.java
/** * Creates a sample dataset.//from w w w.ja v a2 s.co m * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf, BoxAndWhiskerRenderer renderer) { final int seriesCount = 5; final int categoryCount = 4; final int entityCount = 22; String sDirectorio = ".\\experiments\\ECAL CR"; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); String[] aMode = { "random", "levywalk", "sandc" }; //String[] aMode = {"lwphclwevap", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); list.add(new Double(avgSend)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf + "\n", getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.ECALAgentsRight.java
/** * Creates a sample dataset.//from w w w . j a va 2 s . c o m * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) { final int seriesCount = 5; final int categoryCount = 4; final int entityCount = 22; String sDirectorio = ".\\experiments\\ECAL CR"; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); String[] aMode = { "random", "levywalk", "sandc" }; //String[] aMode = {"turnoncontact", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); //if (bestRoundNumber != 0 && bestRoundNumber != -1) { list.add(new Double(agentsCorrect)); //} } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.ECALRoundNumber.java
/** * Creates a sample dataset.//from ww w . j a v a 2 s . c om * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) { final int seriesCount = 5; final int categoryCount = 4; final int entityCount = 22; String sDirectorio = ".\\experiments\\ECAL CR"; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); String[] aMode = { "random", "levywalk", "sandc" }; //String[] aMode = {"turnoncontact", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); if (bestRoundNumber != 0 && bestRoundNumber != -1) { list.add(new Double(bestRoundNumber)); } } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.MessagesSent1.java
/** * Creates a sample dataset./*from ww w . j a v a 2 s . c o m*/ * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) { final int seriesCount = 5; final int categoryCount = 4; final int entityCount = 22; String sDirectorio = experimentsDir; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment") && file.getName().contains(mazeMode)) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); //String[] aMode = {"random", "levywalk", "sandc", "sandclw"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); list.add(new Double(avgSend)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.MessagesSent2.java
/** * Creates a sample dataset./*w w w . j a v a 2s. com*/ * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf, BoxAndWhiskerRenderer renderer) { final int seriesCount = 5; final int categoryCount = 4; final int entityCount = 22; String sDirectorio = ".\\experiments\\2015-10-14-Maze\\results"; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); String[] aMode = { "levywalk", "lwphevap", "hybrid" }; //String[] aMode = {"sandclw", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; //String[] aMode = {"lwphclwevap", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); list.add(new Double(avgSend)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf + "\n", getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.RoundNumber2.java
/** * Creates a sample dataset.//from w ww . j a va2 s. com * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) { final int seriesCount = 5; final int categoryCount = 4; final int entityCount = 22; String sDirectorio = ".\\experiments\\2015-10-14-Maze\\results"; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); //String[] aMode = {"sandclw", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; //String[] aMode = {"turnoncontact", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; String[] aMode = { "levywalk", "lwphevap", "hybrid" }; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); if (bestRoundNumber != 0 && bestRoundNumber != -1) { list.add(new Double(bestRoundNumber)); } } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.BestAgentsPercentageInfoCollected.java
/** * Creates a sample dataset./*w ww . ja v a 2s . c o m*/ * * @return A sample dataset. */ private void createSampleDataset(ArrayList<Double> Pf, Hashtable<String, List> info) { String sDirectorio = experimentsDir; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Scanner sc = null; for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment") && file.getName().contains(mazeMode)) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} /*System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); */ //String[] aMode = {"sandclw", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; //String[] aMode = {"levywalk", "lwphevap", "hybrid", "hybrid3", "hybrid4", "sequential"}; // String[] aMode = {"turnoncontact", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); if (agentsCorrect > 0 && Pf.contains(pf)) { //list.add(100.0); if (info.get(mode + "+" + popsize) == null) { info.put((mode + "+" + popsize), new ArrayList<Integer>()); } info.get(mode + "+" + popsize).add(100.0); //System.out.println(mode + "-entra!"); //list.add(new Double(averageExplored / (double) worldSize * 100)); } } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); //if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ /*if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); }*/ //} } } } }
From source file:unalcol.termites.boxplots.InformationCollected2.java
/** * Creates a sample dataset.// w w w . j a v a 2s . c om * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) { final int seriesCount = 5; final int categoryCount = 4; final int entityCount = 22; String sDirectorio = ".\\experiments\\2015-10-14-Maze\\results"; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); //String[] aMode = {"sandclw", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; String[] aMode = { "levywalk", "lwphevap", "hybrid" }; // String[] aMode = {"turnoncontact", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); list.add(new Double(averageExplored / (double) worldSize * 100)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.InformationCollected1.java
/** * Creates a sample dataset.//from ww w . j a va 2 s .c o m * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) { String sDirectorio = experimentsDir; System.out.println("experiments dir" + sDirectorio); File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment") && file.getName().contains(mazeMode)) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); //String[] aMode = {"random", "levywalk", "sandc", "sandclw"}; //String[] aMode = {"levywalk", "lwphevap", "hybrid", "hybrid3", "hybrid4", "sequential"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); list.add(new Double(averageExplored / (double) worldSize * 100)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }
From source file:unalcol.termites.boxplots.RoundNumber1.java
/** * Creates a sample dataset.//from w w w . j ava 2s. c o m * * @return A sample dataset. */ private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) { String sDirectorio = experimentsDir; File f = new File(sDirectorio); String extension; File[] files = f.listFiles(); Hashtable<String, String> Pop = new Hashtable<>(); PrintWriter escribir; Scanner sc = null; ArrayList<Integer> aPops = new ArrayList<>(); ArrayList<Double> aPf = new ArrayList<>(); ArrayList<String> aTech = new ArrayList<>(); final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (File file : files) { extension = ""; int i = file.getName().lastIndexOf('.'); int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\')); if (i > p) { extension = file.getName().substring(i + 1); } // System.out.println(file.getName() + "extension" + extension); if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment") && file.getName().contains(mazeMode)) { System.out.println(file.getName()); System.out.println("get: " + file.getName()); String[] filenamep = file.getName().split(Pattern.quote("+")); System.out.println("file" + filenamep[8]); int popsize = Integer.valueOf(filenamep[2]); double pf = Double.valueOf(filenamep[4]); String mode = filenamep[6]; int maxIter = -1; //if (!filenamep[8].isEmpty()) { maxIter = Integer.valueOf(filenamep[8]); //} System.out.println("psize:" + popsize); System.out.println("pf:" + pf); System.out.println("mode:" + mode); System.out.println("maxIter:" + maxIter); //String[] aMode = {"random", "levywalk", "sandc", "sandclw"}; //String[] aMode = {"levywalk", "lwphevap", "hybrid", "hybrid3", "hybrid4", "sequential"}; if (/*Pf == pf && */isInMode(aMode, mode)) { final List list = new ArrayList(); try { sc = new Scanner(file); } catch (FileNotFoundException ex) { Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName()) .log(Level.SEVERE, null, ex); } int agentsCorrect = 0; int worldSize = 0; double averageExplored = 0.0; int bestRoundNumber = 0; double avgSend = 0; double avgRecv = 0; double avgdataExplInd = 0; ArrayList<Double> acSt = new ArrayList<>(); ArrayList<Double> avgExp = new ArrayList<>(); ArrayList<Double> bestR = new ArrayList<>(); ArrayList<Double> avSnd = new ArrayList<>(); ArrayList<Double> avRecv = new ArrayList<>(); ArrayList<Double> avIndExpl = new ArrayList<>(); String[] data = null; while (sc.hasNext()) { String line = sc.nextLine(); //System.out.println("line:" + line); data = line.split(","); agentsCorrect = Integer.valueOf(data[0]); //agentsIncorrect = Integer.valueOf(data[1]); // not used worldSize = Integer.valueOf(data[3]); averageExplored = Double.valueOf(data[4]); // data[3] stdavgExplored - not used bestRoundNumber = Integer.valueOf(data[6]); avgSend = Double.valueOf(data[7]); avgRecv = Double.valueOf(data[8]); avgdataExplInd = Double.valueOf(data[11]); //Add Data and generate statistics acSt.add((double) agentsCorrect); avgExp.add(averageExplored); avSnd.add(avgSend); avRecv.add(avgRecv); avIndExpl.add(avgdataExplInd); if (bestRoundNumber != 0 && bestRoundNumber != -1) { list.add(new Double(bestRoundNumber)); } } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); if (Pf.contains(pf)) { /*pf == 1.0E-4 || pf == 3.0E-4*/ if (Pf.size() == 1) { dataset.add(list, popsize, getTechniqueName(mode)); } else { dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode)); } } } } } /*for (int i = 0; i < seriesCount; i++) { for (int j = 0; j < categoryCount; j++) { final List list = new ArrayList(); // add some values... for (int k = 0; k < entityCount; k++) { final double value1 = 10.0 + Math.random() * 3; list.add(new Double(value1)); final double value2 = 11.25 + Math.random(); // concentrate values in the middle list.add(new Double(value2)); } LOGGER.debug("Adding series " + i); LOGGER.debug(list.toString()); dataset.add(list, "Series " + i, " Type " + j); } }*/ return dataset; }