Redian新闻
>
今年ebiz的冬天来的特别早
avatar
今年ebiz的冬天来的特别早# Money - 海外理财
h*o
1
我觉得和cc150 8.2 design a call center 类似。
bank/callcenter 收到一个request,分给一个空闲的elevator/employee
如果没闲人,把request入queue. 一旦有人闲下来,就来queue里找任务去处理。bank/
callcenter就好像server, elevator/employee 就好象process/thread/task.
passanger 是 request 中的 subrequest.
贴一个我的码吧。 欢迎指正。网上有些code有铃啊,门的。我不明白。就不加入我的
码了。
test_evelatorSystem(){
mg = Manager::getInstance();
for (i = 0; i < 4; i++){
//sb. press button UP at floor 5
Request* req = new Request(floor=5, direction=UP);
mg.dispatchRequest(req);
}
}
class Manager{ //singleton
private:
vector elevator_list[3];
queue req_queue;
public:
static Manager* getInstance();
dispatchRequest(Request& req);
Request* getNextReq(){return the next req of req_queue};

}
Manager::dispatchRequest(Request& req);{
//or using goodSchedule() to find a best elevator.
find an idle evelator E from elevator_list,
E.startReq(req).
if no idle evelator, put req in req_queue
}
Manager::goodSchedule(){ //TBD
if available pick a standing elevator for this floor.
else pick an elevator moving to this floor.
else pick a standing elevator on an other floor.
else pick the elevator with the lowest load.
}
//A request is created when sb. press button "UP" or "DOWN" at a floor
class Request{
floor; //in which floor the button is pressed
direction; //UP/DOWN
}
//passanger press target_floor in the elevator
class Passanger{
name;
target_floor;
};
class Elevator{
public:
Elevator(Manager& m, max_size):_m(m), _capacity(capacity){};
startReq(req); //call by manager
private:
int passanger_num;
vector plist;
int id;
int _capacity;
status; //busy/idle
current_floor;
moveTo(destination);
load(vector pass)
unLoad(vector pass);
completeReq();
vector stop_list;
}
Elevator::startReq(req){
status = busy ;
moveTo(req.floor);
pass=getPassangers(NULL);
load(pass);
schedule(req.direction);
for each target_floor of stop_list:
moveTo(target_floor);
pass=getPassangers(plist)
unLoad(pass);
stop_list.pop(target_floor);
completeReq();
}
Elevator::moveTo(destination){
sleep some time;
current_floor = destination;
}
vector& Elevator::getPassangers(vector plist){
if plist exist; randomly create some passangers from plist;
else randomly create some passangers
return passangers;
}
Elevator::load(vector pass){
if pass overload, dump some of them.
add pass to plist
// passamger_num = plist.size();
sleep some time;
}
Elevator::unLoad(pass){
remove pass from plist;
// passamger_num = plist.size();
sleep some time;
}
//resort the task according to the passanger's target_floors and execute
step by step.
Elevator::schedule(req.direction){
go over all passanger P in plist{
//only handle P matching the requestion direction.
if (P->direction == req.direction){
if (req.direction == UP){
if (P.target_floor>cur_floor) stop_list.push(P
.target_floor);
}
else if (req.direction == DOWN){
if (P.target_floor.target_floor);
}
}
sort stop_list
}
}
completeReq(){
status = idle;
if (req = manager.getNextReq()){
startReq(req);
}
else //cout << "I am idle"
}
avatar
g*5
2
二手市场上的az卡EBay 都卖不动,
还有另外一个标志就是婷婷也频繁光顾这里撸羊毛,说明ebiz 可能还不如撸羊毛好
avatar
s*w
3
making sense

bank/

【在 h**o 的大作中提到】
: 我觉得和cc150 8.2 design a call center 类似。
: bank/callcenter 收到一个request,分给一个空闲的elevator/employee
: 如果没闲人,把request入queue. 一旦有人闲下来,就来queue里找任务去处理。bank/
: callcenter就好像server, elevator/employee 就好象process/thread/task.
: passanger 是 request 中的 subrequest.
: 贴一个我的码吧。 欢迎指正。网上有些code有铃啊,门的。我不明白。就不加入我的
: 码了。
: test_evelatorSystem(){
: mg = Manager::getInstance();
: for (i = 0; i < 4; i++){

avatar
l*2
4
tingting也是做ebiz的
avatar
D*6
5
Thanks. Mark!
avatar
d*f
6
扯淡,冬天是ebiz 最好的时间

【在 g*******5 的大作中提到】
: 二手市场上的az卡EBay 都卖不动,
: 还有另外一个标志就是婷婷也频繁光顾这里撸羊毛,说明ebiz 可能还不如撸羊毛好

avatar
c*7
7
正想说,熬了一年,好日子快到了

【在 d********f 的大作中提到】
: 扯淡,冬天是ebiz 最好的时间
avatar
b*o
8
iphone季节很快来了.大神们又发财了.
avatar
s*i
9
iphone这次估计首发有中国。咋赚钱啊?

【在 b********o 的大作中提到】
: iphone季节很快来了.大神们又发财了.
avatar
b*e
10
不是晚一周?
不过偶是自己买自用,无视时间差。

【在 s*****i 的大作中提到】
: iphone这次估计首发有中国。咋赚钱啊?
avatar
C*g
11
最近bb一两个月deal不少啊。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。