Background technology
The main method of real time data compression at present can be divided three classes, i.e. piecewise linearity method, vector quantization method and signal transformation method.The piecewise linearity method comprises that boxcar method (boxcar), back are to slope method (backward slope), revolving door trending method (SDT) and the online trending method of piecewise linearity (PLOT); Although these method compression ratios are high not as signal transformation method; But that its advantage is an algorithm is simple, code execution speed is fast, in process industrial, is used widely.Vector quantization method need be spent a lot of Time Calculation code books, and code book do not have versatility, and promptly the code book of a data set can not be used for other data set, because amount of calculation is too big, vector quantization method is not suitable for the process data line compression.Signal transformation method is a lot; Like Fourier transform, wavelet transformation etc., though small wave converting method also exists some actual techniques problems to need to solve at present, Fourier transform is the main means of signal processing always for a long time; But it can only picked up signal entire spectrum; And be difficult to obtain the local feature of signal, and becoming in the time of can not fully portraying, the characteristic of non-stationary signal, the lossy compression method threshold value in data is difficult to control simultaneously; The problem of adding a lot of reality has to be solved, so actual use and few.In traditional linear compression algorithm, all be only to adopt straight line to portray a certain section data in the space to be compressed generally, regardless of the concrete trend of the data in this section space; All be unalterable to approach match with straight line; And do not ignore concrete data characteristics, during the actual compression algorithm, often through investigating each data point successively; When some data point error ranges meet the compression that just continues next point when coming the error of match with straight line; Otherwise this wheel compression of terminates, the compression of beginning next round is such as traditional revolving door algorithm.This simple compress mode often causes the compression ratio of data low, and compression efficiency is low.
Summary of the invention
The present invention seeks to provides the match of a kind of greedy formula intelligence to diminish data compression method to the defective that prior art exists.
The present invention adopts following technical scheme for realizing above-mentioned purpose:
The match of the greedy formula intelligence of the present invention diminishes data compression method, it is characterized in that comprising the steps:
(1) if current data point is the starting point of a wheel compression, puts (bU)=a
k-E with (bL)=a
k-E finishes a
kProcessing, a
kBe current data point, U
iAnd L
iFunction expression be:
a
iRepresent i element, i=0,1,2...n, t=1,2,3...n, k=1,2,3...n, wherein (KL), (KU) represent the coordinate figure of point, E representes the correction value of error amount, (bL), (bU) expression data point;
(2) to arbitrary probable value of i, if (KU)≤(KL)
i, judge if let U
iThrough a
kWhether can increase (KU)
iIf can make (KU)
iIncrease and then increase (KU)
iMake U
iThrough a
k
(3) to arbitrary probable value of i, if (KU)≤(KL)
i, judge if let L
iThrough a
kWhether can reduce (KL)
iIf can make (KL)
iReduce then to reduce (KL)
iMake L
iThrough a
k
(4) if all probable values of i are had (KU)
i>(KL)
i, preserve a of this moment separately
kContinuation is according to investigating a
K+1If meet (KU)
i>(KL)
iThen continue to investigate a according to (2) (3)
K+2, a
K+3, a
K+4... until incongruent element, be the compression that starting point begins a new round with incongruent element.
After a wheel compression finishes, starting point and endpoint data that recording compressed is interval, this algorithm also need write down last a simultaneously
iValue; The end point values of algorithm records neither destination county initial data, but handle U after the endpoint data
iAnd L
i, in the average of destination county functional value.
The present invention is in real data, and through analyzing, data to be compressed are in a certain section compression stroke; Often be not the single type that is in line variation tendency, data also have other forms of variation tendency, such as similar parabolic; And the point that often finishes certain wheel compression process is one " noise ", continues to investigate next point and can find that it also is the error that meets this wheel compression if skip this " noise ", compression algorithm that can be traditional this wheel compression that but is through with; So our algorithm is when packed data; Not only need not go the fitting data variation tendency by independent straight line, in each compression process, not only can investigate point next to be compressed simultaneously, but investigate following two points to be compressed; The influence of data noise can not only be got rid of like this, more compression ratio can be improved greatly.
Embodiment
In commercial production, the variation of data generally has different trend, thus our algorithm be exactly in each compression process, investigate below two data points to be compressed, the compression that carries out curve fitting of special processing noise, adaptive selection data variation trend.
As shown in Figure 1, after having analyzed data, roughly find in one section data segment to be compressed following 3 kinds of variation tendencies are arranged substantially: linear pattern, parabolic type, anti-parabolic type.
Wherein linear pattern is represented smooth change, and two promptly adjacent real time data differences remain constant; The parabolic type representative changes gradually and increases, and the difference between two promptly adjacent real time datas is increasing; Anti-parabolic type reduces gradually, and the difference between two promptly adjacent real time datas is more and more littler.
Traditional algorithm is just adopted in a like fashion to above three kinds of situation and is carried out match like linear pattern; If require algorithm can obtain better compression effectiveness, new algorithm must be according to variation tendency dynamic form of adjusting the expression formula of fitting function when moving of real data.In this project, we suppose that our fitting function is y=k * t
a+ b (wherein t=1,2,3...n, and k, a are variable undetermined, a is value in advance)------(1)
As shown in Figure 2; From fitting function, can find out: the represented figure of function when a=1 (1) is linear pattern exactly; The represented figure of function when a=2 (1) is parabolic type exactly; The represented figure of function when a=0.5 (1) is anti-parabolic type exactly, so we might as well suppose a=1,2,0.5 3 numbers at this.
For the threshold value of controlling compression is a compressed error, still use two each compression of taking turns of fan gate control up and down in the actual algorithm:
As shown in the figure, be starting point with data point 1.Range data point 1 has two fulcrums for the place of E in vertical direction.Corresponding two straight line or the curves that connect fulcrums and process data of each element are regarded these two straight lines or curve as two fans virtual " door " that with the fulcrum be spool.Three elements are arranged among the i, have six fan doors.This six fans door was all closed when algorithm began.Six fan doors can only be opened and can not close in the algorithm implementation.With a
iRepresent the individual element of i (i=0,1,2), represent two straight lines or the describing function of curve, the then U that a is corresponding with U and l
iAnd L
iFunction expression be:
Wherein t is the moment that real time data arrives.
Like Fig. 3 and shown in Figure 4, with a
1, a
2, a
3... .a
k... .a
nExpression real process data suppose that current data point is a
k, this algorithm is receiving processing below the work after this:
(1) if current data point is the starting point of a wheel compression, puts (bU)=a
k-E with (bL)=a
k-E finishes a
kProcessing;
(2) to arbitrary probable value of i, if (KU)≤(KL)
i, judge if let U
iThrough a
kWhether can increase (KU)
iIf can make KU
iIncrease and then increase (KU)
iMake U
iThrough a
k
(3) to arbitrary probable value of i, if KU≤KL
i, judge if let L
iThrough a
kWhether can reduce (KL)
iIf can make KL
iReduce then to reduce (KL)
iMake L
iThrough a
k
(4) if all probable values of i are had (KU)
i>(KL)
i, preserve a of this moment separately
k, continue according to investigating a
K+1If, eligible then continue a according to (2) (3)
K+2, a
K+3, a
K+4... have only a of working as
K+1Do not meet, just with a yet
K+1Begin the compression of a new round for starting point.Need be after a wheel compression finish, starting point and endpoint data that recording compressed is interval, this algorithm also need write down last a simultaneously
iValue.The end point values of algorithm records neither destination county initial data, but handle U after the endpoint data
iAnd L
i, in the average of destination county functional value.
When reduction of data; The information of the incident that we write down according to the compression that each is taken turns in compression algorithm; The time point that comprises compression point, the matched curve parameter of the match value of compression point and the value of noise, compression point, and then utilize function that original point is restored.