Exemple #1
0
std::string Paths<NodeType,F>::getRouteDot(NodeType a,NodeType b)const
{
	std::stringstream stream;
	RouteType r=getRoute(a,b);
	NodeType p;
	DirectedGraphType gg=_graph;
	stream<<"digraph G\n{\n";
	stream<<"\tedge [color=red]\n";
	for(typename RouteType::iterator n=r.begin();n!=r.end();n++)
	{
		if(n==r.begin())
		{
		}
		else
		{
			stream<<"\t"<<p<<"->"<<*n<<";\n";
			typename DirectedGraphType::iterator di=std::find(gg.begin(),gg.end(),EdgeType(p,*n,NULL));
			gg.erase(di);
		}
		p=*n;
	}
	stream<<"\tedge [color=black]\n";
	for(typename DirectedGraphType::iterator e=gg.begin();e!=gg.end();e++)
	{
		stream<<"\t"<<e->first<<"->"<<e->second<<";\n";
	}
	stream<<"}";
	return stream.str();
}
void Instruction::setImds(const ArgVal* arg1, const ArgVal* arg2) {
    std::pair<Location, Location> route = getRoute();

    if(arg1) {
        switch(route.first) {
        case Location::IMD:
        case Location::PIMD:
            setImd1(arg1);
            break;
        default:
            break;
            //Do nothing
        }
    }
    if(arg2) {
        switch(route.second) {
        case Location::IMD:
        case Location::PIMD:
            if(imd_count < 2) setImd1(arg2);
            else setImd2(arg2);
            break;
        default:
            break;
            //Do nothing
        }
    }
}
Exemple #3
0
//Within this function, some methods are used to guide passenger around barrier.
Point Barrier::getNextPoint (const Point& orig, const Point& dest) const
{
    int usedPoints[65];
    memset ((void *)usedPoints, '\0', sizeof (int) * pointCount);
    usedPoints[pointCount] = -1;

    RoutingOption leftRoute (orig), rightRoute (orig);
    if (!getRoute (leftRoute, dest, usedPoints, -ROTATION))
        leftRoute.distance = 99999999.0;

    memset ((void *)usedPoints, '\0', sizeof (int) * pointCount);
    usedPoints[pointCount] = -1;
    if (!getRoute (rightRoute, dest, usedPoints, ROTATION))
        rightRoute.distance = 99999999.0;

    if (leftRoute.distance == 99999999.0 &&
        rightRoute.distance == 99999999.0)
            throw new StringError ("No path around barrier");

    return (leftRoute.distance < rightRoute.distance)?
        leftRoute.result: rightRoute.result;
}
Exemple #4
0
// A request for an output vc has been placed by an upstream Router/NI. This has to be updated and arbitration performed
void Router::request_vc(int in_vc, int in_port, NetDest destination, Time request_time)
{
	assert(m_in_vc_state[in_port][in_vc]->isInState(IDLE_, request_time));	

	int outport = getRoute(destination); 
	m_in_vc_state[in_port][in_vc]->setRoute(outport);
	m_in_vc_state[in_port][in_vc]->setState(VC_AB_, request_time);
	assert(request_time >= g_eventQueue_ptr->getTime());
	if(request_time > g_eventQueue_ptr->getTime())
		g_eventQueue_ptr->scheduleEventAbsolute(m_vc_arbiter, request_time);
	else 
		vc_arbitrate();
}
Exemple #5
0
F  Paths<NodeType,F>::parse(NodeType a,NodeType b,F f)const
{
	RouteType r=getRoute(a,b);
	NodeType p;
	for(typename RouteType::iterator n=r.begin();n!=r.end();n++)
	{
		if(n==r.begin())
		{
		}
		else
		{
			typename DirectedGraphType::const_iterator di=std::find(_graph.begin(),_graph.end(),EdgeType(p,*n,NULL));
			EdgeType edge=*di;
			f=edge(f);
		}
		p=*n;
	}
	return f;
}
Exemple #6
0
Data GarbageCentral::createPickingRoute(unsigned int truckID) {

	int pos = truckPosition(truckID);

	if (pos == -1)
		throw TruckNonExistent();

	GarbageTruck &truck = trucks[pos];
	truck.empty();
	vector<GarbageDeposit*> to_pick = { treat_plant };
	for (unsigned i = 0; i < deposits.size(); i++) {
		unsigned int capOcup = deposits[i]->getCapacityOccupied();
		if ( capOcup != 0 && truck.addCarrying(capOcup) ) {
			to_pick.push_back(deposits[i]);
		}
	}


	Data data;
	try {
		data = getRoute(to_pick);
	} catch (RouteMissingData& e) {
		throw;
	}



	trucks[pos].empty();
	auto route = data.first;

	if (route.size() != 0) {
		route[0].first[0]->empty();
		for (auto section : route) {
			section.first[section.first.size() - 1]->empty();
		}

		sortDeposits();
	}

	return data;
}
Exemple #7
0
Data GarbageCentral::createPickingRoute(unsigned int truckID, vector<unsigned int> deposits_id) {

	int pos = truckPosition(truckID);

	if (pos == -1)
		throw TruckNonExistent();

	GarbageTruck &truck = trucks[pos];
	truck.empty();
	vector<GarbageDeposit*> to_pick = { treat_plant };
	for (unsigned i = 0; i < deposits_id.size(); i++) {
		int pos = depositPosition(deposits_id[i]);
		to_pick.push_back(deposits[pos]);

	}

	Data data;
	try {
		data = getRoute(to_pick);
	} catch (RouteMissingData& e) {
		throw;
	}


	trucks[pos].empty();
	auto route = data.first;

	if (route.size() != 0) {
		route[0].first[0]->empty();
		for (auto section : route) {
			section.first[section.first.size() - 1]->empty();
		}

		sortDeposits();
	}

	return data;
}
void LedDevicePhilipsHue::saveStates(unsigned int nLights) {
	// Clear saved lamps.
	lights.clear();
	// Use json parser to parse reponse.
	Json::Reader reader;
	Json::FastWriter writer;
	// Create light ids if none supplied by the user.
	if (lightIds.size() != nLights) {
		lightIds.clear();
		for (unsigned int i = 0; i < nLights; i++) {
			lightIds.push_back(i + 1);
		}
	}
	// Iterate lights.
	for (unsigned int i = 0; i < nLights; i++) {
		// Read the response.
		QByteArray response = get(getRoute(lightIds.at(i)));
		// Parse JSON.
		Json::Value json;
		if (!reader.parse(QString(response).toStdString(), json)) {
			// Error occured, break loop.
			break;
		}
		// Get state object values which are subject to change.
		Json::Value state(Json::objectValue);
		state["on"] = json["state"]["on"];
		if (json["state"]["on"] == true) {
			state["xy"] = json["state"]["xy"];
			state["bri"] = json["state"]["bri"];
		}
		// Determine the model id.
		QString modelId = QString(writer.write(json["modelid"]).c_str()).trimmed().replace("\"", "");
		QString originalState = QString(writer.write(state).c_str()).trimmed();
		// Save state object.
		lights.push_back(PhilipsHueLight(lightIds.at(i), originalState, modelId));
	}
}
void LedDevicePhilipsHue::saveStates(unsigned int nLights) {
	// Clear saved lamps.
	lights.clear();
	// Use json parser to parse reponse.
	Json::Reader reader;
	Json::FastWriter writer;
	// Read light ids if none have been supplied by the user.
	if (lightIds.size() != nLights) {
		lightIds.clear();
		//
		QByteArray response = get("lights");
		Json::Value json;
		if (!reader.parse(QString(response).toStdString(), json)) {
			throw std::runtime_error(("No lights found at " + getUrl("lights")).toStdString());
		}
		// Loop over all children.
		for (Json::ValueIterator it = json.begin(); it != json.end() && lightIds.size() < nLights; it++) {
			int lightId = atoi(it.key().asCString());
			lightIds.push_back(lightId);
			std::cout << "LedDevicePhilipsHue::saveStates(nLights=" << nLights << "): found light with id " << lightId
					<< "." << std::endl;
		}
		// Check if we found enough lights.
		if (lightIds.size() != nLights) {
			throw std::runtime_error(("Not enough lights found at " + getUrl("lights")).toStdString());
		}
	}
	// Iterate lights.
	for (unsigned int i = 0; i < nLights; i++) {
		// Read the response.
		QByteArray response = get(getRoute(lightIds.at(i)));
		// Parse JSON.
		Json::Value json;
		if (!reader.parse(QString(response).toStdString(), json)) {
			// Error occured, break loop.
			std::cerr << "LedDevicePhilipsHue::saveStates(nLights=" << nLights << "): got invalid response from light "
					<< getUrl(getRoute(lightIds.at(i))).toStdString() << "." << std::endl;
			break;
		}
		// Get state object values which are subject to change.
		Json::Value state(Json::objectValue);
		if (!json.isMember("state")) {
			std::cerr << "LedDevicePhilipsHue::saveStates(nLights=" << nLights << "): got no state for light from "
					<< getUrl(getRoute(lightIds.at(i))).toStdString() << std::endl;
			break;
		}
		if (!json["state"].isMember("on")) {
			std::cerr << "LedDevicePhilipsHue::saveStates(nLights=" << nLights << "): got no valid state from light "
					<< getUrl(getRoute(lightIds.at(i))).toStdString() << std::endl;
			break;
		}
		state["on"] = json["state"]["on"];
		if (json["state"]["on"] == true) {
			state["xy"] = json["state"]["xy"];
			state["bri"] = json["state"]["bri"];
		}
		// Determine the model id.
		QString modelId = QString(writer.write(json["modelid"]).c_str()).trimmed().replace("\"", "");
		QString originalState = QString(writer.write(state).c_str()).trimmed();
		// Save state object.
		lights.push_back(PhilipsHueLight(lightIds.at(i), originalState, modelId));
	}
}
Exemple #10
0
/**
 * \brief Establish how deep in the current tree this node lies
 */
int MythGenericTree::currentDepth(void)
{
    QList<MythGenericTree *> route = getRoute();

    return (route.size() - 1);
}
Exemple #11
0
/*
p_route is passed with the current point in origPoint, and is expected to be returned with the best option in result if getRoute returns true, as well as the total distance required to get to p_dest by following that route. 
If getRoute returns false, there is no way to get to p_dest using the direction indicated by p_rotation.
p_used is used to track where the route goes around the barrier so that endless looping can be avoided.
*/
int Barrier::getRoute (RoutingOption &p_route, const Point& p_dest, int *p_used, float p_rotation) const
{
    TArrayAsVector <RoutingOption> optionList (16, 0, 16);
    RoutingOption option;

    Point flowPoint, tempPoint, offset, orig (p_route.origPoint);
    int usedPoints[65];
    memcpy ((void *)usedPoints, (void *)p_used, sizeof(int)*(pointCount+1));

#if 0
    char origStr[32];
    char destStr[32];
    if (env->getParameter ("-BARR") != NULL)
    {
        p_route.origPoint.printPoint (origStr, 1);
        p_dest.printPoint (destStr, 1);
    }
#endif

    // fill optionList with intermediary points that may divert pax
    // around the barrier.
    for (int i = 0; i < pointCount; i++)
    {
        // skip all used points except near corner
        if (usedPoints[i] && i != usedPoints[pointCount])
            continue;

        flowPoint.initVector (orig, m_barrier.getPoint(i));
        flowPoint.scale (0.999, 0.999, 1.0);
        if (m_barrier.intersects (orig, flowPoint + orig))
            continue;

        flowPoint += DISTANCE;
        tempPoint = flowPoint;
        tempPoint.rotate (p_rotation);
        offset.initVector (flowPoint, tempPoint);
        offset.length (DISTANCE);
        option.origPoint = orig + flowPoint + offset;
        if (!m_barrier.intersects (orig, option.origPoint))
        {
            option.corner = i;
            option.distance = orig.distance (option.origPoint);
            optionList.Add (option);
        }
    }

    int optionCount = optionList.GetItemsInContainer();
    if (!optionCount)
        return 0;

    TSArrayAsVector <RoutingOption> sOptionList (16, 0, 16);
    for (int ii = 0; ii < optionCount; ii++)
    {
        option = optionList[ii];

        // intermediary point avoids barrier, add to distance and exit
        if (!m_barrier.intersects (option.origPoint, p_dest))
            option.distance += option.origPoint.distance (p_dest);
        else
        {
            // if there are other options, and near corner route does
            // not have a direct path to p_dest, now discard near point
            if (usedPoints[option.corner] && optionCount > 1)
                continue;

            usedPoints[option.corner] = 1;
            usedPoints[m_barrier.getCount()] = option.corner;
            if (!getRoute (option, p_dest, usedPoints, p_rotation))
                continue;
        }
        sOptionList.Add (option);
    }
    if (sOptionList.GetItemsInContainer() == 0)
        return 0;

    p_route.result = sOptionList[0].origPoint;
    p_route.distance += sOptionList[0].distance;
    return 1;
}
int AmBasicSipDialog::sendRequest(const string& method, 
				  const AmMimeBody* body,
				  const string& hdrs,
				  int flags)
{
  AmSipRequest req;

  req.method = method;
  req.r_uri = remote_uri;

  req.from = SIP_HDR_COLSP(SIP_HDR_FROM) + local_party;
  if(!ext_local_tag.empty())
    req.from += ";tag=" + ext_local_tag;
  else if(!local_tag.empty())
    req.from += ";tag=" + local_tag;
    
  req.to = SIP_HDR_COLSP(SIP_HDR_TO) + remote_party;
  if(!remote_tag.empty()) 
    req.to += ";tag=" + remote_tag;
    
  req.cseq = cseq;
  req.callid = callid;
    
  req.hdrs = hdrs;

  req.route = getRoute();

  if(body != NULL) {
    req.body = *body;
  }

  if(onTxRequest(req,flags) < 0)
    return -1;

  if (!(flags & SIP_FLAGS_NOCONTACT)) {
    req.contact = getContactHdr();
  }

  if (!(flags & SIP_FLAGS_VERBATIM)) {
    // add Signature
    if (AmConfig::Signature.length())
      req.hdrs += SIP_HDR_COLSP(SIP_HDR_USER_AGENT) + AmConfig::Signature + CRLF;
  }

  int send_flags = 0;
  if(patch_ruri_next_hop && remote_tag.empty()) {
    send_flags |= TR_FLAG_NEXT_HOP_RURI;
  }

  if((flags & SIP_FLAGS_NOBL) ||
     !remote_tag.empty()) {
    send_flags |= TR_FLAG_DISABLE_BL;
  }

  int res = SipCtrlInterface::send(req, local_tag,
				   remote_tag.empty() || !next_hop_1st_req ?
				   next_hop : "",
				   outbound_interface,
				   send_flags,logger);
  if(res) {
    ERROR("Could not send request: method=%s; call-id=%s; cseq=%i\n",
	  req.method.c_str(),req.callid.c_str(),req.cseq);
    return res;
  }

  onRequestTxed(req);
  return 0;
}
void MainWindow::calculate(int pluginNum)
{
    lockGUI();
    if (placesListChanged)
    {
        //std::vector<Place*> v_places;
        std::vector<QListWidgetItem*> items = list.getAllItems();
        int size = items.size();
        if(size==0)
        {
            return;
        }
        if(v_places.size()>0)
        {
            for(int i = 0; i < (int)v_places.size(); ++i)
            {
                delete[] routes[i];
            }
            delete[] routes;
        }
        v_places.clear();
        for(int i=0; i<size; i++)
        {
            QListWidgetItem* item = items.at(i);
            GeoListItem* geoItem = dynamic_cast<GeoListItem*>(item);
            v_places.push_back(geoItem->getPlace());
        }
        std::unordered_map<std::pair<Coordinates, Coordinates>, Route, pairhash> unordered_map;
        routes = new Marble::Route*[size];
        for(int i = 0; i < size; ++i)
        {
            routes[i] =  new Marble::Route[size];
            for(int j = 0; j < size; ++j)
            {
                Coordinates from = v_places[i]->getCoordinates();
                Coordinates to = v_places[j]->getCoordinates();
                std::pair<Coordinates, Coordinates> pair = std::make_pair(from, to);
                std::unordered_map<std::pair<Coordinates, Coordinates>, Route, pairhash>::const_iterator got = m_routesUnorderedMap.find(pair);
                Route route;
//               if(got == m_routesUnorderedMap.end())
                {
                    route = getRoute(from, to);
                    if(!(from == to) && route.distance() == 0)
                    {
                        writeLog(QString("There is posibility there is no route from position %1 to %2").arg(i).arg(j));
                    }
                    else
                    {
                        writeLog(QString("Found route from position %1 to %2").arg(i).arg(j));
                    }
                }
//                else
//                {
//                    route = got->second;
//                    if(!(from == to) && route.distance() == 0)
//                    {
//                        writeLog(QString("There is posibility there is no route from position %1 to %2").arg(i).arg(j));
//                    }
//                    else
//                    {
//                        writeLog(QString("Already have route from position %1 to %2").arg(i).arg(j));
//                    }
//                }

                routes[i][j] = route;
                //unordered_map[pair] = route;

            }
        }
        placesListChanged = false;
        m_routesUnorderedMap.clear();
        m_routesUnorderedMap = std::move(unordered_map);
    }
    this->m_progBarDial->show();
    this->m_progBarDial->setProgress(0);
    this->m_progBarDial->update();
    this->m_progBarDial->repaint();
    this->repaint();
    KomiwojazerPluginInterface* interface = pluginManager.getPluginByIndex(pluginNum);
    interface->connectToSLOT(m_progBarDial, SIGNAL(cancelButtonClicked()), true);
    v_places = interface->calculate(v_places, routes);
    interface->connectToSLOT(m_progBarDial, SIGNAL(cancelButtonClicked()), true);
    this->m_progBarDial->hide();
    this->m_progBarDial->update();
    this->m_progBarDial->repaint();
    this->repaint();
    setMarkerNumber();
    unlockGUI();
}
int AmSipDialog::sendRequest(const string& method, 
			     const string& content_type,
			     const string& body,
			     const string& hdrs)
{
  string msg,ser_cmd;
  string m_hdrs = hdrs;

  if(hdl)
    hdl->onSendRequest(method,content_type,body,m_hdrs,cseq);

  msg = ":t_uac_dlg:" + AmConfig::ReplySocketName + "\n"
    + method + "\n"
    + remote_uri + "\n";
    
  if(next_hop.empty())
    msg += ".";
  else
    msg += next_hop;
    
  msg += "\n";
    
  msg += "From: " + local_party;
  if(!local_tag.empty())
    msg += ";tag=" + local_tag;
    
  msg += "\n";
    
  msg += "To: " + remote_party;
  if(!remote_tag.empty()) 
    msg += ";tag=" + remote_tag;
    
  msg += "\n";
    
  msg += "CSeq: " + int2str(cseq) + " " + method + "\n"
    + "Call-ID: " + callid + "\n";
    
  if((method!="BYE")&&(method!="CANCEL"))
    msg += getContactHdr();
    
  if(!m_hdrs.empty()){
    msg += m_hdrs;
    if(m_hdrs[m_hdrs.length()-1] != '\n')
      msg += "\n";
  }

  if(!route.empty())
    msg += getRoute();
    
  if(!body.empty())
    msg += "Content-Type: " + content_type + "\n";
    
  msg += "Max-Forwards: "  MAX_FORWARDS "\n";

  if (AmConfig::Signature.length()) 
    msg += "User-Agent: " + AmConfig::Signature + "\n";

  msg += ".\n" // EoH
    + body + ".\n\n";

  if (AmServer::send_msg_replyhandler(msg)) 
    return -1;
    
  uac_trans[cseq] = AmSipTransaction(method,cseq);

  // increment for next request
  cseq++;
    
  return 0;
}
Exemple #15
0
void PostRouteHandler::handleRequest(ServerEventArgs& evt)
{
    try
    {
        Poco::Net::HTTPServerResponse& response = evt.getResponse();

        // This uuid helps us track form progress updates.
        std::string postId = Poco::UUIDGenerator::defaultGenerator().createOne().toString();

        // Get the content type header (already checked in parent route).
        Poco::Net::MediaType contentType(evt.getRequest().get("Content-Type", ""));

        if (contentType.matches(POST_CONTENT_TYPE_URLENCODED) ||
            contentType.matches(POST_CONTENT_TYPE_MULTIPART))
        {
            // Prepare the upload directory if needed.
            if (contentType.matches(POST_CONTENT_TYPE_MULTIPART))
            {
                ofDirectory _uploadFolder(getRoute().getSettings().getUploadFolder());

                if (!_uploadFolder.exists())
                {
                    ofLogError("PostRouteHandler::handleRequest") << "Upload folder does not exist and cannot be created.";
                    response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
                    getRoute().handleRequest(evt);
                    return;
                }
            }

            PostRouteFileHandler postRoutePartHandler(getRoute(),
                                                      evt,
                                                      postId);

            Poco::Net::HTMLForm form(contentType.toString());
            form.setFieldLimit(getRoute().getSettings().getFieldLimit());
            form.load(evt.getRequest(), evt.getRequest().stream(), postRoutePartHandler);

            PostFormEventArgs args(evt,
                                   postId,
                                   form);

            ofNotifyEvent(getRoute().events.onHTTPFormEvent, args, &getRoute());

            if (form.has("destination") && !form.get("destination").empty())
            {
                response.redirect(form.get("destination"));
                return;
            }
        }
        else
        {
            // Poco::Net::HTMLForm, like php does not handle text/plain because
            // it cannot be unambiguously encoded.  Here we simply return
            // the raw text with the event.

            std::string result;

            Poco::StreamCopier::copyToString(evt.getRequest().stream(),
                                             result);

            ofBuffer buffer(result);

            PostEventArgs args(evt,
                               postId,
                               buffer);

            ofNotifyEvent(getRoute().events.onHTTPPostEvent, args, &getRoute());
        }

        if (response.sent())
        {
            return;
        }
        else if (!getRoute().getSettings().getUploadRedirect().empty())
        {
            response.redirect(getRoute().getSettings().getUploadRedirect());
            return;
        }
        else
        {
            // done
            response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_OK);
            response.setContentLength(0);
            response.send();
            return;
        }
    }
    catch (const Poco::Exception& exc)
    {
        evt.getResponse().setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.displayText());
    }
    catch (const std::exception& exc)
    {
        evt.getResponse().setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.what());
    }
    catch (...)
    {
        evt.getResponse().setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
    }
}
Exemple #16
0
void GarbageCentral::test() {

	vector<GarbageDeposit*> to_pick;
	to_pick.push_back(treat_plant);

	/***** TEST 1.1 ****/
	//	cout << "Processing deposit 2\n";
	//	cout << "Expected: road 1\n";
	//
	//	to_pick.push_back(deposits[1]);
	/******************/

	/***** TEST 1.2 ****/
	//	cout << "Processing deposit 2\n";
	//	cout << "Expected: road 0, road 2\n";
	//
	//	updateRoadAvailable(1, false);
	//	to_pick.push_back(deposits[1]);
	/******************/


	/***** TEST 1.3 ****/
	//	cout << "Processing deposit 2\n";
	//	cout << "Expected: road 0, road 2\n";
	//
	//	updateRoadAvgSpeed(1, 10);
	//	to_pick.push_back(deposits[1]);
	/******************/


	/***** TEST 2.1 ****/
	//	cout << "Processing deposits 1, 2, 6\n";
	//	cout << "Expected: road 0, road 2, road 4, road 5, road 8\n";
	//
	//	to_pick.push_back(deposits[0]);
	//	to_pick.push_back(deposits[1]);
	//	to_pick.push_back(deposits[5]);
	/******************/


	/***** TEST 2.2 ****/
	// ******* IMPORTANT *******
	//	cout << "Processing deposits 1, 2, 6\n";
	//	cout << "Expected: road 0, road 2, road 6\n";
	//
	//	updateRoadAvailable(4, false);
	//
	//	to_pick.push_back(deposits[0]);
	//	to_pick.push_back(deposits[1]);
	//	to_pick.push_back(deposits[5]);
	/******************/


	/***** TEST 2.3 ****/
	// ******* IMPORTANT *******
	//	cout << "Processing deposits 1, 2, 6\n";
	//	cout << "Expected: road 0, road 2, road 6\n";
	//
	//	updateRoadAvgSpeed(4, 0);		// equivalent to set road 4 unavailable
	//
	//	to_pick.push_back(deposits[0]);
	//	to_pick.push_back(deposits[1]);
	//	to_pick.push_back(deposits[5]);
	/******************/


	/***** TEST 3.1 ****/
	//	cout << "Processing deposits 1, 2, 5\n";
	//	cout << "Expected: road 0, road 2, road 4, road 5\n";
	//
	//	to_pick.push_back(deposits[0]);
	//	to_pick.push_back(deposits[1]);
	//	to_pick.push_back(deposits[4]);
	/******************/


	/***** TEST 3.2 ****/
	// ******* IMPORTANT *******
	//	cout << "Processing deposits 1, 2, 5\n";
	//	cout << "Expected: road 1, road 4, road 5, road 7\n";
	//
	//	updateRoadAvailable(0, false);
	//
	//	to_pick.push_back(deposits[0]);
	//	to_pick.push_back(deposits[1]);
	//	to_pick.push_back(deposits[4]);
	/******************/


	/***** TEST 3.3 ****/
	// ******* IMPORTANT *******
	//	cout << "Processing deposit 1, 2, 5\n";
	//	cout << "Expected: road 1, road 4, road 5\n";
	//	cout << "Note: Deposit 1 shouldn't be reachable\n";
	//
	//	updateRoadAvailable(0, false);
	//	updateRoadAvailable(7, false);
	//
	//	to_pick.push_back(deposits[0]);
	//	to_pick.push_back(deposits[1]);
	//	to_pick.push_back(deposits[4]);
	/******************/


	/***** TEST 4 ****/
	//	cout << "Processing deposit 4\n";
	//	cout << "Deposit 4 shouldn't be reachable\n";
	//
	//	to_pick.push_back(deposits[3]);
	/******************/



	cout << "--------------------------------------------\n";

	Data data = getRoute(to_pick);

	auto route = data.first;
	auto failed = data.second;

	if (! route.empty()) {
		cout << route[0].first[0]->print();
		for (unsigned i = 0; i < route.size(); i++) {
			auto info = route[i].first;
			auto roads = route[i].second;

			for (unsigned j = 0; j < roads.size(); j++) {
				cout << "  --->  " << roads[j]->print();
				cout << "  --->  " << info[j+1]->print();
			}
		}
	}

	if (failed.size() != 0)
	{
		cout << "\n\nNo optimal route found for these containers:" << endl;
		for(unsigned int i = 0; i < failed.size(); i++){
			cout << " " << i + 1 << ". " << failed[i]->getID()<< endl;
		}
	}
}