public static void main(final String[] args) throws Exception {
		// Start timing
		final long t = System.currentTimeMillis();

		// check arguments
		if (args.length != 3 && args.length != 4)
			usage();

		// Initialize middleware
		Comm.init (args);
		
		// load data
		Resources.loadFromFile(args[0], args[1], args[2]);

		// initialize algorithm
		final Population pop = new Population(Resources.getCachedSortedSectionIds().length);
		
		
		// determine number of generation to run
		final int gen = Integer.parseInt(System.getProperty("fes.ga.gen", "500"));

		// repeat for number of generations
		for( int i = 0; i < gen; i++ )
			// calculate next generation
			pop.nextGeneration();
		
		// save result to file
		final Schedule best = pop.getBest();
		if(args.length == 4) {
			final File outputfile = new File(args[3]);
			outputfile.createNewFile();
			final PrintStream ps = new PrintStream(outputfile);
			ps.println(best);
			ps.flush();
			ps.close();
		}

		// print out timing and stats
		final int[] counters = best.getCounters();
		System.out.println("" + (System.currentTimeMillis()-t) + "\t" + best.getRank() + "\t"
				+ counters[Schedule.SE_COUNTER] + "\t"
				+ counters[Schedule.CE_COUNTER] + "\t"
				+ counters[Schedule.ME_COUNTER] + "\t"
				+ counters[Schedule.FE_COUNTER]);
	}