|
The question is as follows:
(Settling time of Dijkstra’s Algorithm)
Write a program, which generates a network with a controllable number of nodes, N. The easiest way to do this is to start with a rectangle with sides X and Y. Use a pair of random numbers, rx(n) and ry(n), to set the coordinates of point, n at X rx(n) and Y ry(n).
Allow n to cover the range 1 to N. Your program must then decide whether a link exists between every pair of nodes in the network. This can easily be done, based on the distance between them. For example, it could be decided that a link exists if the distance between two nodes is less than a certain distance. Or a link could exist depending on some probability function of the distance between them.
Repeat the following experiments with N = 32, 64, 128 and 256.
Extend the program so that it simulates the operation of Dijkstra’s algorithm. This program should carry out the operations of Dijkstra’s algorithm for one node at a time. Start the program with a fixed set of link costs, perhaps one. Plot the settling/convergence time. Note, convergence time is the number of steps it takes to reach a stable routing table.
Allow the program to continue running until all routing tables have stabilized. Now change the value of one link only, and again allow the program to run until all routing tables are stable. Measure the time taken (or the number of iterations) to reach stability. Repeat this experiment 100 times (each time with a different link being changed) and find the average settling time. Also, plot a graph that shows the average time taken for the Dijkstra’s algorithm to converge for different number of links being changed.
In this experiment, simulate the behavior of the network when all routers update their routing tables at the same time. That is, using the same set of link costs. Assume that 150 Mbps is the average traffic offered between each pair of nodes. Experiment also with different number of node pairs. The utilization and the link costs are calculated using the total traffic on a link in either direction. Does the network come to a stable state? What is the settling time? Does the amount of traffic entering the network influence Dijkstra’s settling time?
Repeat the previous experiment where each router updates their routing tables, one at a time, and the traffic is re-calculated between updates. Does the network converge? Plot the settling time.
In your discussions, you must explain the impact of node density (i.e., the number of neighbors a node has) and number of nodes on route convergence.
|
|
|
|
|
Sounds like fun. Is your homework in C++/CLI, or have you both asked a question that no-one is going to answer ( that is, asking for a complete solution to your homework ) AND asked it in the wrong place ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The truth is that i got the question as homework
But i'm not at all familiar with any languages
all I'v learned is the basics
so i went totally blank on seeing this question
so if u could kindly help me out.....
please do if u could.
|
|
|
|
|
MaddySays wrote: But i'm not at all familiar with any languages
Well, then why are you getting this homework assigned to you?
MaddySays wrote: so i went totally blank on seeing this question
The first step is to break it down. No single line of code will do all of this, so think about the various parts and how they need to work in order to come together to make the whole.
And, unless you're using C++/CLI ( C++ with .NET ), ask in the right forum when you're able to ask specific questions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sorry to ask but which forum should i ask if it is totally based on c++ alone??
|
|
|
|
|
The visual c++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to add a "-" to an existing string:
char* sOutString = new char[stringSize];
strcat( sOutString, "-" ); // Results in Warning
but use the new function to avoid the deprecation warning:
strcat_s( sOutString, stringSize, "-" );
But, this is apperently not correct as it crashes on this line. What am I doing wrong and how to I fix it?
EDIT: The above does work... I just did something wrong. All working now. Thx.
|
|
|
|
|
Your core problem is that you're using C. If you're using C++, use the string class. If you're using C++/CLI, consider the String class. Either way, this question is about C or C++, and this is the C++/CLI forum
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have a function for comaring.
int DataPeakCompareFunc(const void *el1, const void *el2)
{
const DataPeak *peak1 = reinterpret_cast<const datapeak="" *="">(el1);
const DataPeak *peak2 = reinterpret_cast<const datapeak="" *="">(el2);
if (peak1->position < peak2->position)
{
return -1;
}
else if (peak2->position < peak1->position)
{
return 1;
}
return 0;
}
this is my qsort function
int (FConvert::OConvevw::*pt2Function) (const void*, const void*) = NULL;
pt2Function = &FConvert::OConvevw::DataPeakCompareFunc;
qsort((void*)pScan, num_readings, sizeof(DataPeak),pt2Function);
But i am getting this error
Error 206 error C2665: 'qsort' : none of the 2 overloads could convert all the argument types d:\cougar_io_development\cougar\core\libraries\cplusplus\dlls\fconvert\OConvevw.h 789
both are residing in oconvevw.h file only.
What to do?
Thanks in advance.
Regards, Eswari
|
|
|
|
|
may be this is the wrong forum to ask.. But i could not see any C++ category.
That's why i posted here
|
|
|
|
|
Yes, this is the wrong forum. See your post here[^] on the correct forum
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am using /clr compiler flag. I am getting these errors while compiling my code.
1.
Error 1 error LNK2028: unresolved token (0A00098C) "int __cdecl GetXcaliburDataPath(class ATL::CStringT<wchar_t,class strtraitmfc_dll<wchar_t,class="" atl::chtraitscrt<wchar_t=""> > > &)" (?GetXcaliburDataPath@@$$FYAHAAV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function "public: __clrcall FConvert::FConvertClass::FConvertClass(struct FConvert::FConvertRecord ^)" (??0FConvertClass@FConvert@@$$FQ$AAM@P$AAUFConvertRecord@1@@Z) FConvert.obj
2.Error 2 error LNK2019: unresolved external symbol "int __cdecl GetXcaliburDataPath(class ATL::CStringT<wchar_t,class strtraitmfc_dll<wchar_t,class="" atl::chtraitscrt<wchar_t=""> > > &)" (?GetXcaliburDataPath@@$$FYAHAAV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function "public: __clrcall FConvert::FConvertClass::FConvertClass(struct FConvert::FConvertRecord ^)" (??0FConvertClass@FConvert@@$$FQ$AAM@P$AAUFConvertRecord@1@@Z) FConvert.obj
Any help is appreciated.
Thanks, Eswari
|
|
|
|
|
These are linker (not compiler) errors. In your project, ou need to include the file which
contains the implementation of GetXcaliburDataPath(). If it's in an external DLL you need to add
the link library (.lib) file. If it's in one of your source files (.cpp) then make sure that
file is in your project and the linker can find the .obj file for it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I figured it out. Thanks anyway.
Regards, Eswari
|
|
|
|
|
Hello,
at the moment I'm searching some logging possibility that I can use in .net and in native c++. For pure .net implementation I have used until now the Enterprise logging application block. But for the native c++ application I don't cant use this, because in this parts I really need a fast solution.
Does anyone now a solution that works in booth managed and unmanaged parts and is also fast?
Best regards
Hansjörg
|
|
|
|
|
Develop a simple WIN32 dll - Use it from both unmanaged and managed worlds.
Cheers,
Suresh
|
|
|
|
|
Helo...I have my inteface in c++ and I want to take the data from the interface in the main program like this:
int main(array ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
int container = Convert::ToInt32(forminterface::Form1::ContainerWidthtextBox::...., System::Globalization::CultureInfo::CurrentCulture);.........}
in the interface I have a TextBox...ContainerWidthtextBox in which I introduce the data ...how can I use this value in my main ....because it doesn't let me to use:
int container = Convert::ToInt32(forminterface::Form1::ContainerWidthtextBox->Text, System::Globalization::CultureInfo::CurrentCulture);
it give me an error like Error 5 error C2227: left of '->Text' must point to class/struct/union/generic type please help me.......
lavi
|
|
|
|
|
Please help me...how can I get a value in main from my interface....it's a method?...I am disperate..I must solve this...
|
|
|
|
|
Following snippet should give you some idea about usage.
TestForm::Form1^ myform = gcnew Form1();
Application::Run(myform);
MessageBox::Show(myform->textBox1->Text);
-- modified at 5:25 Wednesday 16th May, 2007
Probably, you need better alternative. But, you was facing problem, because, of using object in wrong way, infact, I guess, edit box variable was not recognized by compiler.
Prasad
MS MVP - VC++
|
|
|
|
|
It seems to me Prasad had it right...you need an actual object to access its "Text" property:
Form1^pForm1 = gcnew Form1()
Application::Run(pForm1);
int container = Convert::ToInt32(pForm1->Text, ...);
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
thanks .....I solved the problem
|
|
|
|
|
|
I’m converting an old MFC program to Windows Forms. In one function there is a TIMESTAMP_STRUCT type. That is defince in an MFC library function (afxdb.h).
I can’t find a replacement for this library. Any leads to locating a way to replace this would be very helpful.
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
TIMESTAMP_STRUCT is an ODBC type defined in sqltypes.h.
It looks pretty similar to a Windows SYSTEMTIME structure or a .NET System.DateTime struct.
Are you looking for a database class/framework replacement or just for the time struct?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I think this will work. Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|