欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    算法合集之《半平面交的新算法及其实用价值》.ppt

    • 资源ID:6012037       资源大小:866.50KB        全文页数:48页
    • 资源格式: PPT        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    算法合集之《半平面交的新算法及其实用价值》.ppt

    9/14/2023,Zeyuan Zhu,1,All great ideas are controversial,or have been at one time.伟大的理论都是有争议的,或者至少曾经是有争议的。Gilbert Seldes(1893-1970)U.S.theater,film,and radio critic.,理论的争议,9/14/2023,Zeyuan Zhu,2,A wise man will make more opportunities than he finds.聪明人总是制造更多的机会,而不是去等待寻找。Francis Bacon(1561-1626)English philosopher,statesman,and lawyer.,制造机会,9/14/2023,Zeyuan Zhu,3,After the leaves have fallen,we return to a plain sense of things.It is as if we had come to an end of the imagination.叶落时分,我们回到一切的本来面目,这样就与创造与幻想的终点不远了。Wallace Stevens(1879-1955)U.S.poet,忘记过去,揭开本来面目,9/14/2023,Zeyuan Zhu,4,Hello,Ladies and Gentlemen.女士们先生们大家好Bonjour,Mesdames et Messieurs.Witajcie,Panie i Panowie.Hallo,Damen und Herren.Buna ziua,Doamenelor si Domnilor.Ciao,signore e signori.,Zeyuan Zhu,Grade 12,Nanjing Foreign Language School,Jiangsu,China.朱泽园,高三,南京市外国语学校,江苏,中国,9/14/2023,Zeyuan Zhu,5,New algorithm for Half-plane Intersection and its Practical Value Thesis for Chinese Team Selecting Contest 2006 半平面交的新算法及其实用价值 中国代表队2006年选拔赛论文,Zeyuan Zhu,Grade 12,Nanjing Foreign Language School,Jiangsu,China.朱泽园,高三,南京市外国语学校,江苏,中国,9/14/2023,Zeyuan Zhu,6,Project Overview 全文总揽,Aim:Present a new O(nlogn)algorithm for half-plane intersection(abbr.HPI),which is one of the most heatedly discussed problems in computer science;emphasize its advantages in practical application,and to some extent,reduce the complexity to O(n).However,the new algorithm will be extraordinarily easy to be implemented.,主旨:半平面的交是当今学术界热烈讨论的问题之一,本文将介绍一个全新的O(nlogn)半平面交算法,强调它在实际运用中的价值,并且在某种程度上将复杂度下降至O(n)线性。最重要的是,我将介绍的算法非常便于实现.,9/14/2023,Zeyuan Zhu,7,Project Overview 全文总揽,1 introduces what Half-Plane Intersection(HPI)is.什么是半平面交.2 prepares a convex polygon intersection(CPI).凸多边形交预备知识.3 briefly discuss a common solution for HPI D&C.简要介绍旧D&C算法.4 my new algorithm S&I emerges detailedly.揭开我的新算法S&I神秘面纱.5 conclusion and discussion on further practical use.总结和实际运用.,9/14/2023,Zeyuan Zhu,8,1.Statement of the Problem-问题概述,9/14/2023,Zeyuan Zhu,9,1.Statement of the Problem,A line in plane is usually represented as ax+by=c.Similarly,its inequality form ax+by()c represents a half-plane(also named h-plane for short)as one side of this line.,3x-2y=1,x+2y1,众所周知,直线常用ax+by=c表示,类似地半平面以ax+by()c为定义。,9/14/2023,Zeyuan Zhu,10,1.Statement of the Problem,Given n half-planes,aix+biyci(1in),you are to determine the set of all points that satisfying all the n inequations.给定n个形如aix+biyci的半平面,找到所有满足它们的点所组成的点集,9/14/2023,Zeyuan Zhu,11,1.Statement of the Problem,Feasible region forms a shape of convex hull possibly unbounded.Add four h-planes forming a rectangle,to make the intersection area finite.合并后区域形如凸多边形,可能无界此时增加4个半平面保证面积有限,9/14/2023,Zeyuan Zhu,12,1.Statement of the Problem,Each h-plane builds up at most one side of the convex polygon.Hence,The convex region will be bounded by at most n edges.每个半平面最多形成相交区域的一条边,因此相交区域不超过n条边。,6 h-planespentagon,9 h-planespentagon,9/14/2023,Zeyuan Zhu,13,1.Statement of the Problem,Pay attention that intersection sometimes yields a line,a ray,a line-segment,a point or an empty region.注意相交后的区域,有可能是一个直线、射线、线段或者点,当然也可能是空集。,line,ray,line-segment,point,empty set,9/14/2023,Zeyuan Zhu,14,2.Convex Polygon Intersection CPI凸多边形交预备知识,9/14/2023,Zeyuan Zhu,15,2.Convex Polygon Intersection,Intersecting two convex polygons A and B into a single one.We will sketch out an efficient way,named plane sweep method.,求两个凸多边形A和B的交(一个新凸多边形)。我们描绘一个平面扫描法。,Polygon A,Polygon B,9/14/2023,Zeyuan Zhu,16,2.Convex Polygon Intersection,Main idea:Regard intersections of edges as cutting points,and break boundaries of A and B,into outer edges and inner edges.Segments of inner edges establish ties to each other,and form a polygon.(in bold),主要思想:以两凸边形边的交点为分界点,将边分为内、外两种。内边互相连接,成为所求多边形(图中粗线条),Polygon A,Polygon B,9/14/2023,Zeyuan Zhu,17,2.Convex Polygon Intersection,Suppose there is a vertical sweep line,performing left-to-right sweep.At anytime,there are at most four intersections from sweep line to either given polygon.,假设有一个垂直的扫描线,从左向右扫描任何时刻,扫描线和两个多边形最多4个交点,Polygon A,Polygon B,Bu,Au,Bl,Al,Sweep line,9/14/2023,Zeyuan Zhu,18,2.Convex Polygon Intersection,the lower one between Au and Bu,and the upper one between Al and Bl,form an interval of the current inner region the red segment in bold.,Au、Bu中靠下的,和Al、Bl中靠上的,组成了当前多边形的内部区域,Polygon A,Polygon B,Bu,Au,Bl,Al,Sweep line,9/14/2023,Zeyuan Zhu,19,2.Convex Polygon Intersection,Let us call the x-coordinates to be swept x-events.Obviously,the sweep line may not go through all the x-event with rational coordinates!,我们称被扫描线扫描到的x坐标叫做x事件。当然,我们不能扫描所有有理数!,Bu,Au,Bl,Al,9/14/2023,Zeyuan Zhu,20,2.Convex Polygon Intersection,Call the edges where Au,Al,Bu and Bl are:e1,e2,e3 and e4 respectively.Next x-event should be chosen among four endpoints of e1,e2,e3 and e4,and four potential intersections:e1e3,e1e4,e2e3 and e2e4.,称Au,Al,Bu,Bl所在的边叫做e1,e2,e3,e4下一个x事件将在这四条边的端点,以及两两交点中选出,Bu,Au,Bl,Al,O(n),9/14/2023,Zeyuan Zhu,21,3.Common solution:Divide-and-Conquer Algorithm D&C通常的分治解法,9/14/2023,Zeyuan Zhu,22,3.Divide-and-Conquer Algorithm,Divide:Partition the n h-planes into two sets of size n/2.Conquer:Compute feasible region recursively of both two subsets.Combine:Compute intersection of two convex region,by CPI2分:将n个半平面分成两个n/2的集合.治:对两子集合递归求解半平面交.合:将前一步算出来的两个交(凸多边形)利用第2章的CPI求解.,9/14/2023,Zeyuan Zhu,23,3.Divide-and-Conquer Algorithm,The total time complexity of the solution can be calculated via recursive equation.总时间复杂度可以用递归分析法.,9/14/2023,Zeyuan Zhu,24,4.My New Solution:Sort-and-Incremental Algorithm S&I我自创的排序增量算法,9/14/2023,Zeyuan Zhu,25,4.Sort-and-Incremental Algorithm,Definition of h-planes polar angle:for h-plane like x-yconstant,we define its polar angle to.半平面的极角定义:比如x-y常数的半平面,定义它的极角为.,9/14/2023,Zeyuan Zhu,26,4.Sort-and-Incremental Algorithm,Step 1:Separate the h-planes into two sets.One has polar angles of(-,the other has those of(-,-(,.Step 1:将半平面分成两部分,一部分极角范围(-,,另一部分范围(-,-(,9/14/2023,Zeyuan Zhu,27,4.Sort-and-Incremental Algorithm,考虑(-,的半平面(另一个集合类似地做Step3/4),将他们极角排序。对极角相同的半平面,根据常数项保留其中之一。,Step 2:Consider the set of h-planes in(-,(the other set should also go through step 3 and 4 similarly).Sort them by the polar angle.For the h-planes with the same polar angle,we can keep only one down(delete all others)according to the constant of these h-planes,9/14/2023,Zeyuan Zhu,28,4.Sort-and-Incremental Algorithm,从排序后极角最小两个半平面开始,求出它们的交点并且将他们押入栈。,Step 3:Starting from two h-planes with the least polar angle,compute their intersection.Push them two into a stack.,9/14/2023,Zeyuan Zhu,29,4.Sort-and-Incremental Algorithm,每次按照极角从小到大顺序增加一个半平面,算出它与栈顶半平面的交点。,Step 3:Each time,add one more h-plane by increasing order of polar angles,and calculate the intersection of it and the top h-plane in stack.,9/14/2023,Zeyuan Zhu,30,4.Sort-and-Incremental Algorithm,如果当前的交点在栈顶两个半平面交点的右边,出栈(pop)。,Step 3:If this intersection is to the right of the intersection of top two h-planes in stack,we pop the stack once.,9/14/2023,Zeyuan Zhu,31,4.Sort-and-Incremental Algorithm,Step 3:,9/14/2023,Zeyuan Zhu,32,4.Sort-and-Incremental Algorithm,前问我们说到出栈,出栈只需要一次么?Nie!我们要继续交点检查,如果还在右边我们要继续出栈,直到当前交点在栈顶交点的左边。,Step 3:we pop the stack once.Once?Is it enough?Nie!Do this repeatedly until it is to the left of the top intersection.,9/14/2023,Zeyuan Zhu,33,4.Sort-and-Incremental Algorithm,相邻半平面的交点组成半个凸多边形。我们有两个点集,(-,给出上半个,(-,-(,给出下半个,Step 4:Intersections of adjacent h-plane pairs in stack form half a convex polygon.For the two sets,we have two halves(-,gives an upper hull and(-,-(,gives a lower hull.,9/14/2023,Zeyuan Zhu,34,4.Sort-and-Incremental Algorithm,相邻半平面的交点组成半个凸多边形。我们有两个点集,(-,给出上半个,(-,-(,给出下半个,Step 4:Intersections of adjacent h-plane pairs in stack form half a convex polygon.For the two sets,we have two halves(-,gives an upper hull and(-,-(,gives a lower hull.,upper hull上壳,lower hull下壳,9/14/2023,Zeyuan Zhu,35,4.Sort-and-Incremental Algorithm,初始时候,四个指针p1,p2,p3 and p4 指向上/下凸壳的最左最右边p1,p3向右走,p2,p4向左走,Step 4:At the beginning,four pointers p1,p2,p3 and p4 indicate leftmost/rightmost edges of both upper and lower hulls.p1 and p3 move rightwards,while p2 and p4 walks leftwards.,p3,p4,p1,p2,upper hull上壳,lower hull下壳,9/14/2023,Zeyuan Zhu,36,4.Sort-and-Incremental Algorithm,任意时刻,如果最左边的交点不满足p1/p3所在半平面的限制,我们相信这个交点需要删除p1或p3走向它右边的相邻边,Step 4:At anytime,if the leftmost intersection is against the feasible region provided by p1 or p3,we are sure the leftmost one is to be removed.Naturally,p1 or p3 walks rightwards to its adjacent edge.,p3,p4,p1,p2,9/14/2023,Zeyuan Zhu,37,4.Sort-and-Incremental Algorithm,类似地我们处理最右边的交点,Step 4:The judgment holds analogously for rightmost intersection with p2 and p4.,p3,p2,p1,p4,9/14/2023,Zeyuan Zhu,38,4.Sort-and-Incremental Algorithm,类似地我们处理最右边的交点,Step 4:The judgment holds analogously for rightmost intersection with p2 and p4.,p3,p4,p2,p1,9/14/2023,Zeyuan Zhu,39,4.Sort-and-Incremental Algorithm,重复运作直到不再有更新出现迭代,Step 4:Do the above removing repeatedly until there is no more update.,p3,p4,p2,p1,9/14/2023,Zeyuan Zhu,40,4.Sort-and-Incremental Algorithm,Everything except sorting(Step 2)in S&I algorithm remain linear O(n)running time.Usually we use quick-sort.The total complexity is O(nlogn),with fairly small constant factor hidden.除了Step2中的排序以外,S&I算法的每一步都是线性的。通常我们用快速排序实现Step2,总的时间复杂度为O(nlogn),隐蔽其中的常数因子很小,9/14/2023,Zeyuan Zhu,41,5.Conclusion and Practical Use总结和实际应用,9/14/2023,Zeyuan Zhu,42,5.Conclusion and Practical Use,Great ideas need landing gear as well as wings.S&I algorithm seems to work in the same time complexity as D&C algorithm,but some overwhelming advantages of implementing S&I holds.Great ideas need landing gear as well as wings.S&I算法似乎和D&C算法时间复杂度相同,但是它有着压倒性(overwhelming)的优势。,9/14/2023,Zeyuan Zhu,43,5.Conclusion and Practical Use,It is much easier to code S&I program than D&C one.The program in C+programming language takes less than 3KB.新的S&I算法代码容易编写,相对于D&C大大简单化,C+程序语言实现S&I算法仅需3KB不到.,9/14/2023,Zeyuan Zhu,44,5.Conclusion and Practical Use,The coefficient hidden under S&I algorithms complexity is extraordinarily smaller than D&C,since we no longer need O(nlogn)number of intersection calculates.In general speaking,S&I program runs approx five times faster than D&C one.S&I算法复杂度中的系数,远小于D&C,因为我们不再需要O(nlogn)次交点运算.通常意义上来讲,S&I程序比D&C快五倍。,9/14/2023,Zeyuan Zhu,45,5.Conclusion and Practical Use,If the given h-planes are all in(-,(or any span of),S&I program can be shorten remarkably(to approximately twenty lines in C+),but D&C program may not.An informatics problem appeared in USA Invitational Computing Olympiad contest with such purpose.如果给定半平面均在(-,(或任意一个跨度为的区间),S&I算法可被显著缩短,C+程序只需要约二十行。USAICO比赛中就出现了这样一题。,9/14/2023,Zeyuan Zhu,46,5.Conclusion and Practical Use,The bottleneck of this algorithm is sorting.Pay attention the sorting is NOT a comparison sort(sorting based on comparison)!Since then,we can replace the O(nlogn)quick-sort to O(n)radix-sort to decrease the asymptotical time complexity to O(n).本算法瓶颈是排序,这里的排序不是比较排序,因此可以将快速排序替换成基数排序,降低程序渐进时间复杂度到线性。Anyway O(n)approach usually runs slower than nlogn ones for its additional memory usage!,9/14/2023,Zeyuan Zhu,47,5.Conclusion and Practical Use,诺贝尔奖得主John Nash原创的理论original idea创新与信息学竞赛创新与技术我心目中的创新最重要的是思想创新,其次是行为创新,再其次是文章创新,再再其次才是语言创新思想实践,The principal mark of genius is not perfection but originality,the opening of new frontiers.Authur Koestler(1905-1983)Hungarian-born British writer and jounalist.,9/14/2023,Zeyuan Zhu,48,5.Conclusion and Practical Use,创新如高山山,快马加鞭未下鞍。惊回首,离天三尺三。山,倒海翻江卷巨澜。奔腾急,万马战犹酣。山,刺破青天锷未残。天欲堕,赖以拄其间。,怅寥廓,问苍茫大地,谁主沉浮。,俱往矣,数风流人物,还看今朝。,

    注意事项

    本文(算法合集之《半平面交的新算法及其实用价值》.ppt)为本站会员(小飞机)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开