Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int currentCycle = 0;
- while (currentCycle < MAX_CYCLES)
- {
- cout << "begin while loop" << endl;
- for (int i = 0; i < colony.size(); i++) // iterate through colony size to assign ants
- {
- vector<edge*> *ant = colony[i]; //create ant pointer
- vertex * currentNode = findVertex(start); //keep track of ant location
- while (currentNode != findVertex(end)) //loop each ant and begin movement calculations
- {
- //transition rule for movement
- float probNumer = 0;
- float probDenum = 0;
- float mover = 0.0;
- for (int j = 0; j< currentNode->edgeList.size(); j++) // access the size of each ants adjacentcy list
- {
- cout << "edge list size for current node " << currentNode->edgeList.size() << endl;
- cout << "current Node start " << currentNode->edgeList[j]->start->city << endl;
- //add the total edges and pheremone
- edge *e = currentNode->edgeList[j];
- if (e->end->visited ==false)
- {
- probDenum += powf(e->pheremone, alpha) * powf(1.0 / e->miles, beta);
- cout << "DeNumer = " << probDenum << endl;
- system("PAUSE");
- }
- for (int k = 0; k < currentNode->edgeList.size(); k++)
- {
- probNumer = pow(currentNode->edgeList[k]->pheremone, alpha) * pow((1 / currentNode->edgeList[k]->miles), beta); //take probability for current node
- }
- cout << "Numerator " << probNumer << " Denominator: " << probDenum <<endl;
- mover = probNumer / probDenum;
- cout << " probNumer / probDenum = " << mover << endl;
- system("PAUSE");
- currentCycle++;
- }
- }
- }
- //generate solutions()
- //damonActions()
- //update pheremone()
- //end while
- currentCycle++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement