Esempio n. 1
0
ToRun::ToRun()
{
    string testInput = "1113122113";
    for (int i = 0; i < 50; i++){
        testInput = nextIteration(testInput);
    }
    int test = testInput.length();
}
Esempio n. 2
0
void StressMinimization::minimizeStress(
	GraphAttributes& GA,
	NodeArray<NodeArray<double> >& shortestPathMatrix,
	NodeArray<NodeArray<double> >& weightMatrix)
{
	const Graph& G = GA.constGraph();
	int numberOfPerformedIterations = 0;

	double prevStress = numeric_limits<double>::max();
	double curStress = numeric_limits<double>::max();

	if (m_terminationCriterion == STRESS) {
		curStress = calcStress(GA, shortestPathMatrix, weightMatrix);
	}

	NodeArray<double> newX;
	NodeArray<double> newY;
	NodeArray<double> newZ;

	if (m_terminationCriterion == POSITION_DIFFERENCE) {
		newX.init(G);
		newY.init(G);
		if (GA.has(GraphAttributes::threeD))
			newZ.init(G);
	}
	do {
		if (m_terminationCriterion == POSITION_DIFFERENCE) {
			if (GA.has(GraphAttributes::threeD))
				copyLayout(GA, newX, newY, newZ);
			else copyLayout(GA, newX, newY);
		}
		nextIteration(GA, shortestPathMatrix, weightMatrix);
		if (m_terminationCriterion == STRESS) {
			prevStress = curStress;
			curStress = calcStress(GA, shortestPathMatrix, weightMatrix);
		}
	} while (!finished(GA, ++numberOfPerformedIterations, newX, newY, prevStress, curStress));

	Logger::slout() << "Iteration count:\t" << numberOfPerformedIterations
		<< "\tStress:\t" << calcStress(GA, shortestPathMatrix, weightMatrix) << endl;
}
void BinaryVector::iterateForQTimes(int q) {
    for (int i = 0; i < q; i++) {
        nextIteration();
    }
}