pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

給定輪班列表,創(chuàng)建時(shí)間表的摘要描述

Create a summary description of a schedule given a list of shifts(給定輪班列表,創(chuàng)建時(shí)間表的摘要描述)
本文介紹了給定輪班列表,創(chuàng)建時(shí)間表的摘要描述的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

假設(shè)我有一個(gè)事件的輪班列表(格式為開始日期/時(shí)間、結(jié)束日期/時(shí)間) - 是否有某種算法可以用來創(chuàng)建日程的概括摘要?大多數(shù)輪班陷入某種常見的重復(fù)模式(即星期一上午 9:00 到下午 1:00,星期二上午 10:00 到下午 3:00 等)是很常見的.但是,此規(guī)則可以(并且將會(huì))有例外(例如,其中一個(gè)班次在假期發(fā)生并被重新安排在第二天).最好從我的摘要"中排除那些,因?yàn)槲蚁M峁┮粋€(gè)更一般的答案,說明此事件通常何時(shí)發(fā)生.

我想我正在尋找某種統(tǒng)計(jì)方法來確定發(fā)生的日期和時(shí)間,并根據(jù)列表中找到的最頻繁出現(xiàn)的情況創(chuàng)建描述.對(duì)于這樣的事情是否有某種通用算法?有沒有人創(chuàng)建過類似的東西?

理想情況下,我正在尋找 C# 或 VB.NET 中的解決方案,但不介意從任何其他語言移植.

提前致謝!

解決方案

您可以使用

在這里您可以清楚地看到我們的七個(gè)集群.

這解決了您的部分問題:識(shí)別數(shù)據(jù).現(xiàn)在您還希望能夠?qū)ζ溥M(jìn)行標(biāo)記.

因此,我們將獲取每個(gè)集群并取平均值(四舍五入):

Table[Round[Mean[clusters[[i]]]], {i, 7}]

結(jié)果是:

日開始結(jié)束{1",10",15"},{1",12",17"},{3"、10"、15"}、{3",14",17"},{5"、10"、15"}、{5"、11"、15"}、{1"、7"、9"}

這樣你就可以重新獲得七門課了.

現(xiàn)在,也許您想對(duì)班次進(jìn)行分類,無論是哪一天.如果同一個(gè)人每天在同一時(shí)間做同樣的任務(wù),那么稱之為周一從 10 點(diǎn)到 15 點(diǎn)"是沒有用的,因?yàn)樗舶l(fā)生在周三和周五(如我們的例子中).

讓我們不考慮第一列來分析數(shù)據(jù):

集群=FindClusters[Take[data, All, -2],Method->{Agglomerate",Linkage"->Complete"}];

在這種情況下,我們不會(huì)選擇要檢索的集群數(shù)量,而是由包決定.

結(jié)果是

您可以看到已識(shí)別出五個(gè)集群.

讓我們嘗試標(biāo)記"他們和以前一樣:

Grid[Table[Round[Mean[clusters[[i]]]], {i, 5}]]

結(jié)果是:

 開始 結(jié)束{10",15"},{12",17"},{14",17"},{11",15"},{7",9"}

這正是我們懷疑"的:每天同一時(shí)間都有重復(fù)的事件可以組合在一起.

夜班和標(biāo)準(zhǔn)化

如果您有(或計(jì)劃有)從一天開始到下一天結(jié)束的輪班,最好建模

{Start-Day Start-Hour Length}//正確!

{Start-Day Start-Hour End-Day End-Hour}//不正確!

那是因?yàn)榕c任何統(tǒng)計(jì)方法一樣,必須明確變量之間的相關(guān)性,否則該方法會(huì)失敗.該原則可以運(yùn)行類似保持您的候選數(shù)據(jù)規(guī)范化"的內(nèi)容.兩個(gè)概念幾乎一樣(屬性應(yīng)該是獨(dú)立的).

--- 編輯結(jié)束---

現(xiàn)在我猜你已經(jīng)很清楚你可以用這種 if 分析做什么樣的事情了.

一些參考

  1. 當(dāng)然,維基百科及其參考資料"和進(jìn)一步閱讀"是很好的向?qū)?
  2. 一個(gè)不錯(cuò)的視頻此處展示了 Statsoft 的功能,但您可以到達(dá)那里許多關(guān)于你可以用算法做的其他事情的想法.
  3. 這里是算法的基本解釋涉及
  4. 在這里您可以找到R 令人印象深刻的聚類分析功能(R 是一個(gè)非常好的選擇)
  5. 最后,這里您可以找到一長(zhǎng)串用于統(tǒng)計(jì)的免費(fèi)和商業(yè)軟件,包括聚類.

HTH!

Assuming I have a list of shifts for an event (in the format start date/time, end date/time) - is there some sort of algorithm I could use to create a generalized summary of the schedule? It is quite common for most of the shifts to fall into some sort of common recurrence pattern (ie. Mondays from 9:00 am to 1:00 pm, Tuesdays from 10:00 am to 3:00 pm, etc). However, there can (and will be) exceptions to this rule (eg. one of the shifts fell on a holiday and was rescheduled for the next day). It would be fine to exclude those from my "summary", as I'm looking to provide a more general answer of when does this event usually occur.

I guess I'm looking for some sort of statistical method to determine the day and time occurences and create a description based on the most frequent occurences found in the list. Is there some sort of general algorithm for something like this? Has anyone created something similar?

Ideally I'm looking for a solution in C# or VB.NET, but don't mind porting from any other language.

Thanks in advance!

解決方案

You may use Cluster Analysis.

Clustering is a way to segregate a set of data into similar components (subsets). The "similarity" concept involves some definition of "distance" between points. Many usual formulas for the distance exists, among others the usual Euclidean distance.

Practical Case

Before pointing you to the quirks of the trade, let's show a practical case for your problem, so you may get involved in the algorithms and packages, or discard them upfront.

For easiness, I modelled the problem in Mathematica, because Cluster Analysis is included in the software and very straightforward to set up.

First, generate the data. The format is { DAY, START TIME, END TIME }.
The start and end times have a random variable added (+half hour, zero, -half hour} to show the capability of the algorithm to cope with "noise".

There are three days, three shifts per day and one extra (the last one) "anomalous" shift, which starts at 7 AM and ends at 9 AM (poor guys!).

There are 150 events in each "normal" shift and only two in the exceptional one.

As you can see, some shifts are not very far apart from each other.

I include the code in Mathematica, in case you have access to the software. I'm trying to avoid using the functional syntax, to make the code easier to read for "foreigners".

Here is the data generation code:

Rn[] := 0.5 * RandomInteger[{-1, 1}];

monshft1 = Table[{ 1 , 10 + Rn[] , 15 + Rn[] }, {150}];  // 1
monshft2 = Table[{ 1 , 12 + Rn[] , 17 + Rn[] }, {150}];  // 2
wedshft1 = Table[{ 3 , 10 + Rn[] , 15 + Rn[] }, {150}];  // 3
wedshft2 = Table[{ 3 , 14 + Rn[] , 17 + Rn[] }, {150}];  // 4
frishft1 = Table[{ 5 , 10 + Rn[] , 15 + Rn[] }, {150}];  // 5
frishft2 = Table[{ 5 , 11 + Rn[] , 15 + Rn[] }, {150}];  // 6
monexcp  = Table[{ 1 , 7  + Rn[] , 9  + Rn[] }, {2}];    // 7

Now we join the data, obtaining one big dataset:

data = Join[monshft1, monshft2, wedshft1, wedshft2, frishft1, frishft2, monexcp];

Let's run a cluster analysis for the data:

clusters = FindClusters[data, 7, Method->{"Agglomerate","Linkage"->"Complete"}]

"Agglomerate" and "Linkage" -> "Complete" are two fine tuning options of the clustering methods implemented in Mathematica. They just specify we are trying to find very compact clusters.

I specified to try to detect 7 clusters. If the right number of shifts is unknown, you can try several reasonable values and see the results, or let the algorithm select the more proper value.

We can get a chart with the results, each cluster in a different color (don't mind the code)

ListPointPlot3D[ clusters, 
           PlotStyle->{{PointSize[Large], Pink},    {PointSize[Large], Green},   
                       {PointSize[Large], Yellow},  {PointSize[Large], Red},  
                       {PointSize[Large], Black},   {PointSize[Large], Blue},   
                       {PointSize[Large], Purple},  {PointSize[Large], Brown}},  
                       AxesLabel -> {"DAY", "START TIME", "END TIME"}]  

And the result is:

Where you can see our seven clusters clearly apart.

That solves part of your problem: identifying the data. Now you also want to be able to label it.

So, we'll get each cluster and take means (rounded):

Table[Round[Mean[clusters[[i]]]], {i, 7}]  

The result is:

Day   Start  End
{"1", "10", "15"},
{"1", "12", "17"},
{"3", "10", "15"},
{"3", "14", "17"},
{"5", "10", "15"},
{"5", "11", "15"},
{"1",  "7",  "9"}

And with that you get again your seven classes.

Now, perhaps you want to classify the shifts, no matter the day. If the same people make the same task at the same time everyday, so it's no useful to call it "Monday shift from 10 to 15", because it happens also on Weds and Fridays (as in our example).

Let's analyze the data disregarding the first column:

clusters=
 FindClusters[Take[data, All, -2],Method->{"Agglomerate","Linkage"->"Complete"}];

In this case, we are not selecting the number of clusters to retrieve, leaving the decision to the package.

The result is

You can see that five clusters have been identified.

Let's try to "label" them as before:

Grid[Table[Round[Mean[clusters[[i]]]], {i, 5}]]

The result is:

 START  END
{"10", "15"},
{"12", "17"},
{"14", "17"},
{"11", "15"},
{ "7",  "9"}

Which is exactly what we "suspected": there are repeated events each day at the same time that could be grouped together.

Edit: Overnight Shifts and Normalization

If you have (or plan to have) shifts that start one day and end on the following, it's better to model

{Start-Day Start-Hour Length}  // Correct!

than

{Start-Day Start-Hour End-Day End-Hour}  // Incorrect!  

That's because as with any statistical method, the correlation between the variables must be made explicit, or the method fails miserably. The principle could run something like "keep your candidate data normalized". Both concepts are almost the same (the attributes should be independent).

--- Edit end ---

By now I guess you understand pretty well what kind of things you can do with this kind if analysis.

Some references

  1. Of course, Wikipedia, its "references" and "further reading" are good guide.
  2. A nice video here showing the capabilities of Statsoft, but you can get there many ideas about other things you can do with the algorithm.
  3. Here is a basic explanation of the algorithms involved
  4. Here you can find the impressive functionality of R for Cluster Analysis (R is a VERY good option)
  5. Finally, here you can find a long list of free and commercial software for statistics in general, including clustering.

HTH!

這篇關(guān)于給定輪班列表,創(chuàng)建時(shí)間表的摘要描述的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Use of Different .Net Languages?(使用不同的 .Net 語言?)
Is there a C# library that will perform the Excel NORMINV function?(是否有執(zhí)行 Excel NORMINV 函數(shù)的 C# 庫?)
Determining an #39;active#39; user count of an ASP.NET site(確定 ASP.NET 站點(diǎn)的“活動(dòng)用戶數(shù))
Select x random elements from a weighted list in C# (without replacement)(從 C# 中的加權(quán)列表中選擇 x 個(gè)隨機(jī)元素(無需替換))
Best way to keep track of current online users(跟蹤當(dāng)前在線用戶的最佳方式)
C# Normal Random Number(C# 普通隨機(jī)數(shù))
主站蜘蛛池模板: 上海佳武自动化科技有限公司 | 桂林腻子粉_内墙外墙抗裂砂浆腻子粉推荐广西鑫达涂料厂家供应 | 冷镦机-多工位冷镦机-高速冷镦机厂家-温州金诺机械设备制造有限公司 | 电气控制系统集成商-PLC控制柜变频控制柜-非标自动化定制-电气控制柜成套-NIDEC CT变频器-威肯自动化控制 | 河南中整光饰机械有限公司-抛光机,去毛刺抛光机,精密镜面抛光机,全自动抛光机械设备 | 青岛美佳乐清洁工程有限公司|青岛油烟管道清洗|酒店|企事业单位|学校工厂厨房|青岛油烟管道清洗 插针变压器-家用电器变压器-工业空调变压器-CD型电抗器-余姚市中驰电器有限公司 | 焊锡丝|焊锡条|无铅锡条|无铅锡丝|无铅焊锡线|低温锡膏-深圳市川崎锡业科技有限公司 | 干式磁选机_湿式磁选机_粉体除铁器-潍坊国铭矿山设备有限公司 | 深圳市源和塑胶电子有限公司-首页 | 陕西自考报名_陕西自学考试网| 浴室柜-浴室镜厂家-YINAISI · 意大利设计师品牌 | 咿耐斯 |-浙江台州市丰源卫浴有限公司 | 轻型地埋电缆故障测试仪,频响法绕组变形测试仪,静荷式卧式拉力试验机-扬州苏电 | 换链神器官网-友情链接交换、购买交易于一体的站长平台 | 高温链条油|高温润滑脂|轴承润滑脂|机器人保养用油|干膜润滑剂-东莞卓越化学 | 土壤有机碳消解器-石油|表层油类分析采水器-青岛溯源环保设备有限公司 | 智能案卷柜_卷宗柜_钥匙柜_文件流转柜_装备柜_浙江福源智能科技有限公司 | hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 钢格板|镀锌钢格板|热镀锌钢格板|格栅板|钢格板|钢格栅板|热浸锌钢格板|平台钢格板|镀锌钢格栅板|热镀锌钢格栅板|平台钢格栅板|不锈钢钢格栅板 - 专业钢格板厂家 | 冷藏车-东风吸污车-纯电动环卫车-污水净化车-应急特勤保障车-程力专汽厂家-程力专用汽车股份有限公司销售二十一分公司 | 柔软云母板-硬质-水位计云母片组件-首页-武汉长丰云母绝缘材料有限公司 | 考试试题_试卷及答案_诗词单词成语 - 优易学 | 蜘蛛车-高空作业平台-升降机-高空作业车租赁-臂式伸缩臂叉装车-登高车出租厂家 - 普雷斯特机械设备(北京)有限公司 | 特材真空腔体_哈氏合金/镍基合金/纯镍腔体-无锡国德机械制造有限公司 | 股指期货-期货开户-交易手续费佣金加1分-保证金低-期货公司排名靠前-万利信息开户 | 自动部分收集器,进口无油隔膜真空泵,SPME固相微萃取头-上海楚定分析仪器有限公司 | 济南网站建设_济南网站制作_济南网站设计_济南网站建设公司_富库网络旗下模易宝_模板建站 | 塑料脸盆批发,塑料盆生产厂家,临沂塑料广告盆,临沂家用塑料盆-临沂市永顺塑业 | 深圳货架厂_仓库货架公司_重型仓储货架_线棒货架批发-深圳市诺普泰仓储设备有限公司 | 网站建设,北京网站建设,北京网站建设公司,网站系统开发,北京网站制作公司,响应式网站,做网站公司,海淀做网站,朝阳做网站,昌平做网站,建站公司 | 诸城网站建设-网络推广-网站优化-阿里巴巴托管-诸城恒泰互联 | 沥青灌缝机_路面灌缝机_道路灌缝机_沥青灌缝机厂家_济宁萨奥机械有限公司 | 气体检测仪-氢气检测仪-可燃气体传感器-恶臭电子鼻-深国安电子 | 企业管理培训,企业培训公开课,企业内训课程,企业培训师 - 名课堂企业管理培训网 | 便携式高压氧舱-微压氧舱-核生化洗消系统-公众洗消站-洗消帐篷-北京利盟救援 | 东莞市踏板石餐饮管理有限公司_正宗桂林米粉_正宗桂林米粉加盟_桂林米粉加盟费-东莞市棒子桂林米粉 | 青岛成人高考_山东成考报名网 | 天命文免费算命堂_自助算命_自由算命系统_长文周易 | PC阳光板-PC耐力板-阳光板雨棚-耐力板雨棚,厂家定制[优尼科板材] | 奥因-光触媒除甲醛公司-除甲醛加盟公司十大品牌 | 高防护蠕动泵-多通道灌装系统-高防护蠕动泵-www.bjhuiyufluid.com慧宇伟业(北京)流体设备有限公司 | 衬氟止回阀_衬氟闸阀_衬氟三通球阀_衬四氟阀门_衬氟阀门厂-浙江利尔多阀门有限公司 |