Find Jobs
Hire Freelancers

C++ Programming

$30-65 USD

Abgeschlossen
Veröffentlicht vor mehr als 11 Jahren

$30-65 USD

Bezahlt bei Lieferung
Network Communication Simulation using multidimensional vector ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Due: September 27th, 1:00pm + Please only submit [login to view URL] ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1. Model the network . We want to simulate the communication cost between different nodes in a network. How to model the network nodes and communication cost? what does the data looks like? how to find the most economical way to communicate? The answer is: you can use multidimensional vector (array) to represent the communication cost of the network, the index of the 2D vector indicate different nodes. For example, if you have 5 nodes in the network, you will use a 5 * 5 two dimensional vector. In computer science, we call it weight matrix. Following is how to get weight matrix: As above examples, the graph indicates the networks. It has notes, each edge is a direct connection for two nodes. The value for each edge is the communication cost (weight). The weight for node its self is 0, as w[i][i]. If there is no direct connection for two nodes, we use weight 999. 2. How to calculate the communication cost for every pair of nodes. Although there may be no direct connection for two nodes, (like the node 0 and 3 on right picture), they still can connect through other node (like 0 ->2->3 or 0->1->2->3). It is very important to find the most efficient way to communicate, which means the cost of the whole path cost less. We can use Floyd-Warshall method to calculate. The code for this function will be provide in this lab, you can directly call this function. For the path information: we need to 3D vector to store the cost information of each pair of nodes. Like path[n][n][n]. The final result of the most efficient path is located on path[n-1][ ][ ] 2D vector. The first n-1 2D vector of this 3D vector are the history of how each pair are updated step by step to the final result. Use above 3 nodes network as example the final result of all pair cost will be shown in path[2][ ][ ] as 0 1 3 1 0 2 3 2 0 3. What you need to do. Part of the code has been provide in main.cpp. The weight matrix and path matrix are created after the user input the size of the network, that is why we use vector instead of array. The size of network is stored in a global integer “nodes”. You need to finish the code for the following functions. void loadWeight(matrix &w); //load the data into weight matrix void printWeightMatrix(matrix w);// print out the current weight matrix void pathReport(matrix w, matrix3D p);//generate the path report void checkConnection(matrix3D p); //check the Connection for two nodes void updateWeight(matrix &w, matrix3D &p); //update the direct connection for two nodes 4. Output report. The pathReport(matrix w, matrix3D p) function will generate a report for the current weight matrix and path matrix. Please see the example output to follow the same output format. 5. Update Weight The updateWeight(matrix &w, matrix3D &p) will ask user to input two indexes of nodes, and the new weight to replace the old weight. You also need to update the path matrix after updating weight, because the path matrix is related to the weight matrix. 6. checkConnection(matrix3D p) function will ask user to input two indexes of nodes. Then check if these two nodes has a valid path. If yes, print out the cost. If not, print out there is no connection. 7. loadWeight(matrix &w)function process the data file. The data file contains an integer first which is the size of network. You need to first compare with the network you just created. If the size does not match, you should stop reading the file and print out message to show user that the file is wrong.
Projekt-ID: 2514975

Über das Projekt

1 Vorschlag
Remote Projekt
Aktiv vor 12 Jahren

Möchten Sie etwas Geld verdienen?

Vorteile einer Ausschreibung auf Freelancer

Legen Sie Ihr Budget und Ihren Zeitrahmen fest
Für Ihre Arbeit bezahlt werden
Skizzieren Sie Ihren Vorschlag
Sie können sich kostenlos anmelden und auf Aufträge bieten
Vergeben an:
Avatar des Nutzers
Let expert do it.
$40 USD in 1 Tag
5,0 (21 Bewertungen)
4,0
4,0

Über den Kunden

Flagge von UNITED STATES
Southfield, United States
5,0
8
Zahlungsmethode verifiziert
Mitglied seit Sept. 25, 2012

Kundenüberprüfung

Danke! Wir haben Ihnen per E-Mail einen Link geschickt, über den Sie Ihr kostenloses Guthaben anfordern können.
Beim Senden Ihrer E-Mail ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.
Registrierte Benutzer Veröffentlichte Jobs
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Vorschau wird geladen
Erlaubnis zur Geolokalisierung erteilt.
Ihre Anmeldesitzung ist abgelaufen und Sie wurden abgemeldet. Bitte melden Sie sich erneut an.