现代软件工程 结对编程 (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,如需转载请自行联系原作者

目录
相关文章
|
3月前
|
人工智能 搜索推荐 数据管理
探索软件测试中的自动化测试框架选择与优化策略
本文深入探讨了在现代软件开发流程中,如何根据项目特性、团队技能和长期维护需求,精准选择合适的自动化测试框架。
175 11
|
1月前
|
算法 数据安全/隐私保护 计算机视觉
基于FPGA的图像双线性插值算法verilog实现,包括tb测试文件和MATLAB辅助验证
本项目展示了256×256图像通过双线性插值放大至512×512的效果,无水印展示。使用Matlab 2022a和Vivado 2019.2开发,提供完整代码及详细中文注释、操作视频。核心程序实现图像缩放,并在Matlab中验证效果。双线性插值算法通过FPGA高效实现图像缩放,确保质量。
|
3月前
|
人工智能 JavaScript 前端开发
自动化测试框架的演进与实践###
本文深入探讨了自动化测试框架从诞生至今的发展历程,重点分析了当前主流框架的优势与局限性,并结合实际案例,阐述了如何根据项目需求选择合适的自动化测试策略。文章还展望了未来自动化测试领域的技术趋势,为读者提供了宝贵的实践经验和前瞻性思考。 ###
|
10天前
|
机器学习/深度学习 设计模式 测试技术
Python 高级编程与实战:构建自动化测试框架
本文深入探讨了Python中的自动化测试框架,包括unittest、pytest和nose2,并通过实战项目帮助读者掌握这些技术。文中详细介绍了各框架的基本用法和示例代码,助力开发者快速验证代码正确性,减少手动测试工作量。学习资源推荐包括Python官方文档及Real Python等网站。
|
1月前
|
人工智能 自然语言处理 测试技术
AxBench:斯坦福大学推出评估语言模型控制方法的基准测试框架
AxBench 是由斯坦福大学推出,用于评估语言模型可解释性方法的基准测试框架,支持概念检测和模型转向任务,帮助研究者系统地比较不同控制技术的有效性。
49 5
AxBench:斯坦福大学推出评估语言模型控制方法的基准测试框架
|
19天前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
29 0
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
|
3月前
|
数据采集 人工智能 自然语言处理
Midscene.js:AI 驱动的 UI 自动化测试框架,支持自然语言交互,生成可视化报告
Midscene.js 是一款基于 AI 技术的 UI 自动化测试框架,通过自然语言交互简化测试流程,支持动作执行、数据查询和页面断言,提供可视化报告,适用于多种应用场景。
854 1
Midscene.js:AI 驱动的 UI 自动化测试框架,支持自然语言交互,生成可视化报告
|
2月前
|
存储 测试技术 API
pytest接口自动化测试框架搭建
通过上述步骤,我们成功搭建了一个基于 `pytest`的接口自动化测试框架。这个框架具备良好的扩展性和可维护性,能够高效地管理和执行API测试。通过封装HTTP请求逻辑、使用 `conftest.py`定义共享资源和前置条件,并利用 `pytest.ini`进行配置管理,可以大幅提高测试的自动化程度和执行效率。希望本文能为您的测试工作提供实用的指导和帮助。
135 15
|
3月前
|
Linux Shell 网络安全
Kali Linux系统Metasploit框架利用 HTA 文件进行渗透测试实验
本指南介绍如何利用 HTA 文件和 Metasploit 框架进行渗透测试。通过创建反向 shell、生成 HTA 文件、设置 HTTP 服务器和发送文件,最终实现对目标系统的控制。适用于教育目的,需合法授权。
103 9
Kali Linux系统Metasploit框架利用 HTA 文件进行渗透测试实验
|
3月前
|
安全 Ubuntu Linux
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
75 9
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架

热门文章

最新文章