千家信息网

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

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,现代软件工程 结对编程 (II) 电梯调度Pair Project II: Elevator Scheduler<现代软件工程> 的结对编程作业, 作者: 邹欣怎样设计API? 怎样从不同角度考虑需求
千家信息网最后更新 2026年11月01日现代软件工程 结对编程 (II) 电梯调度

现代软件工程 结对编程 (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:

  1. a) Requirement Analysis

需求分析

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

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

  1. c) Test Framework Design

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

  1. d) Implementation skills

设计的实现

  1. 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

  1. 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.2 We will discuss the student's submission in the class, pick the best design.

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

  4. 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:

  1. a) how to keep it simple.

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

  3. c) which component is actually driving the elevator?

  4. 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:

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

  2. b) how to check the correctness of the scheduler?

  3. c) how to prevent "cheating" by the scheduler?

  4. 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:

    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).

      20 people going thru random floors within 5 minutes.


        设计 测试 框架 编程 不同 需求 e.g. 工程 电梯 软件 软件工程 调度 有效 伙伴 作者 信息 就是 数据 方案 程序 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 山东特亿宝互联网科技有限公司 中关村互联网 科技集团 高科技互联网 科技互联网龙头 互联网和科技创新 互联网与科技发展 猪兼强互联网科技 百单互联网科技有限公司 无锡溥仪互联网科技有限公司 北京大学互联网科技怎么样 互联网时代科技改变生活 互联网金融中的现代科技 知域互联网科技有限公司大骗子 想开互联网科技公司怎么样 南博望互联网科技有限公司 互联网第三次科技革命特征 富国互联网金融科技混合基金 35岁以上互联网科技行业 南京一网一红互联网科技有限公司 易企秀互联网科技是做什么的 互联网与科技金融数据 互联网科技战争 互联网金融 科技 小马过河互联网科技 伴你行互联网科技有限公司 农村开互联网科技讲堂 互联网金融科技公司干啥的 互联网公司科技股 特约风豹互联网科技为什么扣费 山东亿川互联网科技有限责任公司
        0