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

简介:

[很多同学完成了上一个结对编程项目后,  很想知道下一个项目是什么, 我们这次要练习如何设计 接口, 测试框架,  和算法. ]

[博客园的朋友们也可以试一试怎么高效地解决这个问题]

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

 

-------

Pair Project II Elevator Scheduler  

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

 

Skills to test:

a)       Requirement Analysis

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

c)       Design by contract, 

d)       Implementation skills in C#

e)       Algorithm design

 

1.                 Background

Imagine we’re building a tall office building,  it has the following configuration about elevators:

Building has 21 floors, 4 elevators, many passengers use these elevators everyday (passenger weight: average 70kg. max 120kg, min 45kg).

 

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

All floors

10

800 kg

3

All floors

20

1600 kg

4

All floors

20

2000 kg

 

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   After 2.1 is submitted,  TA will review all submission and give out scores,   based on the best design (either from students, or from TA),  each pair will focus on the implementation of the “elevator scheduler” program.

 

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

It has to be correct

It has to be fast

 

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 45 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

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

a)        90% of them go from other floors to floor1 or floor0.

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

 

 

 

Deadline:

    1) 11/30, Tuesday, noon.  

students will submit design 1: if you were the TA, and in charge of the testing frame work, what is your design for the test framework, and what is the interface you want the students to implement?  You need to submit class definition,  and interface of the scheduler,  and pseudo code (伪代码) of your test framework.

 

    2) 12/10/2010, Friday, noon.  

Students will submit the implementation of the elevator scheduler.

 

   3)  12/13/2010,  Monday, noon.

Students will post a blog to their team blog site, to describe the overall design of the scheduler.  Description of test framework is optional, but encouraged.










本文转自SoftwareTeacher博客园博客,原文链接:http://www.cnblogs.com/xinz/archive/2010/11/28/1890300.html,如需转载请自行联系原作者

目录
相关文章
|
1月前
|
人工智能 搜索推荐 数据管理
探索软件测试中的自动化测试框架选择与优化策略
本文深入探讨了在现代软件开发流程中,如何根据项目特性、团队技能和长期维护需求,精准选择合适的自动化测试框架。
98 8
|
1月前
|
人工智能 JavaScript 前端开发
自动化测试框架的演进与实践###
本文深入探讨了自动化测试框架从诞生至今的发展历程,重点分析了当前主流框架的优势与局限性,并结合实际案例,阐述了如何根据项目需求选择合适的自动化测试策略。文章还展望了未来自动化测试领域的技术趋势,为读者提供了宝贵的实践经验和前瞻性思考。 ###
|
5天前
|
存储 测试技术 API
pytest接口自动化测试框架搭建
通过上述步骤,我们成功搭建了一个基于 `pytest`的接口自动化测试框架。这个框架具备良好的扩展性和可维护性,能够高效地管理和执行API测试。通过封装HTTP请求逻辑、使用 `conftest.py`定义共享资源和前置条件,并利用 `pytest.ini`进行配置管理,可以大幅提高测试的自动化程度和执行效率。希望本文能为您的测试工作提供实用的指导和帮助。
49 15
|
14天前
|
数据采集 人工智能 自然语言处理
Midscene.js:AI 驱动的 UI 自动化测试框架,支持自然语言交互,生成可视化报告
Midscene.js 是一款基于 AI 技术的 UI 自动化测试框架,通过自然语言交互简化测试流程,支持动作执行、数据查询和页面断言,提供可视化报告,适用于多种应用场景。
136 1
Midscene.js:AI 驱动的 UI 自动化测试框架,支持自然语言交互,生成可视化报告
|
26天前
|
Linux Shell 网络安全
Kali Linux系统Metasploit框架利用 HTA 文件进行渗透测试实验
本指南介绍如何利用 HTA 文件和 Metasploit 框架进行渗透测试。通过创建反向 shell、生成 HTA 文件、设置 HTTP 服务器和发送文件,最终实现对目标系统的控制。适用于教育目的,需合法授权。
57 9
Kali Linux系统Metasploit框架利用 HTA 文件进行渗透测试实验
|
1月前
|
安全 Ubuntu Linux
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
46 9
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
|
2月前
|
Java 测试技术 API
探索软件测试中的自动化框架选择####
在当今快节奏的软件开发周期中,自动化测试已成为确保产品质量与加速产品迭代的关键策略。本文深入剖析了自动化测试的核心价值,对比分析了市场上主流的自动化测试框架,旨在为项目团队提供选型时的考量因素及实践指南,助力高效构建适应未来变化的自动化测试体系。 ####
|
1月前
|
Java 测试技术 API
探索软件测试中的自动化测试框架
本文深入探讨了自动化测试在软件开发中的重要性,并详细介绍了几种流行的自动化测试框架。通过比较它们的优缺点和适用场景,旨在为读者提供选择合适自动化测试工具的参考依据。
|
1月前
|
jenkins 测试技术 持续交付
自动化测试框架的搭建与实践
在软件开发领域,自动化测试是提升开发效率、确保软件质量的关键手段。本文将引导读者理解自动化测试的重要性,并介绍如何搭建一个基本的自动化测试框架。通过具体示例和步骤,我们将探索如何有效实施自动化测试策略,以实现软件开发流程的优化。
73 7
|
1月前
|
数据管理 jenkins 测试技术
自动化测试框架的设计与实现
在软件开发周期中,测试是确保产品质量的关键步骤。本文通过介绍自动化测试框架的设计原则、组件构成以及实现方法,旨在指导读者构建高效、可靠的自动化测试系统。文章不仅探讨了自动化测试的必要性和优势,还详细描述了框架搭建的具体步骤,包括工具选择、脚本开发、执行策略及结果分析等。此外,文章还强调了持续集成环境下自动化测试的重要性,并提供了实际案例分析,以帮助读者更好地理解和应用自动化测试框架。
下一篇
开通oss服务