ebook img

Implementation of Motzkin-Burger algorithm in Maple PDF

0.13 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Implementation of Motzkin-Burger algorithm in Maple

Implementation of Motzkin-Burger algorithm in Maple P.A. Burovsky 5 0 [email protected] 0 2 n Abstract a Subject of this paper is an implementation of a well-known Motzkin- J Burgeralgorithm,whichsolvestheproblemoffindingthefullsetofsolu- 1 tionsofasystemoflinearhomogeneousinequalities. Thereexistanumber of implementations of this algorithm, but there was no one in Maple, to ] G the best of theauthor’s knowledge. C . 1 The problem s c [ Consider a linear homogeneoussystem of inequalities with rationalcoefficients 1 v l (x)=a x +...+a x 60, a ∈Q, (j =1,...,m). (1) j j1 1 jn n ji 3 0 Let r be the rank of the matrix of (1). 0 Recall some common facts from the theory of convex sets (see for example, 1 0 [1]). Every solution set X1,...,Xp of a system (1) generates a convex cone C 5 of solutions 0 k X +...+k X , k >0. (2) 1 1 p p i / s We call a finite set of solutions X ,...,X ∈ Qn a set of generators for C c 1 p : if every element of C is a conical combination (2) of X1,...,Xp. Hereinafter v we will consider the minimal sets of generators only, i.e. such that none of the i X X ,i = 1,...,p is expressed from the others with positive coefficients. We call i r d the dimension of a cone C if d is the dimension of the minimal linear space a spanned by C. A solution locus of eachinequality is a half-space of Qn. For any subsystem {l (x) 6 0,j ∈ J} of (1) its solution set is a convex polyhedral cone. The j faces of the latter are the intersections of C with solution loci of some equation subsystems {l (x)=0,j ∈I ⊆J} with linearly independent left-hand sides. j The problemdiscussedin this paper is to solve (1) a overQn. This problem iscloselyrelatedtothefollowingone. Extendthesystem(1)byanewinequality l(x)=a x +...+a x 60. (3) 1 1 n n Not all the points of the cone C satisfy (3), thus the system (1) together with (3) define a new cone C⋆. We are interested in computing the set of generators 1 for C⋆ given the set of generators for C. The Motzkin-Burger algorithm solves this problem. The iteration of the Motzkin-Burger algorithm solves the first problem by means of extending the trivial system {0 6 0} by the inequalities of (1) one by one. 2 Algorithm description 2.1 Theoretical study Let us recall some well-known facts (generally following [1], [2], [3]). The set ofgeneratorsfor a cone C⋆ consists ofgeneratorsfor cone C (which satisfy the inequality l(x)<0) and the whole set of generators for cone C∩H where H := {l(x) = 0}. Thus, in order to compute the cone C⋆ we need to study both the structure of the cone C and structure of the intersection. The cone C is a Minkovsky sum of its linear subspace L and the strongly convex cone P (that is the cone with apex at the origin and contain no line through the origin). Vectors u of the base U of L satisfy {l (u) = 0,j = j 1,...,m}, whereas any element v of set V of generators of P satisfies l (v)<0 j for at least one j. Let us denote vectors X belonging to U or V by X+ if l(X) > 0, X− if l(X) < 0 and X0 if l(X) = 0. Also denote the linear subspace of the new cone with its base and the strongly convex cone of the new cone with its set of generatorsby L⋆, U⋆, P⋆, V⋆, respectively. Hence the vector u0 belongs to U⋆, while u−, v0 and v− belong to V⋆. Although, {u∈U :l(u)=0} is not U⋆. By discardingall u+-s and v+-s we lose a number of generatorsfor the cone C and have to be replaced them by the whole set of generators for H ∩C. Since H ∩C =(H ∩L)∪(H ∩P) we can describe how to convert U to U⋆ and V to V⋆ separately. There are two cases with respect to the intersection H ∩L: H ∩L = L or H ∩L6=L. In the first case, U⋆ =U. Inthesecondcasethenewinequality(3)reducesthedimensionofLbyone. Choose one u− ∈ U (if there is no such vector in U, take −u+). Let us form − − dimL−1 pairs of vectors u and u ∈ U \{u }. For every pair consider the j conic combinations au−+bu , a,b>0. (4) j The intersection of H with the cone (4) is the ray of positive multiplies of u⋆ :=−l(u−)u +l(u )u−. (5) j j j It is clear that l(u⋆) = 0. Thus, dimL − 1 vectors u⋆ are the base of L⋆. j j Note that the representationof the base of L is not unique since we can choose − different vectors for u if they exist. TheconversionofV toV⋆ alsodependsonexistenceofabovementionedu−. The elementu− belongsto V⋆ if itexists. New inequality (3)induces the affine 2 transformation − − −l(u )v+l(v)u (6) of elements v ∈ V that results in that every vector (6) satisfies (3). It is − − − evident that the set {u ,−l(u )v + l(v)u for all v ∈ V} is minimal in the abovementioned sense, thus the latter is the set of generators V⋆. − If there exist no such u ∈ U, the transformation (6) of V is impossible. The new inequality separates P into two parts. As already was mentioned, the elements v− belong to V⋆. To findallthe vectorsthatlie inH letusconsideranypairv−,v+ ∈V. For this pair the combination v⋆ :=−l(v−)v++l(v+)v− (7) k lies in H. The set of all v⋆-s generates the convex polyhedral cone in H, but k there are too many elements of {v⋆} for it to be the set of generators for the k latter cone. The minimal faces that contain a pair of generators are exactly two-dimensional ones. Therefore, in order to avoid the superfluous solutions we only need to reject all the pairs of generators that are not lying on faces of dimension 2. Checkingiftwovectorslieonafaceofdimension2maybedoneintwoways. The first way is to check whether there exists {l (x),j ∈ J,|J| = r−2} with j linear independent l (x) such that l (v−)=l (v+)=0 holds true for all j ∈J. j j j The second way is to check there exist no third v ∈ V such that l (v) = 0 for j all j such that l (v−) = l (v+) = 0 (are not taken into account the rank r nor j j linear independence of l -s). j Wethereforecometothealgorithmthatsolvesasystemoflinearinequalities over Qn: Input: S :={l (x),...,l (x)} — the left-hand sides of the inequalities 1 m of (1), n — the space dimension. Output: U ={u ,...,u } — the base of the maximal linear subspace L of 1 t the solution cone of (1), V ={v ,...,v } — the set of generators for the strongly convex 1 s cone P of the solutions of the system (1). 1. U :={(1,...,0),...,(0,...,1)}; current 2. V :=∅; current 3. S :={060}; current 4. i:=1; 5. l :=l (x); i 6. if ∃u∈U : l(u)6=0, then current U :={l(u)u −l(u )u, u ∈U }; current i i i current n:=−(l(u)/|l(u)|)u; V :={n,−l(n)v +l(v )n, v ∈V }; current i i i current 7. else V1 :={v ∈V |l(v)60}; V2 :=∅; current current current 3 for ∀(v ,v )∈V2 : l(v )<0, l(v )>0 do k s current k s S⋆ :={l (x)∈S |l (v )=l (v )=0}; j current j k j s if S⋆ 6=∅ then for ∀v ∈V \{v ,v } current k s for ∀l (x)∈S⋆ do j if l (v)6=0 then j V2 :=V2 ∪{−l(v )v +l(v )v }; current current s k k s end if; end do; end do; end if; end do; end if; 8. V :=V1 ∪V2 ; current current current 9. S :=S ∪{l (x)}; current current i 10. S :=S\{l (x)}; i 11. i:=i+1; 12. if S =∅ then goto 14; end if; 13. goto 5; 14. return U ,V . current current 2.2 Some improvements Therearesometricksconcerningthepreparationofthesysteminordertolower the number of inequalities and/or variables. Firstly, the system may have no occurrences of some of x , k =1,...,n. In k thiscasewecan“cleanup”thesystemandthusreducethenumberofvariables. Secondly,wecanavoidthelinearsubspaceLofconeofsolutionsbyperform- ing the change of variables. This trick also enables one to simplify the original system of inequalities. The dimension of L is n−r, where r is the rank of matrix of (1), as was mentioned above. Let us define new r variables y ,...,y to equal any r linear 1 r independent left-hand sides of (1) (for example, first r ones): l (x)=−y 60, j =1,...,r, (8) j j l (x)60, j =r+1,...,m. (9) j By solving the system {l (x) = −y ,j = 1,...,r} for {x ,...,x } we obtain j j 1 n the (n−r)-dimensional space of solutions 4 x =f (y ,...,y ,x ,...,x ), i1 1 1 r ir+1 in ... (10) x =f (y ,...,y ,x ,...,x ), ir r 1 r ir+1 in x =x ir+1 ir+1 ... (11) x =x in in where(i ,...,i )is the permutationofindices 1,...,n (we don’tknowa priori 1 n which variables x are most likely to be solved for). i Uponsubstitution(10)thesystem(1)doesnotdependonx ,...,x be- ir+1 in cause l (x),...,l (x) are the linear combinations of the first r ones. There- r+1 m fore,substitution(10)reducesthesystemtothatofminequalitiesforrindepen- dent variables y ,...,y . The r inequalities of reduced system are simplified to 1 r be just −y 60. This inequality subsystem has the a priori known solution E i r — the r-dimensional linear space base. Hence we may efface these inequalities fromthereducedsystem. Moreprecisely,solvingthesystemweiterateMotzkin- Burgeralgorithmstartingfromthesystemofinequalities{−y 60,i=1,...,r} i andU =∅ andV =E . Thus the systemis reducedto ofm−r inequalities for r r independent variables. Because U = ∅ at the start of algorithm, there is no need in any parts of algorithmexcept for the most complicatedpart that is the conversionof V to V⋆ when there is no u− exists. The application of the Motzkin-Burger algorithm yields a number of so- lutions of the reduced system. By means of n − r substitutions (10) and (xir+1,...,xin)=Enk−r,whereEnk−r arethebasevectorsof(n−r)-dimensional linear space, we then obtain the solution set of the original system. The case of r = n is also of interest for simplifying the system despite that there is no lowering the number of variables. The system is reduced to that of m−n inequalities for n independent variables in this case. The calculation procedure is repeated in full except for that there is no need to consider the substitution the (n − r)-dimensional linear space base vectors to the several components (x ,...,x ) of any solution. ir+1 in Also of interest is the case of r =m where m is the number of inequalities. Upon the abovementioned substitution, the system is reduced to the diagonal one. Therefore,the whole system have a priori knownsolution in terms of new variables. We therefore come to the algorithm of solving the system (1) with special preparation prior to the application of the Motzkin-Burgeralgorithm: Input: S :={l (x),...,l (x)} — the left-hand sides of the inequalities 1 m of (1), n — the space dimension. Output: U ={u ,...,u } — the base of the maximal linear subspace L of 1 t the solution cone of (1), 5 V ={v ,...,v } — the set of generators for the strongly convex 1 s cone P of the solutions of the system (1). 1. Find all indices Bad ⊂ {1,...,n} such that S has no occurrences of x , j j ∈Bad; 2. Renumber the indices (not encountered in Bad) of variables so that S explicitly depend on n−|Bad| variables only; 3. Choose Base — the maximallinear independent subsystem of {l (x),j = j 1,...,m}; r :=|Base|; 4. Solve {Base =−y ,i=1,...,r} for {x ,...,x } to obtain set of identi- i i 1 n ties (10); 5. I :={i ,...,i }; r+1 n • 6. U :=∅; • 7. V :={(1,0,...,0),...,(0,...,0,1)}; | {z } rcomponents 8. if r <m then • (a) Substitute (10) to S in order to obtain S ; (b) Reorder the inequalities S such that −y 60 are the first r ones. i (c) Iterate the part of Motzkin-Burger algorithm mentioned above ex- • cluding the items 1, 2, 3, 4, 6, considering U =U , V = current current • • V , S =S , i=r+1 as the initial condition. current end if; 9. E :={ (1,0,...,0) ,...,(0,...,0,1)}; | {z } n−rcomponents 10. For each element e ∈ E substitute {y = ... = y = 0} and (x ,..., 1 r I1 x )=e into (10) and form u:=(x ,...,x )∈U; In−r 1 n • 11. For each element v ∈ V substitute {(y ,...,y ) = v} and (x = ... = 1 r I1 x )=0 into (10) and form v :=(x ,...,x )∈V; In−r 1 n 12. return U,V. 2.3 Algorithm complexity Let us not distinguish arithmetic and comparison operations. Let n be the number of independent variables, p be the number of elements in V at the current step, l be the number of v−,v ∈V, k be the number of v+,v ∈V, q be the number of inequalities already examined by the current step and m be the number of inequalities in total. Thecalculationofthevalueofl(x)hasthecomplexity2n−1. Ifthereexists such u ∈ U that l(u) 6= 0, than the conversion U → U⋆ and V → V⋆ requires − − thecalculationofn−1differencesofthekindofl(u )u −l(u )u withthetotal j j complexity 2·2n+1=4n+1. Therefore, the overallcomplexity of converting both lists is 2(n−1)(4n+1)∼8n2. Thecasewhennosuchu∈U existsisofbafflingcomplexity. Letusestimate thecomplexityofoneiterationofthiscaseasafunctionf(p,q,n). Forefficiency 6 reasons we suppose that all the values of l (x) ∈S for all v ∈ V are computed j beforehand in order to exclude repeated calculations. Selection of v− takes l operations. Next step — to select the pairs v−,v+ — requires 2kl more operations. The number of pairs reaches the maximum if k =l = p so let kl= p2 below. 2 4 For every pair v−,v+ we need to choose those inequalities l (x) for which j l (v−) = l (v+) is true. This requires 2q operations. Then we should examine j j every pair on whether p−2 elements of V do not zero all the chosen inequal- ities. Let the number of the chosen inequalities be as large as possible i.e., q. 2 Therefore, checking all the pairs have the complexity p2(p−2)q = p3q − p2q. 4 2 8 4 Letallthepairssatisfytheconditionsabove,thentheoverallcomplexityfor all new the elements v is 3p2. 4 In total, f(p,q,n)=pq(2n−1)+p+p2 +p3q −p2q +3p2 = 1p(p2q+10p− 2 2 8 4 4 8 2pq+16qn−8q+4)∼ 1p3q. 8 These intensive calculations are possible since p =3 because up to p6=2 0 there is onlyone (or noone) pairofgeneratorsforV. Therefore,upto one new generator is produced by algorithm for it to replace another. Aswasmentioned,numberp ofelementsv ∈V growsas pk−1+p2k−1 onev- k 2 4 eryk-thstep. Iteratingthisfunctiononecanseethatpk =pk(pk−1)=O(p02k−1), so the worst-case complexity of pure iteration of the most complicated part of algorithm is f(p ,m,n) = O(mp(2m−4)3/8) = O(mp23(m−4)) = O(mp23m) = 0 0 0 0 O(m323m). Practice shows that, in fact, such a terrible complexity is almost impossible to happen. There are many pairs rejected on every step. The number of pairs generally is not too large. Number of probe inequatilities for every pair usually lowerthan q. Usuallysystemsoffullrankareincompatibleforsufficientlylarge 2 numberofinequalities. Overallcomputationtimeneverthelessdependsonnfor the moderate systems. Despite of it, the data grows exponentially. 2.4 Practical experience We implemented abovementioned algorithms in Maple as one package motzkin burger consists of three user procedures: Conehull, MB and CheckSolutions. The first of these solves the problem to compute a set of generators for solution cone of system of inequalities. The second is the single Motzkin-Burger iteration. Last of these is the tool that allow user to check up the set of solutions on a correctness. Prototypes of these are Conehull(L,x,n,options) MB(L,U,V,x,n) CheckSolutions(L,S,x,n) 7 HereLis alistofhomogeneouspolynomialsofdegree1intermsofvariables xi, n is dimension of space of solutions; U is the base of linear space of cone of solutions, V is the set of generators of strongly convex cone in latter cone; S is any solution set. Parameter options, at this moment, may accept only one value, “as is”, what gives an instruction do not perform change of variables. BothConehullandMBreturnanexprseqthatconsistsoftwo2-dimensional lists which are abovementioned lists U and V. CheckSolutions returns an exprseqtoo,butitmightbyinterpretinanotherway: firstisthelistofvectors that are true solutions whereas the second is the list of uncorrect solutions. The timings presented in the table below are obtained in Maple 7 on com- puter based on Duron 700Mhz, 256 RAM. For every combination of (n,m,r) there was computed random system having these parameters, with sufficiently small integer coefficients. Here n is space dimension, m is the number of in- equalities in the system and r is the rank of the system. Values t and t are 1 2 times in seconds for solving the latter systems using or not optional parame- ter of Conehull procedure. All these systems are saved in attached to paper package codes text files. space dimen- number of in- rank,r Conehull, option Conehull, sion, n equalities, m "as is", t , sec t , sec 1 2 5 5 5 0.010 0.120 5 7 3 0.090 0.050 10 10 10 0.130 0.261 10 15 5 0.150 0.180 20 20 20 1.783 2.103 20 30 10 1.512 1.021 30 30 15 2.864 2.003 40 40 20 8.663 4.316 40 40 30 45.326 17.775 50 50 40 89.118 1816.392 50 50 45 73.766 1549.628 One can see that Conehull with option “as is” computes this examples with always increasing time (with rare exceptions). Without the option it be- have more complicated: for every fixed n and m the case of the systems of full rank or “almost” full rank may be computed more faster than in the case of small rank. Of course, the option slows down the performance (this is the con- sequence of inefficient Maple subs implementation we are using) starting from somedimension, butwe hope thatthe systemsoflargerdimensionwillbe com- puted more faster with this option. Nevertheless, to improve this performance bottleneck is the main aim of further work. 8 References [1] Fulton, W. Introduction to toric varieties. Princeton univ. press, 1993. [2] Chernikov, S.N. Linear inequalities. Moscow, Nauka, 1968. [3] Solodovnikov,A.S. Linear inequality systems. Moscow, Nauka, 1977. 9

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.