public static Game createGame(Round round, int counter) { String gameName = String.format("%s_%d", round.getLevel().getTournament().getTournamentName(), counter); Game game = new Game(); game.setGameName(gameName); game.setRound(round); game.setState(GameState.boot_pending); game.setStartTime(round.getStartTime()); game.setLocation(randomLocation(round)); game.setSimStartTime(randomSimStartTime(game.getLocation())); game.setServerQueue(Utils.createQueueName()); game.setVisualizerQueue(Utils.createQueueName()); return game; }
private void singleRound( BufferedWriter bw, String prefix, Round round, Map<Broker, double[]> resultMap) throws IOException { bw.write(prefix + "roundId;" + round.getRoundId() + separator); bw.write(prefix + "roundName;" + round.getRoundName() + separator); bw.write(prefix + "status;" + round.getState() + separator); bw.write(prefix + "StartTime;" + Utils.dateToStringFull(round.getStartTime()) + separator); bw.write(prefix + "Date from;" + Utils.dateToStringFull(round.getDateFrom()) + separator); bw.write(prefix + "Date to;" + Utils.dateToStringFull(round.getDateTo()) + separator); bw.write(prefix + "MaxBrokers;" + round.getMaxBrokers() + separator); bw.write(prefix + "Registered Brokers;" + round.getBrokerMap().size() + separator); // bw.write(prefix + "MaxAgents;" + round.getMaxAgents() + separator); bw.write(prefix + "size1;" + round.getSize1() + separator); bw.write(prefix + "multiplier1;" + round.getMultiplier1() + separator); bw.write(prefix + "size2;" + round.getSize2() + separator); bw.write(prefix + "multiplier2;" + round.getMultiplier2() + separator); bw.write(prefix + "size3;" + round.getSize3() + separator); bw.write(prefix + "multiplier3;" + round.getMultiplier3() + separator); bw.write(prefix + "pomId;" + round.getPomId() + separator); bw.write(prefix + "Locations;" + round.getLocations() + separator); double[] avgsAndSDs = round.getAvgsAndSDsArray(resultMap); if (resultMap == null || resultMap.size() == 0 || avgsAndSDs == null) { return; } bw.write(separator); bw.write(prefix + "Average type 1;" + avgsAndSDs[0] + separator); bw.write(prefix + "Average type 2;" + avgsAndSDs[1] + separator); bw.write(prefix + "Average type 3;" + avgsAndSDs[2] + separator); bw.write(prefix + "Standard deviation type 1;" + avgsAndSDs[3] + separator); bw.write(prefix + "Standard deviation type 2;" + avgsAndSDs[4] + separator); bw.write(prefix + "Standard deviation type 3;" + avgsAndSDs[5] + separator); bw.write(separator); bw.write( prefix + "brokerId;brokerName;Size 1;Size 2;Size 3;" + "Total (not normalized);Size 1;Size 2;Size3;Total (normalized)" + separator); for (Map.Entry<Broker, double[]> entry : resultMap.entrySet()) { double[] results = entry.getValue(); bw.write( String.format( "%s%s;%s;%f;%f;%f;%f;%f;%f;%f;%f%s", prefix, entry.getKey().getBrokerId(), entry.getKey().getBrokerName(), results[0], results[1], results[2], results[3], results[10], results[11], results[12], results[13], separator)); } }