int run(Network& input, HierarchicalNetwork& output)
{
	try
	{
		runInfomap(input.config(), input, output);
	}
	catch (std::exception& e)
	{
		std::cerr << e.what() << std::endl;
		return 1;
	}
	return 0;
}
Ejemplo n.º 2
0
	bool operator()(const ServerConfigPtr c1, const ServerConfigPtr c2) {
		assert(c1->network == c2->network);
		assert(c1->network == n_->config());

		int prio1 = c1->priority + n_->serverUndesirability(c1);
		int prio2 = c2->priority + n_->serverUndesirability(c2);

		if(prio1 != prio2) {
			return prio1 < prio2;
		}

		// Assign random values to ServerConfigs having the same
		// corrected prio's. These need to be stored because a
		// comparator must be consistent and transitive, so
		// subsequent calls to the operator()() function must agree
		// with the return value of this call.
		if(!contains(randomValues, c1)) {
			randomValues[c1] = rand();
		}
		if(!contains(randomValues, c2)) {
			randomValues[c2] = rand();
		}
		return randomValues[c1] < randomValues[c2];
	}