日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發(fā)布時間:2024/7/23 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 现代软件工程 结对编程 (II) 电梯调度 算法和测试框架 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

[很多同學(xué)完成了上一個結(jié)對編程項目后,? 很想知道下一個項目是什么, 我們這次要練習(xí)如何設(shè)計 接口, 測試框架,? 和算法. ]

[博客園的朋友們也可以試一試怎么高效地解決這個問題]

現(xiàn)代軟件工程系列 結(jié)對編程 (II) 電梯調(diào)度程序

?

-------

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.

?

?

總結(jié)

以上是生活随笔為你收集整理的现代软件工程 结对编程 (II) 电梯调度 算法和测试框架的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。