void UpdateTrafficCostRequestPacket::dump(bool headerOnly, bool lookupIP) const { cout << "Dumping UpdateTrafficCostRequestPacket :" << endl; Packet::dump(); cout << "Dumping data specific to packet type: " << endl; cout << "mapID " << getMapID() << endl; cout << "allCosts " << allCosts() << endl; uint32 nbrCosts = getNbrCosts(); cout << "nbrCosts " << nbrCosts << endl; for (uint32 i = 0;i < nbrCosts; i++) { uint32 nodeID = MAX_UINT32; uint32 addedCost = MAX_UINT32; // different name to avoid conflict if (getCost(nodeID, addedCost, i)) { cout << "node " << i << ":" << endl; cout << "nodeID " << nodeID << endl; cout << "addCost " << addedCost << endl; } else { mc2log << warn << "Node unexistent" << endl; } } }
void ObjectiveGenerator::updateObjective() { LOG_DEBUG(objectivegeneratorlog) << "updating the objective" << std::endl; // we have as many linear coefficients as segments _objective->resize(_segments->size()); // create a vector of all accumulated costs std::vector<double> allCosts(_segments->size(), 0); // accumulate costs for (int i = 0; i < _costFunctions.size(); i++) { costs_function_type& costFunction = *_costFunctions[i]; costFunction(_segments->getEnds(), _segments->getContinuations(), _segments->getBranches(), allCosts); } // set the coefficients for (int i = 0; i < allCosts.size(); i++) _objective->setCoefficient(i, allCosts[i]); }