<div dir="ltr">Hi, please can you help solve my issue. The goal of my project is to create a simple intelligent (with reinforcement learning) cache placement strategy but for now i was trying to create a dynamic tree topology where i receive the number of levels and children then further calculate the total number of nodes, so i get problem when i try to link all the nodes in a loop with PointTointHelper.<div>Please i really need someone to help as this is my final year project thanks.</div><div><br></div><div>/*<br> * projetFinal.cpp<br> *<br> *  Created on: Apr 25, 2020<br> *      Author: elbee<br> */<br>#include <iostream><br>#include <cstdlib><br>#include <fstream><br>#include <iomanip><br>#include <algorithm><br>#include "ns3/core-module.h"<br>#include "ns3/network-module.h"<br>#include "ns3/point-to-point-module.h"<br>#include "ns3/ndnSIM-module.h"<br>#include "ns3/csma-module.h"<br><br><br>using namespace std;<br><br>namespace ns3 {<br><br><br><br>int main(int argc, char* argv[])<br>{<br>      Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));<br>          Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));<br>      Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));<br><br><br>     CommandLine cmd;<br>     cmd.Parse(argc, argv);<br><br>        string mon_fichier ="src/ndnSIM/examples/Configuration.txt";<br>       // on ouvre le fichier en lecture<br>        int nbr_Nodes = 0, levels, children;<br>   ifstream file(mon_fichier.c_str(), ios::in);<br>  if (file){<br>            file  >> levels >> children ;<br>                cout << levels << endl;<br>                cout << children << endl;<br>        file.close();}<br>        else {<br>                cerr << "Can't open file !" << endl;<br>                return 0;<br>     }<br><br>   int pow=1;<br>    for (int i = 0; i <levels +1; i++){<br>                pow *= children;<br>      }<br>     nbr_Nodes +=  (pow - 1 / (children -1));<br>     cout << nbr_Nodes << endl;<br><br>      NodeContainer nodes;<br>  nodes.Create(nbr_Nodes);<br><br>    PointToPointHelper p2p;<br>   //linking nodes to form a binary tree<br>   for(int i = 0; i < nbr_Nodes; i++){<br>                if(i == 0){<br>                   p2p.Install(nodes.Get(0), nodes.Get(1));<br>                      p2p.Install(nodes.Get(0), nodes.Get(2));<br><br>            }<br>             p2p.Install(nodes.Get(i), nodes.Get(2*i));<br>            p2p.Install(nodes.Get(i), nodes.Get(2* i +1));<br>        }<br><br>     ndn::StackHelper ndnHelper;<br>          ndnHelper.SetDefaultRoutes(true);<br>    ndnHelper.InstallAll();<br><br>    ndn::StrategyChoiceHelper::InstallAll("/prefix", "/localhost/nfd/strategy/multicast");<br><br>           for (uint32_t i = 0; i != nbr_Nodes; ++i){<br>             ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");<br>            consumerHelper.SetPrefix("/prefix");<br>             consumerHelper.SetAttribute("Frequency", StringValue("10")); // 10 interests a second<br>          consumerHelper.Install(nodes.Get(i));<br>          }<br><br>         ndn::AppHelper producerHelper("ns3::ndn::Producer");<br>      producerHelper.SetPrefix("/prefix");<br>         producerHelper.SetAttribute("PayloadSize", StringValue("1024"));<br>         producerHelper.Install(nodes.Get(0));<br><br><br><br>   Simulator::Stop(Seconds(20.0));<br>       Simulator::Run();<br>     Simulator::Destroy();<br><br><br>    return 0;<br>}<br>} // namespace ns3<br><br>int<br>main(int argc, char* argv[])<br>{<br>  return ns3::main(argc, argv);<br>}<br><br></div></div>