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

 

 

深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值