public void init() {
		run = true;
		runcount = 0;
		globalAvg = 0;
		lastAvg = 0;
		globalTotal = 0;
		migrations = 0;
		opinion_changes = 0;
		// the divisor is usually best at 1000
		threshold = Constants._epsilon * Constants._mu / 1000;
		agents = new ArrayList<Agent>();
		groups = new ArrayList<Group>();
		agents.clear();
		groups.clear();
		for (int i = 0; i < Constants._groups; i++) {
			Group group = new Group("G-" + i);
			groups.add(group);
			groupnum++;
		}
		for (int i = 0; i < Constants._numnodes; i++) {
			if (Constants._murand) {
				Agent agent = new Agent(i, "A-" + i, gen.nextDouble(), randMu());
				agents.add(agent);
			} else if (Constants.muCheck) {
				Agent agent = new Agent(i, "A-" + i, gen.nextDouble(),
						Constants.muIncS);
				agents.add(agent);
			} else {
				Agent agent = new Agent(i, "A-" + i, gen.nextDouble(),
						Constants._mu);
				agents.add(agent);
			}
		}
		for (int i = 0; i < agents.size(); i++) {
			int g = gen.nextInt(groups.size());
			agents.get(i).setGroup(groups.get(g));
			groups.get(g).getAgents().add(agents.get(i));
		}
		for (Group g : groups) {
			g.calcavg();
		}
		graph = new Graph(agents, groups, Constants);
		graph.Constants = this.Constants;
	}