Assignment 3
The value of this assessment is 10% of your final grade. It also contains 10 marks.
Overview and objective
In
this assignment, you will study developing behavior in social networks
by using simulation. You will be able to understand the dynamics of a
social network like Facebook and Twitter is a significant research topic
with many applications including improving the online experience,
tracking world events, optimizing network bandwidth etc.
Assignment structure
The structure of the third assignment is very similar to that of the first two assignments. There are five python files:
1. agent.py
2. test agent.py
3. constants.py
4. engine.py
5.simulation.py
2. test agent.py
3. constants.py
4. engine.py
5.simulation.py
Assignment tasks
In
this assessment, you only need to modify and submit agent.py. Your task
consists of writing or fixing several functions in agent.py. The
specifications for each of these functions are included as comments in
agent.py with additional background material contained later in this
document. The function parameters and return types are all listed inside
the docstrings for the functions you need to write. Do not modify the
function signatures (such as by renaming the input parameters, or adding
extra ones). You also should not add any code outside the functions
provided, except optionally, import statements.
Order Now
Technical description of the code
The code for this assignment is organized into five different files.
1.
Agent.py implements user functionality in a class called Agent. The
Agent class must contain five methods, which you will need to implement.
See comments inside the code for details.
2. Constants.py contain useful constants for defining the user personality types and message types.
3. Engine.py contains the Engine class, which holds the graph defining the social network
and manages message sending between agents. The class implements a
so-called event processing model, each sent message triggers an event,
which the engine processes in turn. An event is also triggered at the
end of each epoch. The Engine class also keeps track of message
statistics.
4. Simulation.py implements the main simulation code (using the Engine class) and visualization.
5.
Test agent.py contains unit-tests for the Agent class. You should make
sure that your code passes the unit-test associated with each task.
Note, however, that just because your code passes a unit-test does not
mean that it is completely correct. You may need to develop your own
additional tests.
The event
processing model implemented by the Engine class polls each agent to
determine the action the agent wants to make in response to certain
events. To complete the assignment you will only need to modify the code
in agent.py, but you should look at the code in other files.
Tasks
You
are required to implement the functionality of the Agent class in the
Python 3 programming language. You are free to use additional Python
libraries to complete the task as long as they are bundled with the
Anaconda 3 distribution. Individual tasks are shown below. TODO comments
in the source code will also help guide your work. A breakdown of marks
is given next to each task.
1. Implement the Agent constructor init. (1 mark)
2. Implement the Agent method get the personality. (1 mark)
3. Implement the Agent method receive message. (1 mark)
4. Implement the Agent method broadcast new message. (2 marks) 5. Implement the Agent method forward message. (3 marks)
Challenges may face by students
Students
may face several challenges while completing this assignment like lack
of programming skills, inadequate time, making reference list etc. Such
students can take our experts’ help and guidance regarding their
assignments. Our academic experts will help you in the best possible
way.
No comments:
Post a Comment