Algorithm Chapter 5
数字信号处理第一章可就PDF版本

Lab 4 Digital Processing of Continuous-Time Signals (连续时间信号的数字处理)
Lab 5 Digital Filter Design (数字滤波器设计) Lab 6 Digital Filter Implementation (数字滤波器
r (x,y) u (x,y) = g (x,y)
b (x,y)
r (x,y)
g (x,y)
b (x,y)
重点: 1-D信号的分类
问题1:离散时间信号就是数字信号,对吗? 问题2:采(抽)样信号是不是数字信号?若不
是,二者有何区别?
2
analog signal (模拟信号)
quantized boxcar signal (量化阶梯信号)
¾ 数字信号处理 —— 基于计算机的方法 (第3版). Sanjit K. Mitra 著, 阔永 红 改编. 电子工业出版社. 2006,3.
¾ 数字信号处理实验指导书 (MATLAB版). Sanjit K. Mitra 著,孙洪等译. 电子工业出版社. 2005, 1.
References
Exercises and Behavior (作业和平时): 10% Mid-term Exam (期中): 30% Final Exam (期末): 60%
Architecture of the course (课程体系)
信
离散时间信号的时域分析
号 分
离散时间傅里叶变换 (DTFT)
析
矩阵论课程简介

课程名称(中文):矩阵论课程名称(英文):Matrix Theory一)课程目的和任务:本课程是泛应用数学包括计算数学、运筹与控制特别是组合与图论、应用数学等专业的一门共同的基础课,主要讲授矩阵的分析性质和组合性质。
课程的目的和任务是让学生掌握矩阵论的基本知识和思想方法、了解该领域的某些最新成果、通过利用数学其他分支的工具来解决矩阵问题以及用矩阵解决其他领域的问题加深对数学的认识并且增加数学修养。
教材内容强调以下几方面的标准:1)重要,2)优雅,3)巧妙,4)有趣。
矩阵论在科学与工程计算、控制论、系统论、信息论、信号处理、计算机科学、经济学、组合与图论、运筹学、统计学、概率论、微分方程、数学物理、动力系统等领域都有应用。
矩阵论一方面是有用的工具,另一方面也是目前一个活跃的研究领域。
二)预备知识:线性代数,数学分析三)教材及参考书目:教材:Matrix Theory by X. Zhan, 讲义,已投稿到出版社参考书目:1)《矩阵论》,詹兴致著,高等教育出版社,2008年2)Matrix Analysis, R. Bhatia著, GTM 169, Springer, New York, 1997四)讲授大纲(中英文)第一章预备知识1)特殊矩阵类2)特征多项式3)谱映射定理4)特征值和对角元5)范数6)矩阵乘方序列的收敛性7)矩阵分解8)数值范围9)多项式的伙伴矩阵10)广义逆11)Schur补12)拓扑思想的应用13)Grobner基14)线性不等式组15)正交投影和约化子空间第二章张量积和复合矩阵1)定义和基本性质2)线性矩阵方程3)Frobenius-Konig定理4)复合矩阵第三章 Hermite矩阵和优超1)Hermite矩阵的特征值2)优超与双随机矩阵3)关于半正定矩阵的不等式第四章奇异值和酉不变范数1)奇异值2)对称规度函数3)酉不变范数4)矩阵的笛卡尔分解第五章矩阵扰动1)特征值2)极分解3)带状部分的范数估计第六章非负矩阵1)Perron-Frobenius理论2)矩阵与有向图3)本原和非本原矩阵4)特殊的非负矩阵5)关于正矩阵的两个定理第七章部分矩阵的填充1)Friedland关于对角填充的定理2)Farahat-Ledermann关于边线填充的定理3)Parrott保范填充定理4)正定填充第八章符号模式1)符号非奇异模式2)特征值3)符号半稳定模式4)允许正逆的模式第九章更多的论题1)实矩阵通过复矩阵相似2)带状矩阵的逆3)交换子的范数界4)对角占优定理的逆定理5)数值范围的形状6)一个求逆算法7)相似标准形8)Jordan标准形的极端稀疏性第十章矩阵的应用1)图论2)有限几何3)数论4)代数5)多项式Chapter 1 Preliminaries1) Classes of Special Matrices2) The Characteristic Polynomial3) The Spectral Mapping Theorem4) Eigenvalues and Diagonal Entries5) Norms6) Convergence of the Power Sequence of a Matrix7) Matrix Decompositions8) Numerical Range9) The Companion Matrix of a Polynomial10) Generalized Inverses11) Schur Complements12) Applications of Topological Ideas13) Grobner Bases14) Systems of Linear Inequalities15) Orthogonal Projections and Reducing Subspaces Chapter 2 Tensor Products and Compound Matrices1) Definitions and Basic Properties2) Linear Matrix Equations3) Frobenius-Konig Theorem4) Compound MatricesChapter 3 Hermitian Matrices and Majorization1) Eigenvalues of Hermitian Matrices2) Majorization and Doubly Stochastic Matrices3) Inequalities for Positive Semidefinite MatricesChapter 4 Singular Values and Unitarily Invariant Norms1) Singular Values2) Symmetric Gauge Functions3) Unitarily Invariant Norms4) The Cartesian Decomposition of MatricesChapter 5 Perturbation of Matrices1) Eigenvalues2) The Polar Decomposition3) Norm Estimation of Band PartsChapter 6 Nonnegative Matrices1) Perron-Frobenius Theory2) Matrices and Digraphs3) Primitive and Imprimitive Matrices4) Special Classes of Nonnegative Matrices5) Two Theorems about Positive MatricesChapter 7 Completion of Partial Matrices1)Friedland’s Theorem about Diagonal Completions2)Farahat-Ledermann’s Theorem about Borderline Completions3)Parrott’s Theorem about Norm-Preserving Completions4)Positive Definite CompletionsChapter 8 Sign Patterns1)Sign-Nonsingular Patterns2)Eigenvalues3)Sign Semi-Stable Patterns4)Sign patterns Allowing a Positive Inverse Chapter 9 Miscellaneous Topics1)Similarity of Real Matrices via Complex Matrices2)Inverses of Band Matrices3)Norm Bounds for Commutators4)The Converse of the Diagonal Dominance Theorem5)The Shape of the Numerical Range6)An Inversion Algorithm7)Canonical Forms for Similarity8)Extremal Sparsity of the Jordan Canonical Form Chapter 10 Applications of Matrices1) Graph Theory2) Finite Geometry3) Number Theory4) Algebra5) Polynomials五)教学总学时:4学时/周×19周= 76学时。
第5讲-DW-query

2013-5-6
HD-ITR
6
5.1 Range query processing
Cost models for range query processing methods
CqCu (Ho C.T., 1997) Cqnq+Cunu (Weifa Liang, 2000) Where, Cq is Range query cost Cu is Update cost nq is the number of range queries nu is the number of updates
2013-5-6
HD-ITR
15
5.2.1 单查询的优化处理
• The following query against the TPC-D database computes total yearly sales by supplier nation.
2013-5-6
HD-ITR
165.2.Leabharlann 单查询的优化处理HD-ITR
2013-5-6
21
5.2.1 单查询的优化处理
• Problems
– However, complete pre-aggregation may be expensive if the number of groups is large.
• hash-based aggregation
Query 1a
S_nationkey, yy
S_suppkey=l_suppkey
supplier
lineitem
2013-5-6
HD-ITR
17
5.2.1 单查询的优化处理
操作系统第九版部分课后作业习题答案分析解析

CHAPTER 9 Virtual Memory Practice Exercises9.1 Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs.Answer:A page fault occurs when an access to a page that has not beenbrought into main memory takes place. The operating system veri?esthe memory access, aborting the program if it is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the process table and page table are updated and the instruction is restarted.9.2 Assume that you have a page-reference string for a process with m frames (initially all empty). The page-reference string has length p;n distinct page numbers occur in it. Answer these questions for anypage-replacement algorithms:a. What is a lower bound on the number of page faults?b. What is an upper bound on the number of page faults?Answer:a. nb. p9.3 Consider the page table shown in Figure 9.30 for a system with 12-bit virtual and physical addresses and with 256-byte pages. The list of freepage frames is D, E, F (that is, D is at the head of the list, E is second,and F is last).Convert the following virtual addresses to their equivalent physicaladdresses in hexadecimal. All numbers are given in hexadecimal. (Adash for a page frame indicates that the page is not in memory.)? 9EF? 1112930 Chapter 9 Virtual Memory? 700? 0FFAnswer:? 9E F - 0E F? 111 - 211? 700 - D00? 0F F - EFF9.4 Consider the following page-replacement algorithms. Rank thesealgorithms on a ?ve-point scale from “bad” to “perfect” according to the page-fault rate. Separate those algorithms that suffer from Belady’sanomaly from those that do not.a. LRU replacementb. FIFO replacementc. Optimal replacementd. Second-chance replacementAnswer:Rank Algorithm Suffer from Belady’s anomaly1 Optimal no2 LRU no3 Second-chance yes4 FIFO yes9.5 Discuss the hardware support required to support demand paging. Answer:For every memory-access operation, the page table needs to be consulted to check whether the corresponding page is resident or not and whetherthe program has read or write privileges for accessing the page. These checks have to be performed in hardware. A TLB could serve as a cache and improve the performance of the lookup operation.9.6 An operating system supports a paged virtual memory, using a central processor with a cycle time of 1 microsecond. It costs an additional 1 microsecond to access a page other than the current one. Pages have 1000 words, and the paging device is a drum that rotates at 3000 revolutionsper minute and transfers 1 million words per second. The following statistical measurements were obtained from the system:page other than the? 1 percent of all instructions executed accessed acurrent page.?Of the instructions that accessed another page, 80 percent accesseda page already in memory.Practice Exercises 31?When a new page was required, the replaced page was modi?ed 50 percent of the time.Calculate the effective instruction time on this system, assuming that the system is running one process only and that the processor is idle during drum transfers.Answer:(2 sec)(1sec + 0.008 ×effective access time = 0.99 ×(10,000 sec + 1,000 sec)+ 0.002 ×(10,000 sec + 1,000 sec)+ 0.001 ×9.7 Consider the two-dimensional array A:int A[][] = new int[100][100];where A[0][0] is at location 200 in a paged memory system with pages of size 200. A small process that manipulates the matrix resides in page 0 (locations 0 to 199). Thus, every instruction fetch will be from page 0. For three page frames, how many page faults are generated bythe following array-initialization loops, using LRU replacement andassuming that page frame 1 contains the process and the other two are initially empty?a. for (int j = 0; j < 100; j++)for (int i = 0; i < 100; i++)A[i][j] = 0;b. for (int i = 0; i < 100; i++)for (int j = 0; j < 100; j++)A[i][j] = 0;Answer:a. 5,000b. 509.8 Consider the following page reference string:1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, ?ve, six, or seven frames? Remember all frames are initially empty, so your ?rst unique pages will all cost one fault each.?LRU replacement? FIFO replacement?Optimal replacement32 Chapter 9 Virtual MemoryAnswer:Number of frames LRU FIFO Optimal1 20 20 202 18 18 153 15 16 114 10 14 85 8 10 76 7 10 77 77 79.9 Suppose that you want to use a paging algorithm that requires a referencebit (such as second-chance replacement or working-set model), butthe hardware does not provide one. Sketch how you could simulate a reference bit even if one were not provided by the hardware, or explain why it is not possible to do so. If it is possible, calculate what the cost would be.Answer:You can use the valid/invalid bit supported in hardware to simulate the reference bit. Initially set the bit to invalid. On ?rst reference a trap to the operating system is generated. The operating system will set a software bit to 1 and reset the valid/invalid bit to valid.9.10 You have devised a new page-replacement algorithm that you thinkmaybe optimal. In some contorte d test cases, Belady’s anomaly occurs. Is thenew algorithm optimal? Explain your answer.Answer:No. An optimal algorithm will not suffer from Belady’s anomaly beca an optimal algorithm replaces the page that will not—by de?nition—be used for the longest time. Belady’s anomaly occurs when a pagereplacement a lgorithm evicts a page that will be needed in theimmediatefuture. An optimal algorithm would not have selected such a page.9.11 Segmentation is similar to paging but usesnevariable-sized“pages.”De?two segment-replacement algorithms based on FIFO and LRU pagereplacement s chemes. Remember that since segments are not thesamesize, the segment that is chosen to be replaced may not be big enoughto leave enough consecutive locations for the needed segment. Considerstrategies for systems where segments cannot be relocated, and thosefor systems where they can.Answer:a. FIFO. Find the ?rst segment large enough to accommodate theincoming segment. If relocation is not possible and no one segmentis large enough, select a combination of segments whose memoriesare contiguous, which are “closest to the ?rst of the list” and which can accommodate the new segment. If relocation is possible,rearrange the memory so that the ?rstNsegments large enough forthe incoming segment are contiguous in memory. Add any leftoverspace to the free-space list in both cases.Practice Exercises 33b. LRU. Select the segment that has not been used for the longestperiod of time and that is large enough, adding any leftover spaceto the free space list. If no one segment is large enough, selecta combination of the “oldest” segments that are contiguous inmemory (if relocation is not available) and that are large enough.If relocation is available, rearrange the oldest N segments to becontiguous in memory and replace those with the new segment.9.12 Consider a demand-paged computer system where the degree of multiprogramming is currently ?xed at four. The system was recentlymeasured to determine utilization of CPU and the paging disk. The resultsare one of the following alternatives. For each case, what is happening?Can the degree of multiprogramming be increased to increase the CPU utilization? Is the paging helping?a. CPU utilization 13 percent; disk utilization 97 percentb. CPU utilization 87 percent; disk utilization 3 percentc. CPU utilization 13 percent; disk utilization 3 percentAnswer:a. Thrashing is occurring.b. CPU utilization is suf?ciently high to leave things alone, andincrease degree of multiprogramming.c. Increase the degree of multiprogramming.9.13 We have an operating system for a machine that uses base and limit registers, but we have modi?ed the ma chine to provide a page table.Can the page tables be set up to simulate base and limit registers? How can they be, or why can they not be?Answer:The page table can be set up to simulate base and limit registers provided that the memory is allocated in ?xed-size segments. In this way, the base of a segment can be entered into the page table and the valid/invalid bit used to indicate that portion of the segment as resident in the memory. There will be some problem with internal fragmentation.9.27.Consider a demand-paging system with the following time-measured utilizations:CPU utilization 20%Paging disk 97.7%Other I/O devices 5%Which (if any) of the following will (probably) improve CPU utilization? Explain your answer.a. Install a faster CPU.b. Install a bigger paging disk.c. Increase the degree of multiprogramming.d. Decrease the degree of multiprogramming.e. Install more main memory.f. Install a faster hard disk or multiple controllers with multiple hard disks.g. Add prepaging to the page fetch algorithms.h. Increase the page size.Answer: The system obviously is spending most of its time paging, indicating over-allocationof memory. If the level of multiprogramming is reduced resident processeswould page fault less frequently and the CPU utilization would improve. Another way toimprove performance would be to get more physical memory or a faster paging drum.a. Get a faster CPU—No.b. Get a bigger paging drum—No.c. Increase the degree of multiprogramming—No.d. Decrease the degree of multiprogramming—Yes.e. Install more main memory—Likely to improve CPU utilization as more pages canremain resident and not require paging to or from the disks.f. Install a faster hard disk, or multiple controllers with multiple hard disks—Also animprovement, for as the disk bottleneck is removed by faster response and morethroughput to the disks, the CPU will get more data more quickly.g. Add prepaging to the page fetch algorithms—Again, the CPU will get more datafaster, so it will be more in use. This is only the case if the paging actionis amenableto prefetching (i.e., some of the access is sequential).h. Increase the page size—Increasing the page size will result in fewer page faults ifdata is being accessed sequentially. If data access is more or less random, morepaging action could ensue because f ewer pages c an be kept in memory and moredata is transferred per page fault. So this change is as likely to decrease utilizationas it is to increase it.10.1、Is disk scheduling, other than FCFS scheduling, useful in a single-userenvironment? Explain your answer.Answer: In a single-user environment, the I/O queue usually is empty. Requests g enerally arrive from a single process for one block or for a sequence of consecutive blocks. In these cases, FCFS is an economical method of disk scheduling. But LOOK is nearly as easy to program and will give much better performance when multiple processes are performing concurrent I/O, such as when aWeb browser retrieves data in the background while the operating system is paging and another application is active in the foreground.10.2.Explain why SSTF scheduling tends to favor middle cylindersover theinnermost and outermost cylinders.The center of the disk is the location having the smallest average distance to all other tracks.Thus the disk head tends to move away from the edges of the disk.Here is another way to think of it.The current location of the head divides the cylinders into two groups.If the head is not in the center of the disk and a new request arrives,the new request is more likely to be in the group that includes the center of the disk;thus,the head is more likely to move in that direction.10.11、Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143, and the previous request was at cylinder 125. The queue of pending requests, in FIFO order, is86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests, for each of the following disk-scheduling algorithms?a. FCFSb. SSTFc. SCANd. LOOKe. C-SCANAnswer:a. The FCFS schedule is 143, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130. The total seek distance is 7081.b. The SSTF schedule is 143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774. The total seek distance is 1745.c. The SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86. The total seek distance is 9769.d. The LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86. The total seek distance is 3319.e. The C-SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 86, 130. The total seek distance is 9813.f. (Bonus.) The C-LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 86, 130. The total seek distance is 3363.12CHAPTERFile-SystemImplementationPractice Exercises12.1 Consider a ?le currently consisting of 100 blocks. Assume that the?lecontrol block (and the index block, in the case of indexed allocation)is already in memory. Calculate how many disk I/O operations are required for contiguous, linked, and indexed (single-level) allocation strategies, if, for one block, the following conditions hold. In the contiguous-allocation case, assume that there is no room to grow atthe beginning but there is room to grow at the end. Also assume thatthe block information to be added is stored in memory.a. The block is added at the beginning.b. The block is added in the middle.c. The block is added at the end.d. The block is removed from the beginning.e. The block is removed from the middle.f. The block is removed from the end.Answer:The results are:Contiguous Linked Indexeda. 201 1 1b. 101 52 1c. 1 3 1d. 198 1 0e. 98 52 0f. 0 100 012.2 What problems could occur if a system allowed a ?le system to be mounted simultaneously at more than one location?Answer:4344 Chapter 12 File-System ImplementationThere would be multiple paths to the same ?le, which could confuse users or encourage mistakes (deleting a ?le with one path deletes the?le in all the other paths).12.3 Why must the bit map for ?le allocation be kept on mass storage, ratherthan in main memory?Answer:In case of system crash (memory failure) the free-space list would not be lost as it would be if the bit map had been stored in main memory.12.4 Consider a system that supports the strategies of contiguous, linked, and indexed allocation. What criteria should be used in deciding which strategy is best utilized for a particular ?le?Answer:?Contiguous—if ?le is usually accessed sequentially, if ?le isrelatively small.?Linked—if ?le is large and usually accessed sequentially.? Indexed—if ?le is large and usually accessed randomly.12.5 One problem with contiguous allocation is that the user must preallocate enough space for each ?le. If the ?le grows to be larger than thespace allocated for it, special actions must be taken. One solution to this problem is to de?ne a ?le structure consisting of an initial contiguousarea (of a speci?ed size). If this area is ?lled, the operating system automatically de?nes an over?ow area that is linked to the initial contiguous area. If the over?ow area is ?lled, another over?ow areais allocated. Compare this implementation of a ?le with the standard contiguous and linked implementations.Answer:This method requires more overhead then the standard contiguousallocation. It requires less overheadthan the standard linked allocation.12.6 How do caches help improve performance? Why do systems not use more or larger caches if they are so useful?Answer:Caches allow components of differing speeds to communicate moreef?ciently by storing data from the slower device, temporarily, ina faster device (the cache). Caches are, almost by de?nition, moreexpensive than the device they are caching for, so increasing the numberor size of caches would increase system cost.12.7 Why is it advantageous for the user for an operating system to dynamically allocate its internal tables? What are the penalties to the operating system for doing so?Answer:tablesDynamic tables allow more ?exibility in system use growth —are never exceeded, avoiding arti?cial use limits. Unfortunately, kernel structures and code are more complicated, so there is more potentialfor bugs. The use of one resource can take away more system resources (by growing to accommodate the requests) than with static tables.Practice Exercises 4512.8 Explain how the VFS layer allows an operating system to support multiple types of ?le systems easily.Answer:VFS introduces a layer of indirection in the ?le system implementation. In many ways, it is similar to object-oriented programming techniques. System calls can be made generically (independent of ?le system type). Each ?le system type provides its function calls and data structuresto the VFS layer. A system call is translated into the proper speci?c functions for the target ?le system at the VFS layer. The calling program has no ?le-system-speci?c code, and the upper levels of the system call structures likewise are ?le system-independent. The translation at the VFS layer turns these generic calls into ?le-system-speci?c operations.。
计算机英语学生用书(第二版)习题答案chapter 05.

II. True or False III.Answering Questions IV. Translating Terms
Vocabulary
V. Selecting Words
Collocation Summary
• First generation—— machine language • Second generation—— assembly language • Third generation—— high-level languages • Fourth generation—— very-high-level
5. T
IIV. Exercises—Comprehension
III. Answer the following question.
1. List the five steps of programming.
1. Programming is traditionally a five-step problem-solving process. The five steps are as follows: The first step: Problem definition The second step: Program design The third step: Program coding The fourth step: Program testing The fifth step: Program documentation and maintenance
languages • Fifth generation—— natural languages
通信抗干扰

摘要航空通信是一种容易受到干扰的通信体制,因此必须研究有效并且可行的抗干扰方法防止干扰。
随着通信技术和电子对抗技术的开展,数据对通信质量提出了更高的要求,一种被称为自适应跳频的技术被应用到扩频通信中。
它是建立在自动信道质量分析根底上的一种技术,该技术能使跳频通信过程自动避开被干扰的跳频频率点,并以最小的发射功率,最低的被截获率,到达在无扰信道上长时间保持优质通信。
本文介绍了基十自适应跳频技术的航空通信系统的设计与实现。
重点研究了自适应跳频技术的信道质量估计、衰落估计和自适应控制。
本文首先介绍了航空通信抗干扰技术,总结了抗干扰技术的现状和开展趋势。
在此根底上,研究了扩频通信抗干扰的原理和技术。
第二章论述了扩频通信的原理和特点,总结了扩频通信中几种扩频方式的简要原理。
在此根底上,研究了跳频和自适应跳频的抗干扰的原理和特点。
第二章给出了基于自适应跳频技术通信系统的结构和原理,并总结了其中的关键技术,主要包括信道质量估计算法、Viterbi译码及其改进算法、交织和系统同步方法的实现过程。
第四章研究了自适应跳频技术的信道质量估计,衰落估计和自适应控制。
对十改进的自相关矩阵估计算法给出了其在不同采样点,不同调制方式和不同长度下的仿真结果;总结了一种衰落估计算法,仿真证明其效率很高;对自适应控制,将自适应调制和自适应功率控制结合在一起,仿真结果说明这种方法比较有效。
第五章设计了自适应跳频的仿真模型,并与常规跳频进行比较,证明了自适应跳频的优越性。
关键词:航空通信扩频技术信道质量估计自适应跳频自适应控制AbstractThe Aviation communication can be interfered very easily, so the validanti一amming techniques must be studied to resist serious interference. With the development of communication and electronic countermeasure, adaptive frequency-hopping (AFH) is applied in Spread Spectrum communication. AFH adjusts modulation, power control and frequency selection adaptively in accordance withchannel conditions, which can greatly improve the performance of the system. Thedesign and implement of Aviation communication system based on AFH is introducedin detail in the thesis. There are three focuses on the present study: channel estimation, fading estimation and adaptive control.First, the Aviation communication anti一amming techniques are introduced and the present status and the development trends of anti一amming techniques are analyzed.The principle and techniques of the Spread Spectrum communication Aviation aregiven.In chapter 2, Spread Spectrum communication is described and the principles ofsome Spread Spectrum methods are given. On the basis of this, principles and characteristics of FH and AFH of anti一amming are researched on.In chapter 3, the structure and principles of Aviation communication system basedon AFH are given, and the key technology is mainly given. Channel estimation algorithm, Viterbi decode and improved algorithm, interlace and system synchronization method are mainly introduced.In chapter 4, channel estimation, fading estimation and adaptive control in AFHare researched. For self-correlation matrix algorithm, simulation results in different sample points, different modulation methods and different lengths are given respectively. A fading estimation algorithm is summarized and it is proved highefficient. For adaptive control, adaptive modulation and power control are joint and simulation results are given. It is proved more effective.In chapter 5, the AFH simulation model is designed, and the simulation resultsshow that the AFH has a better performance compared with general frequency-hopping.Keywords:aviation Communication Spread Spectrum Channel Estimation Adaptive Frequency-hopping Adaptive Control目录第一章绪论 (1)1.1研究背景 (1)1.2航空通信抗干扰技术研究现状 (2)1.3扩频通信系统 (3)1.4本文的主要研究工作 (4)第二章扩展频谱技术 (5)根底 (5)根底 (5)2.1.2处理增益和干扰容限 (6)2.1.3扩频技术的分类方式 (6)2.1.4扩频通信的特点 (8)2.2跳频系统 (9)根本原理 (9)2.2.2跳频的处理增益和抗干扰性能 (10)2.2.3自适应跳频系统 (11)2.3本章小结 (12)第三章自适应跳频航空通信系统 (13)3.1自适应跳频通信系统 (13)3.1.1自适应跳频通信原理 (13)3.1.2自适应跳频通信过程 (14)3.2自适应跳频系统的关键技术 (14)3.2.1信道质量评估 (15)3.2.2信道编译码技术 (16)3.2.2.1卷积编码 (17)3.2.2.2 Viterbi译码 (17)3.2.2.3交织 (18)3.2.3 TOD构造 (19)3.3本章小结 (20)第四章信道质量评估和自适应控制研究 (23)4.1基十自相关矩阵的信道估计 (23)4.1.1系统模型 (24)4.1.2信噪比求解 (25)确实定 (26)4.1.4对MDL的补充 (28)4.1.5算法流程 (30)4.1.6仿真分析 (31)4.2衰落估计 (34)4.2.1衰落信道模型 (35)4.2.2衰落估计算法 (35)4.2.3仿真分析 (36)4.3自适应控制 (37)4.3.1自适应调制和自适应控制 (38)4.3.2仿真分析 (39)4.4本章小结 (41)第五章自适应跳频系统仿真 (43)5.1 Simulink简介 (43)5.1.1系统仿真软件的选择 (43)5.1.2 Simulink仿真的工作原理 (44)5.2自适应跳频通信系统仿真 (45)5.2.1自适应跳频通信系统仿真的模型 (45)5.2.2仿真分析 (47)5.3本章小结 (49)结束语 (50)致谢 (51)参考文献 (52)研究成果 (54)第一章绪论近几年来,我国无线寻呼业务开展十分迅速,适应了国民经济的开展,满足了广阔群众对信息传送的需求。
AMRWB语音端点检测功能分析研究及定点C代码仿真
(3) 用 C 代码在 PC 机上设计实现了 AMR-WB 定点仿真环境 该 仿真环境为研究验证相关算法(特别是 VAD 算法)的可行性和 有效性提供了有效的实验平台
本文由五部分组成 第一章前言 对当前使用的语音编解码器 的概念 发展状况及存在的问题进行了阐述 第二章对介绍 第三章对 AMR-WB 宽带语音编解码器的语音端点检测算法 VAD 及其具体实现方法进行 了详细分析 提出了改进方法并对改进后的 VAD 方法进行了实验验 证 第四章对 AMR-WB 宽带语音编解码器仿真系统设计进行了阐 述 包括系统模型 各模块分析以及算法设计 并且对实测数据进 行了详细分析 第五章为总结和展望
宽带语音编解码器的自然度在高保真电话 扩展的通讯业务如声音会议 电视广播中是一个重要的特征 以下简要介绍几种宽带语音的应用领域
(1) 3G 移动通讯系统 提供多媒体服务是 3G 无线通讯系统的一个主要功能 这也意味着在多媒 体部分要使用高质量的声音和语音 即使在说话声音的电话应用中 宽带语音 也是无线服务提供商可以提供比传统公共交换电话网(PSTN)更高语音质量的重
关键词 AMR-WB 语音编解码器 ACELP 端点检测 鲁棒性
MECHANISM STUDY OF VOICE ACTIVITY DETECTOR (VAD) AND C SIMULATION OF AMR-WB CODEC
ABSTRACT
At present in mobile communication system AMR-WB (Adaptive Multi-rate Wideband) CODEC makes speech frequency extended to 7kHz and sample frequency extended to 16kHz, greatly breakthroughs the restriction of the bandwidth than the narrow band CODEC. Therefore, AMR-WB CODEC will ameliorate greatly in many aspects such as speech naturalness and musical processing. This paper expatiates the analysis of the VAD (Voice Activity Detection) algorithm of the AMR-WB CODEC in the noise background condition. Based on this research, author gives a more robust improved VAD algorithm. On the basis, author develops a practical AMR-WB CODEC simulation system according to demands from consigning unit.
算法导论 第三版 第十六章 答案 英
Chapter16Michelle Bodnar,Andrew LohrApril12,2016Exercise16.1-1The given algorithm would just stupidly compute the minimum of the O(n) numbers or return zero depending on the size of S ij.There are a possible number of subproblems that is O(n2)since we are selecting i and j so that1≤i≤j≤n.So,the runtime would be O(n3).Exercise16.1-2This becomes exactly the same as the original problem if we imagine time running in reverse,so it produces an optimal solution for essentially the same reasons.It is greedy because we make the best looking choice at each step.Exercise16.1-3As a counterexample to the optimality of greedily selecting the shortest, suppose our activity times are{(1,9),(8,11),(10,20)}then,picking the shortestfirst,we have to eliminate the other two,where if we picked the other two instead,we would have two tasks not one.As a counterexample to the optimality of greedily selecting the task that conflicts with the fewest remaining activities,suppose the activity times are {(−1,1),(2,5),(0,3),(0,3),(0,3),(4,7),(6,9),(8,11),(8,11),(8,11),(10,12)}.Then, by this greedy strategy,we wouldfirst pick(4,7)since it only has a two con-flicts.However,doing so would mean that we would not be able to pick the only optimal solution of(−1,1),(2,5),(6,9),(10,12).As a counterexample to the optimality of greedily selecting the earliest start times,suppose our activity times are{(1,10),(2,3),(4,5)}.If we pick the ear-liest start time,we will only have a single activity,(1,10),whereas the optimal solution would be to pick the two other activities.Exercise16.1-4Maintain a set of free(but already used)lecture halls F and currently busy lecture halls B.Sort the classes by start time.For each new start time which you encounter,remove a lecture hall from F,schedule the class in that room,1and add the lecture hall to B.If F is empty,add a new,unused lecture hall to F.When a classfinishes,remove its lecture hall from B and add it to F. Why this is optimal:Suppose we have just started using the m th lecture hall for thefirst time.This only happens when ever classroom ever used before is in B.But this means that there are m classes occurring simultaneously,so it is necessary to have m distinct lecture halls in use.Exercise16.1-5Run a dynamic programming solution based offof the equation(16.2)where the second case has“1”replaced with“v k”.Since the subproblems are still indexed by a pair of activities,and each calculation requires taking the minimum over some set of size≤|S ij|∈O(n).The total runtime is bounded by O(n3). Exercise16.2-1A optimal solution to the fractional knapsack is one that has the highest total value density.Since we are always adding as much of the highest value density we can,we are going to end up with the highest total value density. Suppose that we had some other solution that used some amount of the lower value density object,we could substitute in some of the higher value density object meaning our original solution coud not of been optimal.Exercise16.2-2Suppose we know that a particular item of weight w is in the solution.Then we must solve the subproblem on n−1items with maximum weight W−w. Thus,to take a bottom-up approach we must solve the0-1knapsack problem for all items and possible weights smaller than W.We’ll build an n+1by W+1table of values where the rows are indexed by item and the columns are indexed by total weight.(Thefirst row and column of the table will be a dummy row).For row i column j,we decide whether or not it would be advantageous to include item i in the knapsack by comparing the total value of of a knapsack including items1through i−1with max weight j,and the total value of including items1through i−1with max weight j−i.weight and also item i.To solve the problem,we simply examine the n,W entry of the table to determine the maximum value we can achieve.To read offthe items we include, start with entry n,W.In general,proceed as follows:if entry i,j equals entry i−1,j,don’t include item i,and examine entry i−1,j next.If entry i,j doesn’t equal entry i−1,j,include item i and examine entry i−1,j−i.weight next. See algorithm below for construction of table:Exercise16.2-3At each step just pick the lightest(and most valuable)item that you can pick.To see this solution is optimal,suppose that there were some item j that we included but some smaller,more valuable item i that we didn’t.Then,we could replace the item j in our knapsack with the item i.it will definitelyfit2Algorithm10-1Knapsack(n,W)1:Initialize an n+1by W+1table K2:for j=1to W do3:K[0,j]=04:end for5:for i=1to n do6:K[i,0]=07:end for8:for i=1to n do9:for j=1to W do10:if j<i.weight then11:K[i,j]=K[i−1,j]12:end if13:K[i,j]=max(K[i−1,j],K[i−1,j−i.weight]+i.value)14:end for15:end forbecause i is lighter,and it will also increase the total value because i is more valuable.Exercise16.2-4The greedy solution solves this problem optimally,where we maximize dis-tance we can cover from a particular point such that there still exists a place to get water before we run out.Thefirst stop is at the furthest point from the starting position which is less than or equal to m miles away.The problem exhibits optimal substructure,since once we have chosen afirst stopping point p,we solve the subproblem assuming we are starting at bining these two plans yields an optimal solution for the usual cut-and-paste reasons.Now we must show that this greedy approach in fact yields afirst stopping point which is contained in some optimal solution.Let O be any optimal solution which has the professor stop at positions o1,o2,...,o k.Let g1denote the furthest stopping point we can reach from the starting point.Then we may replace o1by g2to create a modified solution G,since o2−o1<o2−g1.In other words,we can actually make it to the positions in G without running out of water.Since G has the same number of stops,we conclude that g1is contained in some optimal solution.Therefore the greedy strategy works.Exercise16.2-5Consider the leftmost interval.It will do no good if it extends any further left than the leftmost point,however,we know that it must contain the leftmost point.So,we know that it’s left hand side is exactly the leftmost point.So,we just remove any point that is within a unit distance of the left most point since3they are contained in this single interval.Then,we just repeat until all points are covered.Since at each step there is a clearly optimal choice for where to put the leftmost interval,thisfinal solution is optimal.Exercise16.2-6First compute the value of each item,defined to be it’s worth divided by its weight.We use a recursive approach as follows:Find the item of median value, which can be done in linear time as shown in chapter9.Then sum the weights of all items whose value exceeds the median and call it M.If M exceeds W then we know that the solution to the fractional knapsack problem lies in taking items from among this collection.In other words,we’re now solving the frac-tional knapsack problem on input of size n/2.On the other hand,if the weight doesn’t exceed W,then we must solve the fractional knapsack problem on the input of n/2low-value items,with maximum weight W−M.Let T(n)denote the runtime of the algorithm.Since we can solve the problem when there is only one item in constant time,the recursion for the runtime is T(n)=T(n/2)+cn and T(1)=d,which gives runtime of O(n).Exercise16.2-7Since an identical permutation of both sets doesn’t affect this product,sup-pose that A is sorted in ascending order.Then,we will prove that the product is maximized when B is also sorted in ascending order.To see this,suppose not,that is,there is some i<j so that a i<a j and b i>b j.Then,consideronly the contribution to the product from the indices i and j.That is,a b ii a b j j,then,if we were to swap the order of b1and b j,we would have that contributionbe a b ji a b ij.we can see that this is larger than the previous expression becauseit differs by a factor of(a ja i )b i−b j which is bigger than one.So,we couldn’t ofmaximized the product with this ordering on B.Exercise16.3-1If we have that x.freq=b.freq,then we know that b is tied for lowest frequency.In particular,it means that there are at least two things with lowest frequency,so y.freq=x.freq.Also,since x.freq≤a.freq≤b.freq=x.freq, we must have a.freq=x.freq.Exercise16.3-2Let T be a binary tree corresponding to an optimal prefix code and suppose that T is not full.Let node n have a single child x.Let T be the tree obtained by removing n and replacing it by x.Let m be a leaf node which is a descendant of x.Then we have4cost(T )≤c∈C\{m}c.freq·d T(c)+m.freq(d T(m)−1)<c∈Cc.freq·d T(c)=cost(T)which contradicts the fact that T was optimal.Therefore every binary tree corresponding to an optimal prefix code is full.Exercise16.3-3An optimal huffman code would be00000001→a0000001→b000001→c00001→d0001→e001→f01→g1→hThis generalizes to having thefirst n Fibonacci numbers as the frequencies in that the n th most frequent letter has codeword0n−11.To see this holds,we will prove the recurrencen−1i=0F(i)=F(n+1)−1This will show that we should join together the letter with frequency F(n)with the result of joining together the letters with smaller frequencies.We will prove it by induction.For n=1is is trivial to check.Now,suppose that we have n−1≥1,then,F(n+1)−1=F(n)+F(n−1)−1=F(n−1)+n−2i=0F(i)=n−1i=0F(i)See also Lemma19.2.Exercise16.3-4Let x be a leaf node.Then x.freq is added to the cost of each internal node which is an ancestor of x exactly once,so its total contribution to the new way of computing cost is x.freq·d T(x),which is the same as its old contribution. Therefore the two ways of computing cost are equivalent.5Exercise16.3-5We construct this codeword with monotonically increasing lengths by always resolving ties in terms of which two nodes to join together by joining together those with the two latest occurring earliest elements.We will show that the ending codeword has that the least frequent words are all having longer code-words.Suppose to a contradiction that there were two words,w1and w2so that w1appears more frequently,but has a longer codeword.This means that it was involved in more merge operation than w2was.However,since we are always merging together the two sets of words with the lowest combined frequency,this would contradict the fact that w1has a higher frequency than w2.Exercise16.3-6First observe that any full binary tree has exactly2n−1nodes.We can encode the structure of our full binary tree by performing a preorder traversal of T.For each node that we record in the traversal,write a0if it is an internal node and a1if it is a leaf node.Since we know the tree to be full,this uniquely determines its structure.Next,note that we can encode any character of C in lg n bits.Since there are n characters,we can encode them in order of appearance in our preorder traversal using n lg n bits.Exercise16.3-7Instead of grouping together the two with lowest frequency into pairs that have the smallest total frequency,we will group together the three with lowest frequency in order to have afinal result that is a ternary tree.The analysis of optimality is almost identical to the binary case.We are placing the symbols of lowest frequency lower down in thefinal tree and so they will have longer codewords than the more frequently occurring symbolsExercise16.3-8For any2characters,the sum of their frequencies exceeds the frequency of any other character,so initially Huffman coding makes128small trees with2 leaves each.At the next stage,no internal node has a label which is more than twice that of any other,so we are in the same setup as before.Continuing in this fashion,Huffman coding builds a complete binary tree of height lg(256)=8, which is no more efficient than ordinary8-bit length codes.Exercise16.3-9If every possible character is equally likely,then,when constructing the Huff-man code,we will end up with a complete binary tree of depth7.This means that every character,regardless of what it is will be represented using7bits. This is exactly as many bits as was originally used to represent those characters, so the total length of thefile will not decrease at all.6Exercise16.4-1Thefirst condition that S is afinite set is a given.To prove the second condition we assume that k≥0,this gets us that I k is nonempty.Also,to prove the hereditary property,suppose A∈I k this means that|A|≤k.Then, if B⊆A,this means that|B|≤|A|≤k,so B∈I stly,we prove the exchange property by letting A,B∈I k be such that|A|<|B|.Then,we can pick any element x∈B\A,then,|A∪{x}|=|A|+1≤|B|≤k,so,we can extend A to A∪{x}∈I k.Exercise16.4-2Let c1,...,c m be the columns of T.Suppose C={c i1,...,c ik}is depen-dent.Then there exist scalars d1,...,d k not all zero such that kj=1d j c ij=0.By adding columns to C and assigning them to have coefficient0in the sum, we see that any superset of C is also dependent.By contrapositive,any subset of an independent set must be independent.Now suppose that A and B are two independent sets of columns with|A|>|B|.If we couldn’t add any col-umn of A to be whilst preserving independence then it must be the case that every element of A is a linear combination of elements of B.But this implies that B spans a|A|-dimensional space,which is impossible.Therefore our in-dependence system must satisfy the exchange property,so it is in fact a matroid.Exercise16.4-3Condition one of being a matroid is still satisfied because the base set hasn’t changed.Next we show that I is nonempty.Let A be any maximal element of I then,we have that S−A∈I because S−(S−A)=A⊆A which is maximal in I.Next we show the hereditary property,suppose that B⊆A∈I ,then, there exists some A ∈I so that S−A⊆A ,however,S−B⊇S−A⊆A so B∈I .Lastly we prove the exchange property.That is,if we have B,A∈I and |B|<|A|we canfind an element x in A−B to add to B so that it stays independent.We will split into two cases.Ourfirst case is that|A|=|B|+1.We clearly need to select x to be the single element in A−B.Since S−B contains a maximal independent set Our second case is if thefirst case does not hold.Let C be a maximal inde-pendent set of I contained in S−A.Pick an aribitrary set of size|C|−1from some maximal independent set contained in S−B,call it D.Since D is a subset of a maximal independent set,it is also independent,and so,by the exchange property,there is some y∈C−D so that D∪{y}is a maximal independent set in I.Then,we select x to be any element other than y in A−B.Then, S−(B∪{x})will still contain D∪{y}.This means that B∪{x}is independent in(I)7Exercise16.4-4Suppose X⊂Y and Y∈I.Then(X∩S i)⊂(Y∩S i)for all i,so |X∩S i|≤|Y∩S i|≤1for all1≤i≤k.Therefore M is closed under inclusion.Now Let A,B∈I with|A|=|B|+1.Then there must exist some j such that|A∩S j|=1but B∩S j|=0.Let a=A∩S j.Then a/∈B and |(B∪{a})∩S j|=1.Since|(B∪{a})∩S i|=|B∩S i|for all i=j,we must have B∪{a}∈I.Therefore M is a matroid.Exercise16.4-5Suppose that W is the largest weight that any one element takes.Then, define the new weight function w2(x)=1+W−w(x).This then assigns a strictly positive weight,and we will show that any independent set that that has maximum weight with respect to w2will have minimum weight with respect to w.Recall Theorem16.6since we will be using it,suppose that for our matriod,all maximal independent sets have size S.Then,suppose M1and M2 are maximal independent sets so that M1is maximal with respect to w2and M2is minimal with respect to w.Then,we need to show that w(M1)=w(M2). Suppose not to achieve a contradiction,then,by minimality of M2,w(M1)> w(M2).Rewriting both sides in terms of w2,we have w2(M2)−(1+W)S> w2(M1)−(1+W)S,so,w2(M2)>w2(M1).This however contradicts maximality of M1with respect to w2.So,we must have that w(M1)=w(M2).So,a maximal independent set that has the largest weight with respect to w2also has the smallest weight with respect to w.Exercise16.5-1With the requested substitution,the instance of the problem becomesa i1234567d i4243146w i10203040506070We begin by just greedily constructing the matroid,adding the most costly to leave incomplete tasksfirst.So,we add tasks7,6,5,4,3.Then,in order to schedule tasks1or2we need to leave incomplete more important tasks.So, ourfinal schedule is 5,3,4,6,7,1,2 to have a total penalty of only w1+w2=30.Exercise16.5-2Create an array B of length n containing zeros in each entry.For each ele-ment a∈A,add1to B[a.deadline].If B[a.deadline]>a.deadline,return that the set is not independent.Otherwise,continue.If successfully examine every element of A,return that the set is independent.8Problem16-1a.Always give the highest denomination coin that you can without going over.Then,repeat this process until the amount of remaining change drops to0.b.Given an optimal solution(x0,x1,...,x k)where x i indicates the number ofcoins of denomination c i.We willfirst show that we must have x i<c for every i<k.Suppose that we had some x i≥c,then,we could decrease x i by c and increase x i+1by1.This collection of coins has the same value and has c−1fewer coins,so the original solution must of been non-optimal.This configuration of coins is exactly the same as you would get if you kept greedily picking the largest coin possible.This is because to get a total value of V,you would pick x k= V c−k and for i<k,x i (V modc i+1)c−i .This is the only solution that satisfies the property that there aren’t more than c of any but the largest denomination because the coin amounts are a base c representation of V modc k.c.Let the coin denominations be{1,3,4},and the value to make change for be6.The greedy solution would result in the collection of coins{1,1,4}butthe optimal solution would be{3,3}.d.See algorithm MAKE-CHANGE(S,v)which does a dynamic programmingsolution.Since thefirst forloop runs n times,and the inner for loop runs k times,and the later while loop runs at most n times,the total running time is O(nk).Problem16-2a.Order the tasks by processing time from smallest to largest and run them inthat order.To see that this greedy solution is optimal,first observe that the problem exhibits optimal substructure:if we run thefirst task in an optimal solution,then we obtain an optimal solution by running the remaining tasks in a way which minimizes the average completion time.Let O be an optimal solution.Let a be the task which has the smallest processing time and let b be thefirst task run in O.Let G be the solution obtained by switching the order in which we run a and b in O.This amounts reducing the completion times of a and the completion times of all tasks in G between a and b by the difference in processing times of a and b.Since all other completion times remain the same,the average completion time of G is less than or equal to the average completion time of O,proving that the greedy solution gives an optimal solution.This has runtime O(n lg n)because we mustfirst sort the elements.b.Without loss of generality we my assume that every task is a unit time task.Apply the same strategy as in part(a),except this time if a task which we9Algorithm2MAKE-CHANGE(S,v)Let numcoins and coin be empty arrays of length v,and any any attempt to access them at indices in the range−max(S),−1should return∞for i from1to v dobestcoin=nilbestnum=∞for c in S doif numcoins[i−c]+1<bestnum thenbestnum=numcoins[i-c]bestcoin=cend ifend fornumcoins[i]=bestnumcoin[i]=bestcoinend forlet change be an empty setiter=vwhile iter>0doadd coin[iter]to changeiter=iter−coin[iter]end whilereturn changewould like to add next to the schedule isn’t allowed to run yet,we must skip over it.Since there could be many tasks of short processing time which have late release time,the runtime becomes O(n2)since we might have to spend O(n)time deciding which task to add next at each step.Problem16-3a.First,suppose that a set of columns is not linearly independent over F2then,there is some subset of those columns,say S so that a linear combination of S is0.However,over F2,since the only two elements are1and0,a linear combination is a sum over some subset.Suppose that this subset is S ,note that it has to be nonempty because of linear dependence.Now,consider the set of edges that these columns correspond to.Since the columns had their total incidence with each vertex0in F2,it is even.So,if we consider the subgraph on these edges,then every vertex has a even degree.Also,since our S was nonempty,some component has an edge.Restrict our attention to any such component.Since this component is connected and has all even vertex degrees,it contains an Euler Circuit,which is a cycle.Now,suppose that our graph had some subset of edges which was a cycle.Then,the degree of any vertex with respect to this set of edges is even,so,10when we add the corresponding columns,we will get a zero column in F2.Since sets of linear independent columns form a matroid,by problem16.4-2, the acyclic sets of edges form a matroid as well.b.One simple approach is to take the highest weight edge that doesn’t completea cycle.Another way to phrase this is by running Kruskal’s algorithm(seeChapter23)on the graph with negated edge weights.c.Consider the digraph on[3]with the edges(1,2),(2,1),(2,3),(3,2),(3,1)where(u,v)indicates there is an edge from u to v.Then,consider the two acyclic subsets of edges B=(3,1),(3,2),(2,1)and A=(1,2),(2,3).Then, adding any edge in B−A to A will create a cycle.So,the exchange property is violated.d.Suppose that the graph contained a directed cycle consisting of edges corre-sponding to columns S.Then,since each vertex that is involved in this cycle has exactly as many edges going out of it as going into it,the rows corre-sponding to each vertex will add up to zero,since the outgoing edges count negative and the incoming vertices count positive.This means that the sum of the columns in S is zero,so,the columns were not linearly independent.e.There is not a perfect correspondence because we didn’t show that not con-taining a directed cycle means that the columns are linearly independent, so there is not perfect correspondence between these sets of independent columns(which we know to be a matriod)and the acyclic sets of edges (which we know not to be a matroid).Problem16-4a.Let O be an optimal solution.If a j is scheduled before its deadline,we canalways swap it with whichever activity is scheduled at its deadline without changing the penalty.If it is scheduled after its deadline but a j.deadline≤j then there must exist a task from among thefirst j with penalty less than that of a j.We can then swap a j with this task to reduce the overall penalty incurred.Since O is optimal,this can’t happen.Finally,if a j is scheduled after its deadline and a j.deadline>j we can swap a j with any other late task without increasing the penalty incurred.Since the problem exhibits the greedy choice property as well,this greedy strategy always yields on optimal solution.b.Assume that MAKE-SET(x)returns a pointer to the element x which isnow it its own set.Our disjoint sets will be collections of elements which have been scheduled at contiguous times.We’ll use this structure to quickly find the next available time to schedule a task.Store attributes x.low and x.high at the representative x of each disjoint set.This will give the earliest and latest time of a scheduled task in the block.Assume that UNION(x,y)11maintains this attribute.This can be done in constant time,so it won’t af-fect the asymptotics.Note that the attribute is well-defined under the union operation because we only union two blocks if they are contiguous.Without loss of generality we may assume that task a1has the greatest penalty,task a2has the second greatest penalty,and so on,and they are given to us in the form of an array A where A[i]=a i.We will maintain an array D such that D[i]contains a pointer to the task with deadline i.We may assume that the size of D is at most n,since a task with deadline later than n can’t possibly be scheduled on time.There are at most3n total MAKE-SET,UNION,and FIND-SET operations,each of which occur at most n times,so by Theorem21.14the runtime is O(nα(n)).Algorithm3SCHEDULING-VARIATIONS(A)1:Initialize an array D of size n.2:for i=1to n do3:a i.time=a i.deadline4:if D[a i.deadline]=NIL then5:y=FIND-SET(D[a i.deadline])6:a i.time=y.low−17:end if8:x=MAKE-SET(a i)9:D[a i.time]=x10:x.low=x.high=a i.time11:if D[a i.time−1]=NIL then12:UNION(D[a i.time−1],D[a i.time])13:end if14:if D[a i.time+1]=NIL then15:UNION(D[a i.time],D[a i.time+1])16:end if17:end forProblem16-5a.Suppose there are m distinct elements that could be requested.There may besome room for improvement in terms of keeping track of the furthest in future element at each position.If you maintain a(double circular)linked list witha node for each possible cache element and an array so that in index i thereis a pointer corresponding to the node in the linked list corresponding to the possible cache request i.Then,starting with the elements in an arbitrary order,process the sequence r1,...,r n from right to left.Upon processing a request move the node corresponding to that request to the beginning of the linked list and make a note in some other array of length n of the element at the end of the linked list.This element is tied for furthest-in-future.Then, just scan left to right through the sequence,each time just checking some12set for which elements are currently in the cache.It can be done in constant time to check if an element is in the cache or not by a direct address table. If an element need be evicted,evict the furthest-in-future one noted earlier. This algorithm will take time O(n+m)and use additional space O(m+n). If we were in the stupid case that m>n,we could restrict our attention to the possible cache requests that actually happen,so we have a solution that is O(n)both in time and in additional space required.b.Index the subproblems c[i,S]by a number i∈[n]and a subset S∈ [m]k.Which indicates the lowest number of misses that can be achieved with an initial cache of S starting after index i.Then,c[i,S]=minx∈{S}(c[i+1,{r i}∪(S−{x})]+(1−χ{ri}(x)))which means that x is the element that is removed from the cache unless it is the current element being accessed,in which case there is no cost of eviction.c.At each time we need to add something new,we can pick which entry toevict from the cache.We need to show the there is an exchange property.That is,if we are at round i and need to evict someone,suppose we evict x.Then,if we were to instead evict the furthest in future element y,we would have no more evictions than before.To see this,since we evicted x,we will have to evict someone else once we get to x,whereas,if we had used the other strategy,we wouldn’t of had to evict anyone until we got to y.This is a point later in time than when we had to evict someone to put x back into the cache,so we could,at reloading y,just evict the person we would of evicted when we evicted someone to reload x.This causes the same number of misses unless there was an access to that element that wold of been evicted at reloading x some point in between when x any y were needed,in which case furthest in future would be better.13。
PTAS算法
Course:Randomized Algorithms,LNMBLeen Stougie and Ren´e SittersWeek724-10-2011Approximation schemes for geometric problems1IntroductionThis lecture is about the polynomial time approximation scheme(PTAS) for the traveling salesman problem(TSP)in the Euclidean plane developed by Arora[1].The survey paper by the same author[2]is a good reference. See:/arora/pubs/arorageo.ps.The book by Vazi-rani[5]and the book by Shmoys and Williamson[4]contain a chapter on this algorithm.This result contains many technical details.When you browse through the versions listed above you will see many differences.In thefirst version (1996)the running time was n O(1/ ).This was improved to n(log n)O(1/ ) in[1].Here,I will only discuss thefirst,less efficient result.(If you come across the terms‘patching lemma’and‘(m,r)-light tours’in the literature then these refer to the improved algorithm that is not discussed here.) All references listed here are excellent but I think this note can be helpful since in[5]many details are missing(and are left as exercise)while the other references are long and cover the more advanced algorithm completely.This notes covers the easiest form completely.Karp’s algorithmWhat is the most obvious approach for designing a polynomial time approx-imation scheme for Euclidean TSP?Cut the problem in smaller pieces and then solve the small problems and combine everything to get one solution. The nice thing about working in the Euclidean plane is that cutting the met-ric space in small pieces is simple:Draw a square B around all input points and then cut the square in smaller squares.This was exactly what Karp did in his TSP algorithm for the Euclidean plane[3].In general,the TSP on1n points can be solved exactly in time O(2n).So if we split up the square B in small rectangles Q i,each containing M=log2n input points,then we canfind an optimal TSP tour T i for any of these subproblems in time O(2M)=O(n)time.There are n/M rectangles so the total time to solve all these subproblems is O(n2/M)=O(n2/log2n).The next step of Karp’s algorithm is to pick one input point v i in each rectangle Q i and then make a tour T on{v1,v2,...,v n/M}.For this we can use for example Christofides’algorithm.Now a TSP tour follows from combining the big tour T with the small tours T i.From a worst case point of view this algorithm performs poorly.However, if we assume that the input is formed by taking n points uniformly at random in a square,then the expected ratio is1+o(1).In other words,it goes to1 for n→∞.Arora’s PTAS for Euclidean TSPThe algorithm of Karps described above is deterministic and performs well on a random input.Arora’s algorithm is randomized and performs well an any input.Moreover,derandomization is easy,although at the cost of an increased running time.The randomization is a simple step in the algorithm but it is an important part of the analysis.The random step makes it possible to do the dynamic programming in polynomial time.The main ingredientsThe main ingredients of the algorithm are:(A)Rounding the instance.(B)Restricting the set of feasible solutions.(C)Dynamic programming.(D)Randomization.Note that Karp’s algorithm uses none of these.Below,I will sketch the basics of these ideas.The algorithm is given in detail later.The randomization is actually thefirst step of the algorithm but it is easier to explain the idea of this step here at the end.2(A)Rounding the instance This is done by defining a grid and move each input point to the middle of the grid cell in which it is contained.Since we only want a1+ approximation and not the true optimum we can afford to change the instance a little bit.The solution that wefind is used for the original instance as well:just maintain the same ordering of points.The advantage of shifting points is that it simplifies the dynamic programming: For the DP we divide the plane into small squares and solve subproblems inside the squares.The effect of rounding(i.e.shifting points)is twofold:(i) there are no input points on the boundary of squares and(ii)the smallest squares(the grid cells)contain at most1input point.The density of the grid is important.A denser grid gives a smaller error but leads to a higher running time.(B)Restricting the set of feasible solutions.This is another way to speed up the dynamic programming.Instead offinding the optimum over all feasible solutions wefind the optimum over a smaller set of feasible solutions that satisfy some condition.This restriction enables us to do the dynamic programming in polynomial time.Of course one should prove that the optimum over the restricted set of solutions problem is not far from the true optimum.In fact,it can be far offbut the randomization(D)ensures that the difference is small in expectation.The basic idea of this restriction is as follows.On each grid line we place a set of points that we call portals and add the restriction that the tour can only cross a grid line at a portal.(C)Dynamic programming.By dynamic programming wefind the true optimum over all restricted solutions(B)for the rounded instance(A).First, draw one square that contains all input points.Call this the enclosing box B.Divide the square into four equal sized squares.Then,divide each of the four squares into four equal sized squares.Keep dividing squares into four equal sized squares until each of the smallest squares contains at most one input point.This division defines a tree:The root is the largest square B and its four children are the four squares in which it is divided.In general, each inner vertex of the tree has degree four and that is why it was called the quad tree in[1].The squares that correspond with the vertices of the tree are called dissection squares.The DP starts at the leaves of the putations for the leaves of3the tree(the smallest squares)become easy since they contain at most input point.In general,each dissection square defines a polynomial number of subproblems in the DP.The optimal values of any subproblem is found by looking up a polynomial number of values for subproblems of its four children in the tree.Starting from the leaves wefill the DP table until we reach the root.(D)Randomization It is a simple but powerful step of the algorithm. Instead of taking an arbitrary enclosing box(which forms the root of the tree)we take a box uniformly at random from a set of boxes.In this way, the restriction made in(B)becomes randomized.The effect is that the restriction only gives a small change in the optimal value in expectation. The algorithmIn this section we describe the algorithm in detail.The steps of the algorithm:1.Take a random square B that covers all input points.2.Rounding:move each point to the middle of the grid cell it is in.3.Build the quad tree.4.Define portals.5.Build the dynamic program table.6.Fill the table.Step1:First we take a smallest square that covers all input points.The square may not be unique but any choice isfine.Call this the bounding box.Redefine the distances such that the side length of the box becomes 2k−1with k= log2(n/ ) .Let(0,0)be its lower left corner.Now take a,b∈{0,...,2k−1−1}independently and uniformly at random.Let L=2k and let(−a,−b)be the lower left corner of the L×L enclosing box B. Note that the bounding box has side length L/2and that its covered by the enclosing box B for any outcome of a and b.Also note that L=2k≥n/4Step2:Place an L×L grid over B and move each input point to the middle of the grid cell that it is in.If a point is on a grid line then choose one adjacent cell.From now on we only consider this rounded instance.Step3:The box B is the root of the tree and we say it is of level0.It is divided into four equal sized squares of level1.These are its children in the quad tree.Keep dividing until the smallest squares have size1×1.These are the leaves of the tree and they are of level k(by definition of k).We day that the root has highest level and the leaves have the lowest level.The squares of the tree are called dissection squares.We also define levels for all inner grid lines.Denote the horizontal middle grid line and vertical middle grid line as level1lines.Hence,these are the two lines that divide the box B into its four children.In general,the level i grid lines are those lines that divide the level i−1squares of the tree each into four level i squares.So horizontally we have2i−1level i lines and the same number vertically,i=1,...,k. Step4:Each inner grid line gets a number of equidistant portals.The number depends on the level of the line.A level i lines gets m2i−1portals such that these points divide the line into m2i segments of equal length.The portals on the boundary of a dissection square are then given by the portals on the grid lines that bound the square.For a level i square,two of its sides are level i grid lines and the other two sides are of higher level.That means that two sides have exactly m+1portals and the other sides both have at most m/2+1portals.Then,the number of portals per square is at most4m if m≥4.Let m= k/ .(Arora reduced this to m=O(1/ )in[1].) We say that a solution is portal respecting if it crosses grid lines only at portals.Step5:By dynamic programming wefind the smallest portal respecting tour.We shall prove later that the optimal portal respecting tour crosses each portal at most twice.For the DP it is convenient to think of a portal as two portals:each is crossed at most ones.There is an entry in the DP table for every dissection square and for every possible way that an optimal solution may cross the boundary of this square. For each entry of the table we will store one value,which is the length of the fraction inside the square of the optimal solution satisfying the boundary conditions.A property of any optimal TSP tour in the plane is that it does not cross itself.That means that the part inside a square is a set of paths that do not cross and visit all input points inside.5Formally,an entry in the dynamic program table is given by a triple (X,Y,Z).Here,X ranges over all dissection squares,Y is any even subset P of the portals of X,and Z is a valid pairing for this subset P.A valid pairing is a partitioning of P in pairs such that we can connect each pair of points by a path inside the squares without crossings.Step6:For each entry(X,Y,Z)we compute the length of the shortest set of paths visiting all input points inside X and that satisfies the boundary conditions Y and Z.Denote this value by F(X,Y,Z).If X is a leaf of the tree then the value can easily be computed:If there is no input point inside X then the optimal solution is to connect each pair in Z by a straight line and if there is one input in X then one path will visit the point and the other paths are straight lines.If X is not a leaf,then the value F(X,Y,Z)can be computed by looking at all values for the children of X in the tree,say X1,X2,X3,X4.Consider any quadruple(X1,Y1,Z1),(X1,Y2,Z2),(X3,Y3,Z3),(X4,Y4,Z4).We say that it is consistent with(X,Y,Z)if(i)portals are consistent and(ii)the pairing is consistent.With(i)we mean that if two squares(for example X and X1or X1and X2)have a boundary in common then on this part they use the same set of portals.With(ii)we mean that the pairing Z should be consistent with the pairing that is defined by the pairings Z1,Z2,Z3,Z4.For example, assume that p1and p2are portals in Y and assume that in Z1portal p1is paired with some portal q and in Z2portal q is paired with p2.Then p1and p2should be paired in Z.Further,we should check that the pairings do not define a subtour,unless Y is the emptyset in which case the four pairings should add up to a single tour,(which is the case when X is the root). The analysisWe need to check that the algorithm can be implemented in polynomial time and that the approximation guarantee is(1+ )OPT.We srat with the latter. Analysis of the approximation ratioTo prove that the algorithm is a PTAS it is enough to prove that the ratio is1+O( ).We need to check that rounding the instance and restricting to portal respecting tours does not change the optimal value to much.Let OPT be the optimal value of the original instance and let OPT be the optimal value of the rounded instance,say I .6Lemma1|OPT−OPT |≤O( )OPT.Proof.The bounding box has side length L/2and was taken as small as possible.Hence,OPT≥L.Further,L≥n/ which implies OPT≥n/ . The maximum distance by which a point is moved by the rounding step is √2/2.Therefore,|OPT−OPT |≤n √2≤√2 OPT.Let E[OPT ]be the expected value(over random choices a and b)of the optimal solution for instance I .LetΠbe an optimal tour for I .Lemma2The tourΠhas at most √2OPT crossings with grid lines.Proof.TourΠis formed by n straight line segments.Consider any such segment of length s.Assume it goes from(x1,y1)to(x2,y2).The number of crossings with vertical grid lines is|x1−x2|and it has at most|y1−y2| crossings with horizontal grid lines.The sum is|x1−x2|+|y1−y2|≤√2s.Hence the total number of crossings is at most √2OPT .Lemma3OPT ≤E[OPT ]|≤(1+O( ))OPT .Proof.Letδi be the distance between two neighboring portals on a level i grid line,call this the inter portal distance.Thenδi=Lm2i=2km2i.Given the optimal tourΠ for I we make it portal respecting by moving each crossing with a grid line to the nearest portal.The length of such detour is at most twice the distance to the nearest portal.Consider an arbitrary crossing ofΠ with some grid line l.The inter portal distance depends on the level of the line,which is determined by the randomization step of the algorithm.The probability that this grid line l becomes a level1line is exactly1/(L/2)=1/2k−1.Somewhat surprisingly, the probability that this grid line l becomes a level2line is also1/2k−1.For7any i≥2this probability is1/2k−i+1.Hence,for any i≥1,the probability that a grid line becomes a level i line is at most12k−i.The expected length of the detour for moving the crossing with l to the nearest portal is at mostki=1δi·12k−i=ki=12km2i·12k−i=km=kk/≤ .By Lemma2,there are at most √2OPT crossings with grid lines.So thetotal expected detour for makingΠ portal respecting is at most·√2OPT =O( )OPTBy combining Lemma1and Lemma3we get the desired result.Corollary1|OPT−E[OPT ]|≤O( )OPT.Analysis of the running timeThe running time of the algorithm is determined by the dynamic program-ming.We need to show that the size of the DP table is polynomially bounded and that each value of each entry can be computed in polynomial time.The number of dissection squares is O(4k)=O(4log2(n/ ))=O(n2/ 2). Each square has no more than4m portals.Remember that we copied each portal to enhance the DP.This gives at most8m portals per square.The number of possible subsets is at most28m=(n/ )O(1/ )=n O(1/ ).Given an even subset Y of the portals,the number of valid pairings is at most 2|Y|.This upper bound is obtained as follows.Assume we are given a valid pairing.Now choose one of the corners of X and walk one round around the boundary of X.Every time that a portal of Y is encountered label it 0if it comes before its paired portal in this walk and label it1otherwise. This gives a0,1-vector of length|Y|≤8m.If wefix the starting point,then every pairing gives a unique0,1-vector.This follows from the fact that valid pairings have no crossings.Hence,given Y the number of valid pairings is at8most28m=n O(1/ ).Over all,the number of entries in the DP table is upper bounded by O(n2/ 2)×n O(1/ )×n O(1/ )=n O(1/ ).Now we compute an upper bound on the computation time of F(X,Y,Z). If X is a leaf then we only need to check|Y|/2solutions:exactly one of the |Y|/2pairs is connected with the input point(if any)and the other pairs are connected by straight lines.If X is not a leaf then the value F(X,Y,Z)can be computed by considering all combinations of entries of its four children. The number of possible combinations is(n O(1/ ))4=n O(1/ ).We have shown that the size of the DP table is n O(1/ )and that it takes n O(1/ )time to compute one value.Therfore the total running time of the algorithm isn O(1/ )·n O(1/ )=n O(1/ ).Remark:Some constants here are different(read:better)from what was shown in class.Problem for this week:Adjust the algorithm above to the Euclidean Steiner Tree problem.In this problem we are given a set of n points in the plane and we need tofind the smallest tree that contains all these points as vertices and possibly some other vertices as well.The extra vertices of the tree are called Steiner points.References[1]S.Arora.Polynomial time approximation schemes for euclidean travelingsalesman and other geometric problems.Journal of the ACM,45:753–782, 1998.[2]S.Arora.Approximation schemes for NP-hard geometric optimizationproblems:A survey.Math.Programming,97,2003.[3]R.Karp.Probalistic analysis for partitioning algorithms for the travelingsalesman problem in the Euclidean plane.Math.of Operations Research, 2,1977.[4]D.Shmoys and D.Williamson.The design of approximation algorithms.Cambridge University Press,2011.9[5]V.Vazirani.Approximation Algorithms.Springer,Berlin,2001.10。
05. AI CSP
Real-world CSPs
Assignment problems e.g., who teaches what class who reviews which papers Timetabling problems e.g., which class is offered when and where?
1
Review: last chapter
Local search algorithms
– the path to the goal is irrelevant; the goal state itself is the solution – keep a single "current" state, try to improve it
5
Example: Map-Coloring
Variables WA, NT, Q, NSW, V, SA, T Domains Di = {red,green,blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (if the language allows this), or (WA,NT) ∈{(red,green),(red,blue),(green,red), (green,blue), … }
4
Constraint satisfaction problems (CSPs)
Standard search problem: state is a “black box“ – any old data structure that supports goal test, eval, successor