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

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/500660.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

java 中violate_Java中的Volatile关键字

Java的volatile关键字用于标记一个Java变量为“在主存中存储”。更确切的说,对volatile变量的读取会从计算机的主存中读取,而不是从CPU缓存中读取,对volatile变量的写入会写入到主存中,而不只是写入到CPU缓存。实际上,…

现代软件工程系列 创新靠学分

如何在学校里讲创新, 这是一个老问题。 但是天朝的教育体制总有办法,请看: http://news.163.com/10/1125/03/6MABIS4H00014AED.html 武汉一高校设"创新学分" 不搞创新不能毕业 去年秋季,武汉科技大学中南分校出台《学籍管理规定》,…

java 如何发提示_消息提醒-如何实现收到待办给QQ发送提醒?

一、前期准备一台windows服务器(用于运行QQ机器人)下载QQ机器人框架二、QQ机器人配置1、解压前面下载的机器人框架和httpapi2、打开解压后的 小栗子框架.exe3、在用户列表右击选择添加单个4、添加后右击点添加后的账号选择登录选中QQ5、点击应用中心>点击导入插件>选中前…

顶级程序员的心得 - Coders at Work

这篇博客经历了 CSDN 的历次改版后,格式已经坏了, 我重新写了一篇,重排了格式: 顶级程序员的心得 –– Coders at Work_SoftwareTeacher的专栏-CSDN博客顶级程序员的心得 –– Coders at Work我2009年读了 “Coders at Work”, …

jdbc mysql myeclipse_关于JDBC连接MySQL的问题,我一直解决不了(Myeclipse 环境下)

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼package org.mlj.jdbc;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.sql.Statement;import java.net.UnknownHostException;import java.net.InetAddress.*; public class…

现代软件工程课件 需求分析 如何提出靠谱的项目建议 NABCD

《构建之法 - 现代软件工程》课件 互联网时代对于创新者来说, 既是一个伟大的时代, 又是一个糟糕的时代。 你有很多机会做出影响世界的产品, 但是, 似乎任何想法都被别人想到过了, 做出来了, 上市了, 移植到各种平台上去了… 那么我们后来人除了羡慕别人生得早, 还有什么机…

java禁止数据库写入事务_Java -- JDBC 事务处理, 事务的隔离级别 脏读 不可重复读 等......

1. 事务指逻辑上的一组操作,组成这组操作的各个单元,要不全部成功,要不全部不成功。数据库开启事务命令•start transaction开启事务•Rollback回滚事务•Commit提交事务JDBC控制事务语句•Connection.setAutoCommit(false); //start transa…

现代软件工程 教学计划 适应两种难度和重点

现代软件工程 教学计划 经过 2007 - 2018 年,30个不同学校的实践后, 《构建之法》在大学的两种教法已经出现了, 这两种教学计划适应于两种难度和重点。 下面我们具体介绍这两种计划。 1. 软件工程导论(适合大一下的学生,在学过…

java中setDocument_Java ActionItem.setDocumentId方法代码示例

import org.kuali.rice.kew.actionitem.ActionItem; //导入方法依赖的package包/类Test public void testConvertActionItem() throws Exception {// get test dataString testWorkgroupName "TestWorkgroup";Group testWorkgroup KimApiServiceLocator.getGroupSe…

敏捷软件开发宣言–Manifesto for Agile Software Development

敏捷开发, 谁不会呀, 不就是 没文档, 出活快, 用户说啥都能改? 下面是一个笑话, 王屋村的大牛说 - 我最近转手接了一个活, 完事能挣四五万, 我拿过图纸一看, 不就是盖一烟囱吗? 我们是敏捷 (Agile) 的团队,要文档作甚? 马上开始干活! 都快盖好了&am…

敏捷软件开发 12 原则

作为 <现代软件工程> 的一个作业, 我要求同学们把 英文的敏捷开发原则 翻译成中文并解释。 大部分同学都提供了持续重构, 不断提高的版本。 技术翻译专家余晟老师也对其中较难翻译的三条原则提了很好的建议。 下面是我的尝试, 翻译要做到 信, 达, 雅, 很难, 而且中国的…

教师管理系统设计报告java_教师办公管理系统的设计与实现

随着计算机及网络技术的飞速发展&#xff0c;Internet/Intranet应用在全球范围内日益普及&#xff0c;当今社会正快速向信息化社会前进&#xff0c;信息自动化的作用也越来越大。从而使我们从繁杂的事务中解放出来&#xff0c;提高了我们的工作效率。教师办公管理系统是一个教育…

同学, 你的板砖呢?

这次 <现代软件工程> 的4 个团队要做下面的项目, 唯一的要求是 - 做真实的项目: 第一组: 一个BBS 的通用客户端 第二组: 挖掘学术圈内的师承关系 第三组: 真人拳皇 - 把你老板的照片变成对手, 然后给他一顿痛打 第四组: 一个叫呆呆的东东。 他们缺什么呢? 缺一些…

设置java环境变量生效 centos_解决CentOS java环境不生效的问题

查看当前java版本[rootlocalhost jdk1.6.0_45]# java -versionopenjdk version "1.8.0_65"OpenJDK Runtime Environment (build 1.8.0_65-b17)OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)发现默认的还是系统自带的1.8&#xff0c;不是配置的1.6。[rootl…

顶级程序员的心得–Coders at Work

最新版本在这里&#xff1a; (2584条消息) 顶级程序员的心得 –– Coders at Work_SoftwareTeacher的专栏-CSDN博客https://blog.csdn.net/SoftwareTeacher/article/details/113489014

JAVA中vector是否存在数据_如何找出std :: vector中是否存在项目?

我要做的就是检查向量中是否存在某个元素&#xff0c;因此我可以处理每种情况。if ( item_present )do_this();elsedo_that();#1楼您可以尝试以下代码&#xff1a;#include #include // You can use class, struct or primitive data type for Itemstruct Item {//Some fields}…

scrum–yesterday once more

在敏捷开发的 SCRUM 流程中, 一个基本要求就是团队中的成员在每日例会中介绍自己昨天的进度, 今天的计划, 和遇到的困难。 下面是《现代软件工程》课程上一个学生团队在2/18 和 2/19 这两天的报告。 粗粗看去, 不禁有 “昨日重来” 的感觉。 一些同学的任务在2/18 报告的 yest…

软件工程 之 画扇面

软件工程的历史虽然说只有短短的四十多年时间 &#xff08;1968 年提出&#xff09;&#xff0c; 但是软件工程的主体 – 人类 – 已经出现在世界上好些年了。 人还是那些人&#xff0c;事儿还是那些事儿, 好的&#xff0c;坏的&#xff0c;可笑的模式同样会出现。 我看到同学们…

java 类加载生命周期_Java类的加载与生命周期

一、概要&#xff1a;类的生命周期从类的 加载、连接、初始化 开始&#xff0c;到类的 卸载结束&#xff1b;二、几个阶段&#xff1a;加载&#xff1a;查找并加载类的二进制数据。(把类的.class文件的二进制数据读入内存&#xff0c;存放在运行时数据区的方法区&#xff1b;类…

tooooooooooooold

看到一篇文章: http://blog.csdn.net/atixujie/archive/2011/04/06/6305371.aspx 推荐软件工程的书籍, 我看了一眼, 觉得特别陌生, 就找了一下原文, 原文在: http://www.cs.cmu.edu/afs/cs.cmu.edu/user/shaw/www/Edparts/sebook.htm 在原始的网页上有一段小字: It was l…