现代软件工程 结对编程 (II) 电梯调度

Pair Project II: Elevator Scheduler

<现代软件工程> 的结对编程作业,  作者: 邹欣

怎样设计API?  怎样从不同角度考虑需求?  怎样对不同的设计进行评估?

怎样做设计一个测试框架来测试众多解决方案?  如何驱动这样的测试框架?

怎样和伙伴合作,  快速有效地完成这些挑战?

这就是我们这次小项目要练习的。

Design and implement an Elevator Scheduler to aim for both correctness and performance, in managed code.

Skills to practice:

a) Requirement Analysis

需求分析

b) High level design (interface, information hiding, loose coupling)

程序API 设计,  信息隐藏, 耦合

c) Test Framework Design

设计测试框架, 模拟测试数据

d) Implementation skills

设计的实现

e) Algorithm design

算法设计

1. Background

Imagine we’re building a tall office building,   We need to have design an efficient elevator system to carry people to their destinations.    the following is a example of the configuration about elevators:

  • The Building has 21 floors, 4 elevators, many passengers use these elevators everyday (passenger weight: average 70kg. max 120kg, min 40g).
  • Other constant data: Elevator speed, door open/close time, passenger time for going in/out of the elevator. We can make reasonable assumptions about these.
  • The building has 21 floors, from floor 0, 1, ... to 20. Floor 0 is the underground parking level, floor 1 is the lobby level. Most people come in/out the building via these 2 floors.

Elevator name

Service floor list

Passenger limit

Weight limit

1

All floors

10

800 kg

2

floor 1..10

10

800 kg

3

floor 0,1,2..10

20

1600 kg

4

floor 0,1, 11-20

20

2000 kg

*note: in our test program, the configuration of elevators can be changed,  the scheduler need to read the configuraiton at the initialization time via the API.

2. Requirement to Student pairs

2.1 Each pair of students will design a set of interface and class definition so that an algorithm provider can provide his/her implementation to the “elevator scheduler” class.

2.2 We will discuss the student’s submission in the class,  pick the best design.

2.3 after the API is decided,  we will focus on the design of test framework

2.4  1-2 volunteers will implment a “test framework” app,  and the rest student pairs will each pair will focus on the implementation of the “elevator scheduler” program.

consideration for the API:

a) how to keep it simple.

b) how to provide enough info for the scheduler to finish the scheduling work,  without knowing too much info?

c) which component is actually driving the elevator?

d) how to regulate proper passenger behavor?  (e.g. if a passenger needs to go to floor 3 from floor 20, but the current elevator can’t go there directly, what should the passenger do?)

consideration for the test framework:

a) how to make sure it generates the same result for the same test cases on a given scheduler?

b) how to check the correctness of the scheduler?

c) how to prevent “cheating” by the scheduler?

d) how to emulate the “real world” efficiently?  (e.g. if 2 passengers are 30 minutes away, does the test framework need to wait for 30 minutes?)

TA will come up with a consistent testing model to test your program according to the “rush hour” scenario (see below), and record the total travel time of all passengers.

You (student pair) have:

1) A set of API

2) A simple solution (Bus program)

3) A set of test cases to run

2.5 Explanation of BUS program:

We can have a worst case algorithm called “bus”. This algorithm treats an elevator as a bus, it goes from bottom to top, stops at every floor, open the door, to let people in and out, then close the door and move on. After it reaches the top floor, it will go down. This algorithm can serve all requests, but it’s apparently not the fastest algorithm.

Your code is required to be managed code (C#, managed C++, etc).

  • It has to generate 0 (zero) Code Analysis warnings and errors. ( link for Code Analysis in Visual Studio)
  • It has to be correct,  all passengers can reach their destinations
  • It should be as fast as possible. 
  • It should not have randomness in scheduling (this is to avoid randomness in testing).

Score guideline: TA will evaluate the “average total travel time” for all passengers in the same test case, the lower, the better. If your performance is lower than “bus” solution, you get 0 points; if your program can’t deliver any passenger to the correct destination, you get 0 points.

One hint about elevator scheduling: When total weight is within 40 kg of the max limit, or the number of passengers is already at maximum, the elevator doesn’t need to stop for more external requests.

The elevator scheduler program doesn’t know how many passengers are waiting on each floor, it doesn’t know how many passengers will show up either. This is the same with the real world situation.

3. Testing

TA will simulate a “rush hour” test. The “rush hour” test is to simulate the come-to-work and leave-work scenario in a business building, which has the following 2 parts (they can be run next to each other).

1) Simple test. 20 passengers

20 people going thru random floors within 5 minutes.

2) Come-to-work. 1000 total passengers,  duration: 60 minutes

a) 80% of them goes from floor 0 and 1 to all other floors, the destination is distributed evenly. The time each passenger arrives at the elevator can be emulated as a normal distribution.

b) 20% of them are going between any 2 floors of [2, 20], very few people travel between 2 adjacent floors (e.g. from floor 5 to 4). Other than this, the distribution is also even.

3) Leave-work. 1000 total passengers, duration: 45 minutes

a) 90% of them go from other floors to floor 1 or floor 0.

b) 10% of them travel between floors [2, 20], again, very few people travel between 2 adjacent floors.

现代软件工程 结对编程 (II) 电梯调度相关推荐

  1. 现代软件工程 结对编程 (II) 电梯调度 算法和测试框架

    [很多同学完成了上一个结对编程项目后,  很想知道下一个项目是什么, 我们这次要练习如何设计 接口, 测试框架,  和算法. ] [博客园的朋友们也可以试一试怎么高效地解决这个问题] 现代软件工程系列 ...

  2. 现代软件工程系列 结对编程 (II) 电梯调度程序

    [很多同学完成了上一个结对编程项目后,  很想知道下一个项目是什么, 我们这次要练习如何设计 接口, 测试框架,  和算法] 现代软件工程系列 结对编程 (II) 电梯调度程序 ------- Pai ...

  3. 现代软件工程系列 结对编程 (II) 电梯调度程序新需求

    原来布置的作业在这里: http://www.cnblogs.com/xinz/archive/2010/11/28/1890300.html 正如在现实生活中一样, 软件项目的需求也会经常发生变化. ...

  4. 结对项目开发-电梯调度

    结对项目开发-电梯调度 n设计和实现一个电梯调度瞄准两个正确性和性能,在托管代码. n技能训练: na)需求分析 nb)高层次设计(界面,信息隐藏,松耦合) nc)设计文档 nd)算法设计 n1 .背 ...

  5. 软件工程 结对编程1

    软件工程 结对编程1 四则运算题目生成程序(Gui) *这次博客的一个小目录 1.我和我的小伙伴的学号 2.项目开发的coding.net 地址 3.项目完成的五个部分: a.需求分析  b.程序设计 ...

  6. 结对编程作业---电梯调度程序

    这次的作业和以往不同,按照老师的要求,我们要进行结对编程的练习.所谓结对编程相信各位都不会陌生,这里不在赘述. 首先介绍下我的小伙伴,很幸运的是我的队友也是我的室友---樊西江,这为我们合作提供了很大 ...

  7. 结对项目开发电梯调度 - 整体设计

    一.系统介绍 1. 功能描述 本电梯系统用来控制一台运行于一个具有16层的大楼电梯,它具有上升.下降.开门.关门.载客的基本功能. 大楼的每一层都有: (1) 两个指示灯:  这两个指示灯分别用于指示 ...

  8. 现代软件工程 结对编程 (I) 三维棋类游戏

    Pair Project I 3D Board Game Turn a usual 2D board game into 3D by transferring  board and game rule ...

  9. 清华大学 现代软件工程 结对编程项目 (一)

    Pair Project I:  Casual Game ++ Improve an existing casual game with incremental innovation. Skills ...

最新文章

  1. mac 下搭建 php + apache + mysql 服务器(cool)
  2. 2 -13 作业需求
  3. 大数据,大格局,大发展
  4. PHP网站配置项,Thinkphp5通用网站后台配置项的动态添加及更新
  5. php生成饼状图 柱形图,求一个饼状图或柱状图php生成类或例子
  6. Spring Boot应用热启动的一种方式
  7. 从西刺网获取可用的代理IP
  8. Android手机玩8086汇编
  9. MySQL8.0 setup_actors执行时间统计
  10. [转]XXX无法访问。你可能没有权限使用网络资源
  11. scikit-learn回归类库使用
  12. Android项目:基于安卓Android校园零食配送系统app(计算机毕业设计)
  13. C Clion开发工具注册码
  14. 响应式设计中怎样布局?
  15. 【pwn-栈溢出】— ret2plt
  16. 全志F1C100S/F1C200S学习笔记(1)——基础简介及资料
  17. 马云卸任后去蹦迪了?都是假的。
  18. keil延时c语言程序设计,Keil C51程序设计中几种精确延时方法
  19. 什么是win32编程
  20. 数据库学习笔记(SQL server语句)

热门文章

  1. 《人月神话》阅读笔记(三)
  2. LightOJ - 1140 How Many Zeroes?
  3. linux处置服务Iptables
  4. 正确的 zip 压缩与解压代码
  5. sql获取受影响行数、插入标识值
  6. POJ 2255/递归:前序中序求后序
  7. request.getAttribute()的数据类型转换问题
  8. MVC与三层架构的联系及三层架构实现学生注册功能
  9. android蓝牙通信_使用Arduino构建OLED显示屏与Android手机接口的智能手表
  10. linux中sed命令用例,Linux中使用sed命令或awk命令修改常规配置文件