Programming Assignment 1
Data Science
June 30, 2021
• Due Date: There is no due date for this assignment. However, you will receive
feedback on your submission if submitted before the July 12th, 2021.
Problem Statement
This assignment is meant to provide training for reading analyzing and contributing to relatively
large bodies of Python code.
Several files were furnished with code which simulates an elevator system. Several functions
and classes have had their code removed from the files. You will try to complete ALL
the missing code. In order to run the assignment, you must complete the code in ‘entities.py’
at the very least.
(a)[algorithms.py] Complete the RandomAlgorithm subclass. The return value is a list
containing a Direction for each elevator.
(b)[algorithms.py] Complete the ShortSighted subclass. The return value is a list containing
a Direction for each elevator.
Note: The above subclasses implement different variations of the MovingAlgorithm masterclass.
PushyPassenger is yet another variation of a MovingAlgorithm and can be used to
run the Simulation.
(c)[entities.py] Complete the initializer method __init__ for the Elevator class.
(d)[entities.py] Complete the disembark method of the Elevator class.
(e)[entities.py] Complete the initializer method __init__ for the Person class.
Note: The above method definitions are required to run the Simulation.
How to run the File
You will only need to modify two of the files as part of this assignment. They are algorithms.py
and entities.py. When you are done working on entities.py you can edit the
parameters of sample_run() function in Simulations.py. You are encouraged to read and
check out the other files but not to edit them.
In sample_run(), you need to give two algorithms, an ArrivalGenerator instance and a
MovingAlgorithm instance, as well as values for the four other parameters that control the
number of floors, number of passengers per round, number of elevators and their capacities.
You are encouraged to run the code from an IDE, as opposed to Jupyter Notebooks.
1
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。