SOLVED FORMS FOR LINEAR CONSTRAINTS IN CLP LANGUAGES . Jean-Louis J. IMBERT Laboratoire d'Informatique de Clermont -LCB- Ferrand Les Cezeaux F -LCB- 63177 AUBIERE Cedex -LRB- France -RRB- Email : imbert@gia.univ-mrs.fr ABSTRACT Linear constraint solving in Constraint logic programming languages rests on rewriting constraints under syntaxic forms . These syntaxic forms are generally called solved forms , since a satisfiable linear constraint system can be rewritten under one of these forms , and reciprocally , a linear constraint system of one of these forms is satisfiable . This paper aims to present three different solved forms two of which are used in the main CLP languages with linear constraints CHIP , CLP -LRB- < -RRB- and Prolog III . The third form was proposed by JL . Imbert and P. Van Hentenryck in 1993 . We discuss the advantages and disadvantages of each and present the results of some comparative tests . 1 Introduction Constraint Logic Programming -LRB- CLP -RRB- is the combination of two programming paradigms : Logic programming and Constraint Programming . The power of Logic Programming rests on its relational form , and on non-determinism and unification . Unification is an equational theory . The pioneers are A. Robinson -LSB- 15 -RSB- and R. Kowalski & D. Kuehner -LSB- 8 -RSB- for the automatic deduction , and A. Colmerauer & P. Roussel -LSB- 1 -RSB- , and R. Kowalski -LSB- 9 , 10 -RSB- for the specific part of Logic Programming . Constraint Programming makes it possible to formulate problems in a declarative way . Constraints express relations between objects . The pioneers are D. Waltz -LSB- 21 -RSB- , A. Mackworth -LSB- 14 -RSB- , J.L. Lauri?ere -LSB- 12 , 13 -RSB- , G.L. Steele , G.J.Sussman -LSB- 17 , 18 -RSB- . Constraint Logic Programming aims at generalizing Logic Programming in order to extend it to domains distinct from herbrand universe , using more efficient computation mechanisms . Unification is replaced by Constraint Solving . From this , we need to find Constraint Solvers which on the one hand are able to incrementally process constraints , on the other hand fit with backtracking techniques . In 1986 , J. Jaffar & JL . Lassez -LSB- 6 -RSB- proposed a general theoretical structure for this type of language . In this article , we are interested in linear constraints . The main languages ensuing from this approach and processing linear constraints are CHIP -LSB- 3 -RSB- , CLP -LRB- < -RRB- -LSB- 7 -RSB- and Prolog III -LSB- 2 -RSB- . This paper presents and to compares three solved forms for linear constraint systems . These forms fit the incremental objective very well , and fit the efficiency and backtracking objectives to different degrees . Each of them has some advantages and some drawbacks . A solved form is a syntactic form such that if a constraint or a constraint system is satisfiable , then it can be rewritten under this form , and reciprocally , a constraint or a constraint system under this form is satisfiable . We are interested in constraints of the three following forms : = t -LRB- equation -RRB- , < = t -LRB- inequation -RRB- and < > t -LRB- disequation -RRB- , or equivalent forms , where t is for anxn + ... + a1x1 + a0 . In practice , each inequation is replaced by an equation with a new variable s called slack variable as follows : s = t and < = s. Generally , < = s is left understood . Since the slack variable s represents the inequation < = anxn + ... + a1x1 + a0 , there are as many slack variables as there are inequations in the system . Now , we have only two types of constraints -LRB- = and 6 =-RRB- , but we have two types of variables : arbitrary variables denoted by xi which can take any value , and slack variables denoted by sj which can take only non-negative values . Section 2 presents the three solved forms for the equations . Section 3 tackles the problems of disequations . Finally , in Section 4 , the results of some comparisons between these organisations are given along with general remarks on the advantages of each of them . In the sequel , a variable is said to be in a linear constraint if its coefficient is non-zero in this constraint . It is said to be k times in a linear constraint system when it exactly appears in k distinct constraints of this system . It is in a system if k is non-zero . We assume that each variable occurs at most once in each constraint . An equation is in solved form if it is written in one of the following two forms : or 8 >> >> > < >> >> > : xj = X i6 = j aixi + X k bksk + a0 sj = X k < > j bksk + a0 -LRB- 0 < = a0 -RRB- : The lefthand side -LRB- lhs -RRB- variable is said defined . Variables in the equation rhs member are called parameters . It is evident that a solution is obtained as soon as the parameter values are known . The solved form for a disequation is < > X i aixi + X k bksk + a0 with a0 < > when no variable is in the rhs member of the disequation . 2 Equations 2.1 Gauss-Jordan Solved Form Let a constraint system in a solved form and let a new constraint . The objective of a Constraint Solver is to produce a new constraint system in the same solved form . An equation system is in Gauss-Jordan Solved Form denoted by GJSF , if its constraints are all in solved form and each defined variable appears only once in the whole system . In practice , the system is divided into two sub-systems E and S. E is the sub-system of equations with Input : -LRB- E ; S -RRB- , an equation system in GJSF form . And C , an equation in solved form . Output : A flag Satisfiable which indicates whether the system is or is not satisfiable . And if so , the new system in FST form . begin 0 . Put the flag Satisfiable to true . 1 . In C , substitute for each variable defined in E its rhs member and simplify . 2 . If C is trivially satisfied , go to end . If C is trivially unsatisfied , put Satisfiable to false and go to end . 3 . If there is an arbitrary variable in C , rewrite C in solved form with an arbitrary variable as lhs member , then insert it into E and go to end . 4 . If there are only slack variables in C. Insert C into S using simplex procedure . If S is unsatisfiable , put Satisfiable to false , Else , replace in E each occurrence of a defined variable in S with its rhs member , and each occurrence of a fixed variable output by the simplex procedure with the value to which it is fixed . end Figure 1 : GJSF Algorithm to introduce a new equation at least one arbitrary variable in each . In this case , the defined variable must be an arbitrary variable . S is the sub-system of other equations . Hence , there are only slack variables in S . We will not speak about the S system . We assume that there exists a procedure named simplex which verifies that S is satisfiable , and when it is , outputs the system S in GJSF form and all the slack variables which are fixed . An arbitrary or slack variable is fixed if in every solution of the system , it has the same value . For more details on such a simplex procedure the reader is referred to -LSB- 19 -RSB- . It can be shown that the GJSF form is a solved form . In practice , constraints are assumed to be inputed one after another . Let -LRB- E ; S -RRB- 1 be a satisfiable system . We want to know if by adding in the new equation C , the new system is satisfiable . If it is , the new system must be in GJSF form . An algorithm adding a new equation in a system in GJSF form is given in Figure 1 . This type of solved form is used in CLP-languages such as CHIP and CLP -LRB- < -RRB- . Example 1 Consider the initial system -LRB- 1 -RRB- = ? x5 + x4 + x3 + 3 -LRB- 2 -RRB- = ? x5 + 2x3 ? x1 + 1 -LRB- 3 -RRB- = x3 ? x1 ? 3 -LRB- 4 -RRB- 2 < = x3 At the start E and S are empty . The equations -LRB- 1 -RRB- , -LRB- 2 -RRB- , -LRB- 3 -RRB- and the inequation -LRB- 4 -RRB- rewritten s1 = x3 ? 2 are incrementally added to E . The final system E is : 1comma is for the juxtaposition of constraints . 8 >> > < >> > : x5 = s1 + 6 x4 = 1 x3 = s1 + 2 x1 = s1 ? 1 One of the advantages of the GJSF form is that each fixed variable -LRB- arbitrary or slack2 -RRB- is automatically detected . We are interested in detecting fixed variables , firstly for arbitrary variables : on the one hand to simplify the constraint system , on the other hand , in systems which integrate non-linear delayed constraints to make their progressive linearisation possible , and secondly for slack variables : if the value is zero , to detect implicit equations and then the affine hull of the solution set , else , when the value is non-zero , the inequation associated with that slack variable is redundant . Among the drawbacks are the constant updating of constraints already processed in E . This makes the process heavy both in progress and in backtracking . 2.2 Gaussian Solved Form To overcome the drawbacks of the previous solved form , a triangular form is chosen . As a result , some variables are now both defined in one constraint and parameters in others . The objective is to work as little as possible while backtracking . This solved form is called Gaussian Solved Form and is denoted GSF . It is based on a total ordering of the variables . In this ordering , each slack variable is less than each arbitrary variable . In these problems , this variable will be the least variable . In the sequel , to complete our variable ordering , if o denotes the order relation , then we choose : i < = j implies xi o xj and si o sj . In an equation in GSF form , the defined variable is the greatest for the ordering o . It follows that when only slack variables appear in , < = a0 can be unsatisfied . An equation system is in GSF form if each of its equations is in GSF form and each defined variable is defined only once in the whole system . In practice , not as in the GJSF form , the equation system is kept as a whole in E. However , to determine the satisfiability of the sub-system of equations in which only slack variables appear , it is necessary to duplicate this sub-system in another sub-system S , and to verify the satisfiability of S using the simplex procedure . It is easy to show that the GSF form is a solved form when S is satisfiable . Figure 2 gives an algorithm which adds a new equation to a system in GSF form . The Prolog III language uses this type of organisation . Example 2 Consider the initial system of Example 1 At the start E is empty . By incrementally adding in E the constraints -LRB- 1 -RRB- , -LRB- 2 -RRB- , -LRB- 3 -RRB- and -LRB- 4 -RRB- , the system E becomes 8 >> > < >> > : x5 = x4 + x3 + 3 x4 = x3 ? x1 ? 2 x3 = x1 + 3 x1 = s1 ? 1 2these last ones by the simplex procedure Input : An equation system E in GSF form . A system S in GJSF form equivalent to the sub-system of equations of E in which only slack variables appear . An new equation C in solved form . Output : A flag named Satisfiable which indicates whether the system is satisfiable or not . And if so , the new system E in GSF form , and the new system S in GJSF form . begin 0 . Put flag Satisfiable to true . 1 . while the greatest variable of C is defined in E , replace it , then simplify and order C. 2 . If C is trivially satisfiable , go to end . If C is trivially unsatisfiable , put false in Satisfiable and go to end . 3 . Rewrite C in GSF form , then insert it in E. 4 . If only slack variables occur in , Duplicate C in C0 and Insert C0 in S using simplex procedure . If S is unsatisfiable , put false in Satisfiable , Else , for each fixed variable s found by the simplex procedure , insert the equation = ? s + c in E , only using steps 1 to 3 . c is value to which s is fixed . -LRB- If s is already defined , the two constraints are exchanged -RRB- end Figure 2 : GSF Algorithm to introduce a new equation Now , introduce the new constraint -LRB- 5 -RRB- = ? x3 + x2 ? 1 . It is transformed into = x2?x1 ? 4 . The variable x1 is not replaced because it is not the greatest . Hence , the new system is 8 >> >> > < >> >> > : x5 = x4 + x3 + 3 x4 = x3 ? x1 ? 2 x3 = x1 + 3 x2 = x1 + 4 x1 = s1 ? 1 The uncontestable advantage of such an organisation in GSF is to minimize the work to be done while backtracking . We might think that a number of substitutions are avoided when the process is in progress , but sometimes this is misleading as shown in Example 3 . Among the drawbacks are , firstly , that each fixed arbitrary variable is not detected , secondly , the same substitution can be repeatedly done , lastly it will be necessary to process some substitutions to output the final results . The first drawback can be overcome with a good ordering on variables , and with a daemon to supervise some variables . eq GSF system Nc Sum GJSF system Nc Updt Sum 1 x5 = x4 + x3 ? x1 + 1 x5 = x4 + x3 ? x1 + 1 2 x5 = x4 + x3 ? x1 + 1 x4 = x3 + x1 + 1 4 4 x5 = 2x3 + 2 x4 = x3 + x1 + 1 4 3 7 3 x5 = x4 + x3 ? x1 + 1 x4 = x3 + x1 + 1 x3 = ? x1 + 1 7 11 x5 = ? 2x1 + 4 x4 = 2 x3 = ? x1 + 1 5 4 16 4 x5 = x4 + x3 ? x1 + 1 x4 = x3 + x1 + 1 x3 = ? x1 + 1 x1 = 1 9 20 x5 = 2 x4 = 2 x3 = x1 = 1 5 2 23 5 x5 = x4 + x3 ? x1 + 1 x4 = x3 + x1 + 1 x3 = ? x1 + 1 x2 = ? 3x1 + 5 x1 = 1 9 29 x5 = 2 x4 = 2 x3 = x2 = 2 x1 = 1 2 25 Figure 3 : Example 3 Consider the initial system -LRB- 1 -RRB- = ? x5 + x4 + x3 ? x1 + 1 -LRB- 2 -RRB- = + x5 ? 2x4 + 2x1 -LRB- 3 -RRB- = + x5 + x4 ? 4x3 ? 2x1 ? 2 -LRB- 4 -RRB- = ? x5 + 2x4 + x3 ? 2 -LRB- 5 -RRB- = + x5 + x3 ? x2 The table of Figure 3 indicates the state of the system after the incremental introduction of constraints -LRB- 1 -RRB- , -LRB- 2 -RRB- , -LRB- 3 -RRB- , -LRB- 4 -RRB- and -LRB- 5 -RRB- . The first column indicates the number of the introduced constraint . Column Nc gives the number of additions to be computed on the new constraint and column Updt gives the number of additions to be computed to update the GJSF system . Column Sum gives the sum of the additions computed so far . We see that for this particular example , the advantage had at the beginning with the GSF method disappears by the end . This example has no proof value , it just indicates that it is not clear that one method is better than another . 2.3 Classification The Classification Solved form -LSB- 5 -RSB- denoted CSF aims at detecting all -LRB- arbitrary or slack -RRB- fixed variables , and to compute as few substitutions as possible . It divides the constraints into classes . As for the GJSF form , the equation system is composed of two sub-systems E and S. E is the sub-system of equations with at least one arbitrary variable in each . The defined variable must be an arbitrary variable . S is the sub-system of other equations in which appear only slack variables . The sub-system S is processed by the simplex procedure . Class Form of the equation invariants E0 xj = a0 fixed variable E1 xj = aixi + a0 E1 must be in GSF or in GJSF . xi can be defined in -LRB- E2 ; E4 -RRB- but not in -LRB- E0 ; E3 -RRB- . E2 xj = X i6 = j aixi + X k bksk + a0 rhs : at least one i and at least two variables E2 must be in GJSF . The xi 's can not be defined in E . The sk 's can be defined in S. E3 xj = bksk + a0 E3 must be in GJSF . sk can be defined in S. E4 xj = X k < > j bksk + a0 at least two k -LRB- E4 ; S -RRB- must be in GJSF . general invariant : the variables can be defined at most once in the whole system -LRB- E ; S -RRB- . Figure 4 : Classification of the equations In this solved form , E is divided into five classes E0 ; ... ; E4 as defined in Figure 4 . It can be shown that it is a solved form . Figure 5 gives an algorithm which adds a new equation to a system in CSF form . The technique used is to maintain the constraints in the simplest form , without losing sight of the fact that we want to detect all the fixed variables . For example , let the equation be xj = aixi + a0 . Then , the variable xj is fixed if and only if the variable xi is fixed . The same reasoning holds for equations of the form xj = aisi + a0 . As a result , as soon as an equation can be put into one of these forms , the substitution for the variables defined in E has not to be pushed beyond those defined in the classes E0 , E1 and E3 -LRB- substitutions from theses classes do not increase the number of variables in the new constraint -RRB- . Then , if at least one of the variables defined in the new constraint is already defined in E , its definition being more complex than the new , it is temporarily removed . The new constraint is inserted in its class . Then the removed constraint is added to the new system as if it is a new constraint . For more details on this solved form , the reader is referred to -LSB- 5 -RSB- . 3 Disequations Let -LRB- F ; D -RRB- be a linear constraint system , where F is the sub-system of the equations and D the sub-system of the disequations . According to -LSB- 11 -RSB- , such a system is satisfiable if and only if , for each disequation d , the system -LRB- F ; fdg -RRB- is satisfiable . Moreover , if F is satisfiable , the system -LRB- F ; fdg -RRB- is unsatisfiable if and only if by replacing in d every variable defined in F , by its rhs member , the disequation < > is obtained . Input : -LRB- E ; S -RRB- , an equation system in CSF . C a new equation in solved form . Output : A flag Satisfiable which indicates whether the system is satisfiable or not . And if so , the system increased by the new constraint , in CSF form . begin 0 . Put the flag Satisfiable to true . 1 . Replace in C each variable defined in -LRB- E0 ; E1 ; E3 -RRB- by its rhs , and simplify . 2 . While it is possible and the constraint is not in a form of E0 , E1 or E3 , replace in C each variable defined in E2 and E4 by its rhs , and simplify . 3 . If C is trivially satisfied , go to end . If C is trivially unsatisfied , put false in Satisfiable and go to end . 4 . If C can be put in one of the forms of E0 , E1 or E3 , and if in C occurs a variable xi defined in a constraint C0 of E2 or E4 , 4.1 . Remove C0 from E , 4.2 . Rewrite C in solved form with xi as lhs member , 4.3 . Insert C in its class and update if necessary , 4.4 . Insert C0 in the system using CSF algorithm . Then , go to end . 5 . If an arbitrary variable still occurs in C , rewrite C in solved form with that variable as lhs member , then insert it into E and go to end . 6 . If only slack variables occur in C. Insert C in S using simplex procedure . If S is unsatisfiable , put false in Satisfiable , Else , replace in E4 each slack variable defined in S by its rhs member , and replace in E each fixed variable given by the simplex procedure , by the value to which it is fixed . If necessary , change the constraints of classes . end Figure 5 : CSF Algorithm to introduce a new equation 3.1 Disequations and GJSF form Let -LRB- E ; S ; D -RRB- be a linear constraint system , where -LRB- E ; S -RRB- is an equation system , and D a disequation set . The system -LRB- E ; S ; D -RRB- is in GJSF form if the three following conditions are met : -LRB- E ; S -RRB- is in GJSF form , each disequation of D is in solved form , and no variable defined in -LRB- E ; S -RRB- occurs in D . In the GJSF form , the disequations are systematically updated , which implies a significant cost . Figure 6 gives an algorithm which adds a new disequation to a system in GJSF form . To take into account disequations when a new equation is added to the system , the algorithm of Figure 1 must be modified as follows : The system -LRB- E ; S ; D -RRB- is input in place of the system -LRB- E ; S -RRB- . The output system is of the same type of -LRB- E ; S ; D -RRB- , and step 3 and 4 are modified as indicated in Figure 7 . Input : -LRB- E ; S ; D -RRB- , a constraint system in GJSF , where -LRB- E ; S -RRB- is the set of equations , and D is the set of disequations . A new disequation d in solved form . Output : A flag named Satisfiable which indicates whether the system is satisfiable or not . If it is , the system increased by the new constraint in GJSF form . begin 0 . Put the flag Satisfiable to true . 1 . Replace in d each defined variable of -LRB- E ; S -RRB- by its rhs member , and simplify . 2 . If d is trivially satisfiable , go to end . If d is trivially unsatisfiable , put false in Satisfiable , Else insert d so modified in D. end Figure 6 : GJSF Algorithm to introduce a new disequation 3 . If there is an arbitrary variable in C , 3.1 . Rewrite C in solved form with an arbitrary variable as lhs member , 3.2 . Replace in D the new defined variable of C , and simplify . If during the substitution , a disequation becomes trivially satisfied , remove it . If during the substitution , a disequation becomes trivially unsatisfied , put false in Satisfiable , and go to end . 3.3 . Insert C into E , and go to end . 4 . If there are only slack variables in C. Insert C into S using simplex procedure . If S is unsatisfiable , put false in Satisfiable , Else , replace in E and D each occurrence of a defined variable in S with its rhs member , and each occurrence of a fixed variable output by the simplex procedure with the value to which it is fixed . If during the substitution a disequation becomes trivially satisfiable , remove it , else if during the substitution a disequation becomes trivially unsatisfiable , put false in Satisfiable . Figure 7 : Modifications in the GJSF equation Algorithm Example 4 Let E be the following system : 8 >> > < >> > : x8 = x3 + 2x2 + 6 x7 = 1 x6 = x3 ? x2 + 2 x4 = x1 ? 1 Input : -LRB- E ; D -RRB- , a constraint system in GSF form , where E is the set of equations , and D the set of disequations . A new disequation d in solved form . Output : A flag named Satisfiable which indicates whether the system is satisfiable or not . And if so , the system increased by the new constraint in GSF form . begin 0 . Put the flag Satisfiable to true . 1 . while the greatest variable of d is defined in E , replace it , simplify and order d. 2 . If d is trivially satisfiable , go to end . If d is trivially unsatisfiable , put false in Satisfiable , Else insert d as modified in D. end Figure 8 : GSF Algorithm to introduce a new disequation Let < > x8 + x5 + x4 be the new disequation to be introduced . Eliminate the variables x8 and x4 . This disequation becomes < > x5 + x3 + 2x2 + x1 + 5 , and is inserted in D. Now , let = 2x8 ? x3 ? 1 be a new equation to be introduced . Eliminate the variable x8 from the equation , and rewrite it in solved form : x3 = ? 4x2 ? 11 . The previous disequation then becomes < > x5 ? 2x2 + x1 ? 6 , and the equation x3 = ? 4x2 ? 11 is inserted in E. 3.2 Disequations and GSF form Let -LRB- E ; D -RRB- be a linear constraint system , where E is an equation system , and D is a disequation set . The system -LRB- E ; D -RRB- is in GSF form if the following three conditions are met : E is in GSF form , each disequation of D is in solved form and the greatest variable of each disequation is not defined in E . The objective is to do work only when necessary . Since when a variable is not defined it can take an infinite number of values giving a solution of E , there are an infinite number of solutions of a disequation having it as greatest variable . As a result , it suffices to put a device in place which makes it possible to supervise the moment when this variable becomes fixed . This device is called a daemon . Figure 8 gives an algorithm which introduces a new disequation d into -LRB- E ; D -RRB- . The algorithm of Figure 2 must be modified : the input system is -LRB- E ; D -RRB- , the output system is of the same type , and step 3 is modified as indicated in Figure 9 . Example 5 Take again Example 4 : Let < > x8 + x5 + x4 be the disequation to be introduced . Eliminate the variable x8 . This disequation becomes < > x5 + x4 + x3 + 2x2 + 6 , and is inserted in D , since x5 is not defined in E. Now , let = 2x8 ? x3 ? 1 be the equation to be introduced . Eliminate the variable x8 from this equation . and rewrite it : x3 = ? 4x2 ? 11 . Unlike the GJSF form , here , the previous disequation is not modified , and the equation x3 = ? 4x2 ? 11 is inserted in E. 3.3 Disequations and CSF form The CSF solved form aims at avoiding unnecessary substitutions . For example , let a constraint of D of the form < > aixi + a0 . While the variable xi is not fixed , this constraint 3 . 3.1 . Rewrite C in GSF form , then insert it into E. 3.2 . Replace in D the defined variable of C each time it is the greatest variable of a disequation of D , and simplify . For each modified disequation , continue to eliminate the greatest variable while it is defined in E . If during the substitution , a disequation becomes trivially satisfied , remove it . If during the substitution , a disequation becomes trivially unsatisfied , put false in Satisfiable , and go to end . Figure 9 : Modifications of the GSF equation Algorithm Class Form of the disequation invariants D0 < > a0 Trivial constraint D1 < > aixi + a0 xi must not be defined in E0 . It can be defined anywhere else . D2 < > X i aixi + X k bksk + a0 at least one i and at least two variables The xi 's can not be defined in E . The sk 's can be defined in S. D3 < > bksk + a0 sk can be defined in S , but can not be fixed . D4 < > X k bksk + a0 at least two k The sk 's can not be defined in S. Figure 10 : Classification of the disequations is satisfiable . Since this solved form detects all fixed variables , this type of disequation does not have to be modified while xi is not fixed , even if xi is defined . The same reasoning holds for constraints of the form < > aisi + a0 . Moreover , for constraints of the form < > P i aixi + P k bksk + a0 it is useless to substitute for slack variables while at least one arbitrary variable occurs in it . With the same definitions and notations as Figure 4 , the table of Figure 10 completes the classification for the disequations . The set D is divided into five classes D0 ; ... ; D4 of which only the last four are kept . The algorithm of Figure 11 describes the operations to be realized in order to introduce a new disequation d into -LRB- E ; S ; D -RRB- . When a new equation is inserted in one of the classes E1 to E4 , only class D2 is checked . If a constraint is inserted in E0 , then D1 and D2 are checked . When an equation changes class , there is no check except if it is in E0 . In this last case , only class D1 is checked . Now , if a constraint is inserted in the system S , after its insertion using the Input : -LRB- E ; S ; D -RRB- , a constraint system in CSF , where -LRB- E ; S -RRB- is a set of equations as defined in the CSF equation Algorithm , and D is the set of disequations . A disequation d in solved form . Output : A flag named Satisfiable which indicates whether the system is satisfiable or not . And if so , the system increased by the new constraint , in CSF form . begin 0 . Put the flag Satisfiable to true . 1 . Replace in d each defined variable of E0 by its rhs member , and simplify . 2 . while it is possible , and the disequation is not in a form of D1 or D3 , replace in d each defined variable of -LRB- E1 ; E2 ; E3 ; E4 -RRB- with its rhs member , and simplify . 3 . If d is of the form of D4 , and while it is possible and the disequation is not of the form of D3 , replace in d each defined variable of S by its rhs member . 4 . If d is trivially unsatisfiable , put false in Satisfiable , Else if not trivially satisfiable insert d so modified in its class . fin Figure 11 : CSF Algorithm to introduce a new disequation simplex algorithm , class D4 is updated , and each fixed variable is replaced in the whole system -LRB- E ; D -RRB- , by the value to which it is fixed . This can lead to new class changes . The modifications of Algorithm 5 implied by these considerations are evident and are found in the operations 4.4 , 4.5 , 5 and 6 . For a precise example too long for this short paper , the reader is referred to -LSB- 4 -RSB- . Note that for this form there exist improvements using the simplex procedure , which are detailed in -LSB- 5 -RSB- . These improvements make it possible to divide in half the cost of updating in the disequations at the output of the simplex Algorithm . 4 Final Remarks We have tested these solved forms -LSB- 20 , 16 -RSB- . We have used three meta-interpretors similar to that presented in -LSB- 4 -RSB- , one for each solved form . The simplex procedure used was the same for the three interpretors -LSB- 19 -RSB- , and the ordering over variables , also the same : the defined variable , when we have this choice , is always the greatest one . We have not taken into account the improvements proposed in -LSB- 5 -RSB- : \ Lazy dereferencing '' and \ Early detection of failure '' . The efficiency is measured by the number of additions processed in the substitutions , updatings included . The time to restore the system when backtracking has not been taken into account . In each case , the number of additions processed on the equations and the number of additions processed on the disequations have been counted separately . The tests have been carried out over sixteen small examples . We have brought the results together in the table of Figure 12 . Even if the number of tests is not great , and the examples rather small , we can see that ffl The CSF form often seems better than the GSF form . The scores are : for the disequations , 6 to 1 , and for the general constraints , 11 to 5 . GJSF GSF CSF Equa Diseq Total Equa Diseq Total Equa Diseq Total Badex 25743 22312 48055 5039 10040 15079 22640 5890 28530 Puzzle4 1354 1354 680 680 831 831 Puzzle8 327723 18931 346654 1232075 18931 1251006 329066 18931 347997 Fibonacci14 8063 8063 65056 65056 8063 8063 queens4 2262 531 2793 1043 631 1674 806 531 1337 queens8 275100 125379 400479 1078727 454356 1533083 348642 125379 474021 mortgage1 337 337 69 69 126 126 mortgage2 391 391 141 141 269 269 sequence 32 2 34 34 2 36 25 2 27 sendmory1 1050 822 1872 1039 2014 3053 1697 206 1903 sendmory2 12460 12641 25102 25930 37550 63480 10466 10351 20817 magicsquare1 35017 23348 58365 49650 40546 90196 24911 12516 37427 magicsquare2 14817 14817 28982 28982 14817 14817 affectation 1974 1974 1737 1737 1452 1452 list 180 94 274 142 69 211 200 88 288 sort 9436 435 9871 91275 435 91710 9436 435 9871 Figure 12 : Test results ffl The GJSF form is more often less efficient than the CSF form . The scores are for the disequations , to 5 , and for the general constraints , 4 to 9 . In this last case , 3 out of 4 give next to the same total -RRB- . ffl In each method , if we look proportionnally at the times -LRB- which are not in the table -RRB- to the number of additions , it can be noticed that when the number of backtracking increases , the GSF form becomes more efficient than the other methods . It would be good to continue these tests with more numerous and bigger examples . These tests are not significant enough to draw general and definitive conclusions . However , they provide some interesting indications . Of course , the GJSF form in CLP -LRB- < -RRB- and CHIP , and the GSF form in Prolog III , are used with a certain number of fittings which we have not taken into account here . These fittings again improve the efficiency of these forms . In the same way , the CSF form which does not work in any well known programming language can be fitted efficiently . Our goal has been simply to make comparisons between the various solved forms , and to draw attention to the different qualities of each of them . References 1 . A. Colmerauer , H. Kanoui , R. Pasero and P. Roussel . \ Un syst?eme de communication en fran?cais '' . Rapport pr?eliminaire de fin de contrat IRIA , Groupe Intelligence Artificielle , Facult?e des Sciences de Luminy , Universit?e Aix-Marseille II , France , October 1972 . 2 . A. Colmerauer . \ Opening the Prolog III Universe '' . In BYTE , August 1987 , p177 -LCB- 182 . 3 . M. Dincbas , P. Van Hentenryck , H. Simonis , A. Aggoun , T. Graf and F. Berthier . \ The Constraint Logic Programming Language CHIP '' . In Proceedings of the International Conference on Fifth Generation Computer Systems , Tokyo , Japan , December 1988 . 4 . JL . Imbert , J. Cohen and MD. . Weeger . \ An Algorithm for Linear Constraint Solving : Its Incorporation in a Prolog Meta-Interpreter for CLP '' . In Journal of Logic Programming . Special issue on Constraint Logic Programming . Vol . 16 , Nos 3 and 4 , July -LCB- August 1993 . 5 . JL . Imbert and P. Van Hentenryck . \ On the Handling of Disequations in CLP over Linear Rational Arithmetic '' . In F. Benhamou and A. Colmerauer , editors , Constraint Logic Programming : Selected Research , p 49 -LCB- 71 , MIT Press , Cambridge , USA . Sept 1993 . 6 . J.Jaffar , JL . Lassez . \ Constraint Logic Programming '' . Technical Report 86/73 . Dept. of computer science . Monash University -LRB- June 1986 -RRB- . 7 . J.Jaffar , S. Michaylov . \ Methodology and Implementation of a CLP System '' . In Proceedings of the Logic Programming Conference . Melbourne , 1987 . M.I.T. Press . 8 . R.A. Kowalski and D. Kuehner . \ Linear Resolution with Selection Function '' . Memo 78 , University of Edinburgh , School of Artificial Intelligence , 1971 . 9 . R.A. Kowalski . \ Predicate Logic as Programming Language '' . in Proceedings of IFIP 1974 , North Holland Publishing Company , Amsterdam , pp. 569-574 , 1974 . 10 . R.A. Kowalski and M. Van Emden . \ The Semantic of Predicate Logic as Programming Language '' . in JACM 22 , 1976 , pp. 733-742 . 11 . JL . Lassez and K. McAloon . \ Independance of Negative Constraints '' . In TAPSOFT 89 , Advanced seminar on Foundations of innovative Software development , Lecture Notes in Computer Science 351 , springer Verlag 1989 . 12 . JL . Lauri?ere . \ Un langage et un probl?eme pour ? enoncer et r?esoudre des probl?emes combinatoires '' . Ph.D. . Thesis , University Pierre et Marie Curie , Paris , May 1976 . 13 . JL . Lauri?ere . \ A Language and a Program for Stating and Solving Combinatorial Problems '' . In Artificial Intelligence , 10 -LRB- 1 -RRB- : p 29 -LCB- 127 , 1978 . 14 . A.K. Mackworth . \ Consistency in Networks of Relations '' . In AI Jour 8 -LRB- 1 -RRB- : p 99 -LCB- 118 , 1977 . 15 . J.A. Robinson . \ A Machine-Oriented Logic Based on the Resolution Principle '' . Journal of the ACM 12 , 1 , pp. 23-41 , January 1965 . 16 . N. Singer . \ R?esolutions incr?ementale de contraintes lin?eaires sur les nombres rationnels '' . m?emoire de DEA , GIA , Facult?e des sciences de Luminy , Marseille , 1993 . 17 . G.L. Steele . \ The Definition and Implementation of a Computer programming Language based on Constraints '' . Ph.D. . Thesis , MIT , USA . August 1980 . 18 . G.J. Sussman and G.L. Steele . \ CONSTRAINTS . A language for Expressing AlmostHierarchical Descriptions '' In AI Journal , 14 -LRB- 1 -RRB- , 1980 . 19 . P. Van Hentenryck and T. Graf . Standard Forms for Rational Linear Arithmetics in Constraint Logic Programming . Annals of Mathematics and Artificial Intelligence , 1992 . 20 . JF . Verrier . \ R?esolutions num?eriques en programmation logique par contraintes '' . m?emoire de DEA , GIA , Facult?e des sciences de Luminy , Marseille , 1992 . 21 . D. Waltz . \ Generating Semantic Descriptions from Drawings of Scenes with Shadows '' . Technical Report AI271 , MIT , MA , USA . November 1972 . Contents 1 Introduction 1 2 Equations 2 2.1 Gauss-Jordan Solved Form : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2 2.2 Gaussian Solved Form : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 4 2.3 Classification : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 6 3 Disequations 7 3.1 Disequations and GJSF form : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 8 3.2 Disequations and GSF form : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 10 3.3 Disequations and CSF form : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 10 4 Final Remarks 12 References 13

B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

constraint logic programming
solved forms


Scheduling

Algorithms

for

a

Chain-like

Task

System

Chan

Chi-Lok

Gilbert

Youngy

The

Chinese

University

of

Hong

Kong

March

Abstract

The

optimal

allocation

of

a

chain-like

task

system

on

the

chain-like

network

computers

was

first

presented

by

Bokhari

with

time

complexity

O

-LRB-

-RRB-

-LSB-

-RSB-

where

m

and

n

denote

the

number

of

modules

and

the

number

of

processors

respectively

Sheu

and

Chiang

improved

it

and

gave

an

O

-LRB-

minfm

-RRB-

algorithm

-LSB-

-RSB-

Hsu

had

further

developed

a

two

phase

approach

with

the

worst

case

time

complexity

of

O

-LRB-

m

-LRB-

-RRB-

-RRB-

-LSB-

-RSB-

where

denotes

the

number

of

the

remaining

modules

after

the

merge

phase

For

all

of

these

papers

of

them

answers

the

decision

version

of

this

problem

that

is

whether

there

exists

a

schedule

with

schedule

length

less

than

a

given

deadline

In

this

paper

two

algorithms

are

presented

The

first

one

answers

the

decision

problem

and

gives

a

feasible

schedule

if

there

exists

one

It

is

an

optimal

algorithm

with

time

complexity

of

O

-LRB-

m

-RRB-

The

second

one

finds

an

optimal

schedule

in

O

-LRB-

m

log

-RRB-

time

using

the

first

algorithm

It

is

shown

that

our

approach

is

more

efficient

than

Hsu

's

one

if

-LRB-

plog

n

-RRB-

Furthermore

our

algorithm

returns

an

optimal

schedule

which

uses

the

minimal

number

of

processors

Introduction

The

problem

we

investigate

in

this

paper

is

the

allocation

of

a

chain-like

task

system

on

the

chain-like

network

computers

which

was

first

presented

by

Bokhari

-LSB-

-RSB-

A

chain-like

task

system

consists

of

m

modules

scheduled

on

n

processors

Each

module

is

associated

with

an

execution

time

and

each

module

communicates

with

its

neighboring

modules

with

a

communication

cost

-LRB-

Fig.

-RRB-

Fig.

A

chain-like

task

system

E-mail

clchan@cs.cuhk.hk

yE-mail

young@cs.cuhk.hk

A

typical

application

of

chain-like

task

system

is

pipelining

system

with

an

essentially

unending

series

of

data

The

maximum

rate

of

processing

is

now

determined

by

the

processor

that

takes

the

longest

amount

of

time

-LRB-

schedule

length

-RRB-

to

perform

its

tasks

-LRB-

the

bottleneck

processor

-RRB-

The

optimal

allocation

problem

is

to

find

a

schedule

in

which

the

bottleneck

processor

has

the

minimal

execution

time

Bokhari

had

presented

an

algorithm

with

time

complexity

O

-LRB-

-RRB-

-LSB-

-RSB-

Sheu

and

Chiang

showed

that

a

more

general

assignment

problem

can

be

solved

with

time

complexity

O

-LRB-

minfm

-RRB-

-LSB-

-RSB-

Hsu

proposed

an

approach

which

is

composed

of

two

phases

merge

phase

and

assignment

phase

-LSB-

-RSB-

The

time

complexity

of

the

merge

phase

is

O

-LRB-

m

-RRB-

and

the

overall

complexity

is

O

-LRB-

m

-LRB-

-RRB-

-RRB-

where

denotes

the

number

of

the

remaining

modules

after

the

merge

phase

-LRB-

m

-RRB-

These

three

algorithms

use

a

similar

approach

a

layered

graph

method

In

this

paper

we

propose

an

O

-LRB-

m

-RRB-

algorithm

for

answering

whether

there

exists

a

schedule

with

schedule

length

no

greater

than

a

constant

K.

Furthermore

we

propose

another

approach

for

finding

an

optimal

schedule

in

O

-LRB-

m

log

-RRB-

time

The

remainder

of

this

paper

is

organized

as

follows

section

states

the

problem

assumptions

and

notations

used

in

this

paper

In

section

an

optimal

greedy

algorithm

for

the

decision

problem

is

presented

Section

proposes

another

approach

for

finding

an

optimal

schedule

Finally

we

draw

some

concluding

remarks

in

the

last

section

Problem

Assumptions

and

Notations

Definition

A

chain-like

system

consists

of

m

modules

tm

scheduled

on

n

processors

Execution

time

of

module

i

is

denoted

as

Ei

and

communication

time

of

adjacent

modules

i

and

i

is

denoted

as

Ci

i

-LRB-

i

m

-RRB-

All

of

execution

times

and

communication

times

are

positive

except

that

and

Cm

m

equal

zero

Adjacent

modules

must

be

assigned

to

adjacent

processors

or

the

same

processor

which

is

called

contiguity

constraint

-LSB-

-RSB-

If

adjacent

modules

are

assigned

to

the

same

processor

their

communication

-LRB-

intra-communication

-RRB-

time

is

assumed

to

be

zero

The

elapsed

time

required

to

complete

the

execution

and

communication

for

a

module

-LRB-

may

be

a

sequence

of

adjacent

modules

-RRB-

on

a

processor

is

called

completion

time

The

completion

time

of

a

module

i

denoted

as

CMPi

is

equal

to

Ci

i

Ei

Ci

i

The

completion

time

of

modules

i

i

j

denoted

as

CMPi?i

j

is

equal

to

Ci

i

Pjk

i

Ek

Cj

j

For

a

schedule

S

of

m

modules

on

n

processors

if

tj

tj

tk

are

modules

scheduled

on

processor

i

j

k

m

and

i

n

CPi

-LRB-

S

-RRB-

denotes

the

completion

time

of

processor

i

ie

CPi

-LRB-

S

-RRB-

CMPj

k

The

schedule

length

of

a

schedule

L

-LRB-

S

-RRB-

is

defined

as

the

maximumcompletion

time

of

all

processors

in

S

ie

L

-LRB-

S

-RRB-

maxifCPi

-LRB-

S

-RRB-

g

A

schedule

is

said

feasible

if

it

satisfies

the

contiguity

constraint

An

optimal

schedule

S

ffi

is

a

feasible

schedule

with

minimal

schedule

length

ie

L

-LRB-

S

ffi

-RRB-

L

-LRB-

-RRB-

where

is

any

possible

feasible

schedule

Two

modules

ti

and

ti

are

mergeable

if

the

completion

time

of

the

merged

module

is

no

greater

than

the

maximum

completion

time

of

ti

and

ti

-LRB-

Fig.

-RRB-

module

Fig.

Merge

two

modules

ie

CMPi?i

maxfCMPi

CMPi

g

Two

modules

ti

and

ti

are

un-mergeable

if

they

are

not

mergeable

ie

Ci

i

Ei

Ci

i

and

Ci

i

Ei

Ci

i

An

Algorithm

for

the

Decision

Problem

In

this

section

we

present

an

algorithm

for

answering

whether

there

exists

a

schedule

S

such

that

the

schedule

length

of

S

L

-LRB-

S

-RRB-

is

less

than

or

equal

to

K

a

given

constant

-LRB-

called

a

decision

problem

-RRB-

The

following

lemmas

are

useful

for

the

proof

of

correctness

of

our

algorithm

Lemma

For

un-mergeable

modules

in

a

chain-like

task

system

i

p

j

CMPi?i

j

CMPp?p

j

Proof

By

induction

on

p

for

any

i

p

j

For

p

i

CMPp?p

j

CMPi?i

j

ie

it

is

true

for

p

i

Assume

it

is

true

for

p

k

j

ie

CMPi?i

j

CMPk?k

j

For

p

k

CMPk

j

CMPk

j

Ck

k

Ek

Ck

k

CMPk

j

-LRB-

Ck

k

Ck

k

Ek

-RRB-

CMPi

j

-LRB-

induction

hypothesis

-RRB-

ie

It

is

true

for

p

k

So

it

is

true

for

i

p

j

by

induction

Lemma

For

un-mergeable

modules

in

a

chain-like

task

system

i

p

j

CMPi?i

j

CMPi?i

p

Proof

Similar

to

the

proof

of

Lemma

Definition

A

schedule

is

called

a

feasible

length-K

schedule

if

L

-LRB-

S

-RRB-

i

nfCPi

-LRB-

S

-RRB-

g

K

where

K

is

an

integer

constant

The

following

algorithm

decides

whether

there

exists

a

feasible

length-K

schedule

The

input

modules

are

assumed

un-mergeable

It

schedules

as

many

modules

on

a

processor

as

possible

successively

and

the

completion

time

of

each

processor

is

no

greater

than

K

If

all

modules

can

be

scheduled

properly

it

returns

Yes

and

the

corresponding

schedule

otherwise

it

returns

No

Algorithm

-LRB-

Greedy

Algorithm

-RRB-

Input

un-mergeable

modules

in

a

chain-like

task

system

with

their

execution

times

and

communication

times

n

processors

and

K

Z

Output

Yes

and

gives

a

feasible

length-K

schedule

S

if

there

exists

one

otherwise

No

-LRB-

-RRB-

j

CP

j

denotes

the

processor

no

-LRB-

-RRB-

for

i

to

for

each

module

i

-LRB-

-RRB-

if

CP

Ei

Ci

i

Ci

i

K

if

we

can

not

schedule

ti

on

pj

-LRB-

-RRB-

if

j

n

no

processor

left

-LRB-

-RRB-

return

No

-LRB-

-RRB-

else

-LRB-

-RRB-

CP

Ci

i

Ei

Ci

i

CP

CMPi

-LRB-

-RRB-

if

-LRB-

CP

K

-RRB-

schedule

length

K

-LRB-

-RRB-

return

No

-LRB-

-RRB-

j

j

-LRB-

-RRB-

else

-LRB-

-RRB-

CP

CP

Ei

Ci

i

Ci

i

schedule

ti

on

pj

-LRB-

-RRB-

S

-LSB-

i

-RSB-

j

-LRB-

-RRB-

return

Yes

and

S

For

the

above

algorithm

CP

is

the

current

completion

time

of

processor

j

and

S

is

an

array

such

that

S

-LSB-

i

-RSB-

j

if

ti

is

scheduled

on

processor

j

Since

each

module

is

examined

only

once

and

there

are

modules

-LRB-

line

-RRB-

the

time

complexity

of

Algorithm

is

O

-LRB-

-RRB-

For

a

mergeable

chain-like

task

system

with

m

modules

O

-LRB-

m

-RRB-

time

is

needed

for

merging

-LSB-

-RSB-

and

O

-LRB-

-RRB-

-LRB-

m

-RRB-

time

is

used

for

Algorithm

the

overall

time

complexity

is

O

-LRB-

m

-RRB-

The

following

example

illustrates

the

above

algorithm

for

a

chain-like

task

system

with

modules

and

K

equals

Figure

Example

for

Algorithm

Theorem

For

un-mergeable

modules

scheduled

on

n

processors

Algorithm

returns

a

feasible

length-K

schedule

Sn

iff

there

exists

a

feasible

length-K

schedule

for

the

modules

on

n

processors

Proof

Part

-RRB-

part

If

Algorithm

answers

Yes

and

returns

Sn

it

is

obvious

that

Sn

is

a

feasible

length-K

schedule

because

we

schedule

tj

on

processor

i

iff

the

completion

time

of

processor

i

is

less

than

or

equal

to

K

j

ie

max

i

nfCPi

-LRB-

Sn

-RRB-

g

K

we

can

let

Sn

and

i

nfCPi

-LRB-

-RRB-

g

i

nfCPi

-LRB-

Sn

-RRB-

g

K

Part

-LRB-

part

Suppose

there

exists

a

feasible

length-K

schedule

and

Sn

is

the

schedule

obtained

from

Algorithm

-LRB-

suppose

we

do

not

know

whether

Algorithm

answers

Yes

or

No

and

Sn

may

not

be

a

feasible

length-K

schedule

-RRB-

We

have

to

prove

that

i

nfCPi

-LRB-

-RRB-

g

K

-RRB-

i

nfCPi

-LRB-

Sn

-RRB-

g

K

by

induction

on

n

the

number

of

processor

For

n

there

is

only

one

processor

so

that

all

modules

are

scheduled

on

processor

in

By

Algorithm

we

always

schedule

as

many

modules

as

possible

on

each

processor

so

that

and

max

i

fCPi

-LRB-

-RRB-

g

max

i

fCPi

-LRB-

-RRB-

g

K

So

it

is

true

for

n

Assume

it

is

true

for

n

k

ie

if

there

exists

a

feasible

length-K

schedule

then

Algorithm

returns

a

feasible

length-K

schedule

Sk

i

kfCPi

-LRB-

-RRB-

g

K

-RRB-

i

kfCPi

-LRB-

Sk

-RRB-

g

K

For

n

k

let

is

any

feasible

length-K

schedule

and

Sk

is

the

schedule

returned

by

Algorithm

Firstly

for

max

i

k

fCPi

-LRB-

-RRB-

g

K

We

compare

the

modules

scheduled

on

processor

in

and

Sk

Let

and

be

the

number

of

modules

scheduled

on

processor

in

and

Sk

respectively

Case

For

processor

the

schedules

in

and

Sk

are

the

same

ie

-LRB-

Sk

-RRB-

-LRB-

-RRB-

K

-LRB-

i

-RRB-

Consider

the

modules

scheduled

on

processor

to

k

for

both

schedules

they

schedule

the

same

modules

on

k

processors

By

induction

hypothesis

i

k

fCPi

-LRB-

-RRB-

g

K

-RRB-

i

k

fCPi

-LRB-

Sk

-RRB-

g

K

-LRB-

ii

-RRB-

By

-LRB-

i

-RRB-

and

-LRB-

ii

-RRB-

max

i

k

fCPi

-LRB-

Sk

-RRB-

g

K

Case

In

this

case

for

we

can

re-schedule

some

modules

-LRB-

-RRB-

on

processor

and

remove

these

modules

from

some

other

processors

If

there

are

some

processors

becoming

no

module

scheduled

on

them

after

re-scheduling

we

can

relabel

the

processor

so

that

the

contiguity

constraint

is

not

violated

We

call

the

resultant

schedule

The

completion

time

of

processor

in

is

less

than

or

equal

to

K

because

we

can

schedule

modules

on

processor

by

Algorithm

only

if

K.

For

compared

with

the

number

of

module

remains

in

processor

j

j

k

is

reduced

-LRB-

because

some

modules

or

are

removed

-RRB-

By

Lemma

the

completion

time

of

processor

j

in

is

less

than

or

equal

to

that

in

ie

CPj

-LRB-

-RRB-

CPj

-LRB-

-RRB-

j

k

and

max

i

k

fCPi

-LRB-

-RRB-

g

max

i

k

fCPi

-LRB-

-RRB-

g

K

So

is

also

a

feasible

length-K

schedule

and

the

number

of

modules

scheduled

on

processor

is

equal

to

By

case

Sk

is

a

feasible

length-K

schedule

as

well

Case

In

this

case

to

are

scheduled

on

processor

in

Sk

and

to

are

scheduled

on

processor

in

where

However

can

not

be

scheduled

on

processor

by

Algorithm

-LRB-

line

-RRB-

so

K

By

Lemma

-LRB-

-RRB-

K

which

is

contradictory

to

the

fact

that

is

a

feasible

length-K

schedule

The

case

never

occurs

By

case

and

if

is

a

feasible

length-K

schedule

Sk

is

a

feasible

length-K

schedule

as

well

ie

it

is

true

for

n

k

By

induction

on

n

Theorem

is

true

for

any

number

of

processor

An

Algorithm

for

Optimal

Schedule

In

the

previous

section

we

present

an

O

-LRB-

m

-RRB-

algorithm

for

deciding

the

existence

of

a

feasible

length-K

schedule

Now

we

can

apply

this

algorithm

to

find

an

optimal

schedule

Algorithm

It

is

obvious

that

the

schedule

length

of

any

schedule

is

equal

to

the

longest

completion

time

of

the

n

processors

ie

the

completion

time

of

the

bottleneck

processor

We

can

construct

a

set

which

contains

all

possible

values

of

schedule

length

By

Hsu

's

result

we

can

only

consider

a

chain-like

task

system

with

un-mergeable

modules

only

-LSB-

-RSB-

and

fCMPi

j

i

j

By

Hsu

's

result

for

un-mergeable

modules

scheduled

on

n

processors

if

n

we

can

obtain

an

optimal

schedule

by

assigning

one

merged

module

to

one

processor

-LSB-

-RSB-

On

the

other

hand

if

n

it

can

be

shown

that

for

any

optimal

schedule

there

exists

a

bottleneck

processor

such

that

at

most

n

modules

have

been

scheduled

on

it

As

a

result

we

can

construct

a

set

which

covers

all

possible

optimal

schedule

lengths

fCMPi

j

i

j

and

j

i

ng

where

covers

all

possible

minimal

schedule

length

and

j?j

X

i

n

i

X

i

i

n

X

i

i

O

-LRB-

-RRB-

Now

we

can

find

the

median

of

the

elements

in

and

apply

Algorithm

as

a

feasibility

test

Then

we

can

eliminate

half

of

the

elements

in

Repeat

the

steps

until

there

is

only

one

element

in

and

this

is

the

optimal

schedule

length

The

following

algorithm

summarize

the

above

method

Algorithm

Input

m

modules

in

a

chain-like

task

system

with

their

execution

times

and

communication

times

n

processors

Output

An

optimal

schedule

S.

-LRB-

-RRB-

merge

the

m

modules

into

un-mergeable

modules

by

Hsu

's

algorithm

-LRB-

-RRB-

if

n

-LRB-

-RRB-

return

S

where

S

-LSB-

i

-RSB-

i

i

-LRB-

-RRB-

construct

a

set

where

fCMPi

j

i

j

and

j

i

ng

-LRB-

-RRB-

find

the

median

of

the

elements

in

-LRB-

-RRB-

apply

Algorithm

with

the

median

as

the

deadline

K

-LRB-

-RRB-

if

Algorithm

returns

Yes

-LRB-

-RRB-

remove

all

elements

which

are

larger

than

K

in

-LRB-

-RRB-

otherwise

-LRB-

-RRB-

remove

all

elements

which

are

no

greater

than

K

in

-LRB-

-RRB-

if

j

j

-LRB-

-RRB-

repeat

step

-LRB-

-RRB-

return

the

corresponding

schedule

S

Number

of

Processor

Used

in

the

Optimal

Schedule

The

optimal

schedule

obtained

by

our

algorithm

Algorithm

can

be

shown

to

use

the

minimal

number

of

processors

By

Hsu

's

algorithm

-LSB-

-RSB-

all

n

processors

must

be

utilized

The

following

diagrams

show

the

difference

-LRB-

-RRB-

:-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

Optimal

Schedule

return

by

Hsu

's

AlgorithmOptimal

Schedule

return

by

Searching

Based

Algorithm

Figure

Example

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

Optimal

Schedule

return

by

Hsu

's

AlgorithmOptimal

Schedule

return

by

the

Searching

Based

Algorithm

Figure

Example

In

the

first

example

there

is

one

large

merged

module

-LRB-

the

module

-RRB-

so

that

more

than

n

modules

can

be

scheduled

on

other

processor

-LRB-

-RRB-

In

the

second

example

there

exists

an

optimal

schedule

such

that

there

are

more

than

one

bottleneck

processors

In

this

case

our

algorithm

may

give

an

optimal

schedule

using

less

than

n

processors

Complexity

Analysis

The

time

complexity

of

Algorithm

consists

of

several

parts

Firstly

O

-LRB-

m

-RRB-

time

for

merging

the

modules

-LRB-

line

-RRB-

For

the

construction

of

-LRB-

line

-RRB-

we

need

O

-LRB-

-RRB-

time

For

step

to

we

can

find

the

median

of

N

elements

in

O

-LRB-

N

-RRB-

-LSB-

-RSB-

-LSB-

-RSB-

-LSB-

-RSB-

The

feasibility

test

Algorithm

takes

O

-LRB-

-RRB-

time

and

we

can

remove

the

elements

-LRB-

line

-RRB-

in

O

-LRB-

N

-RRB-

time

Let

X

-LRB-

N

-RRB-

be

the

time

taken

for

step

to

X

-LRB-

N

-RRB-

X

-LRB-

N

-RRB-

N

X

-LRB-

-RRB-

O

-LRB-

log

-RRB-

As

a

result

the

total

time

complexity

of

Algorithm

is

T

-LRB-

m

n

-RRB-

O

-LRB-

m

log

-RRB-

The

time

complexity

of

Hsu

's

algorithm

is

-LSB-

-RSB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

Comparison

between

the

two

algorithms

If

n

Algorithm

is

identical

to

Hsu

's

algorithm

and

the

time

complexity

is

O

-LRB-

m

-RRB-

If

n

let

n

f

-LRB-

n

-RRB-

f

-LRB-

n

-RRB-

for

all

n

T

-LRB-

m

n

-RRB-

O

-LRB-

m

log

-LRB-

n

-RRB-

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

Case

f

-LRB-

n

-RRB-

o

-LRB-

plog

n

-RRB-

-RRB-

O

-LRB-

n

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

n

log

n

nf

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

n

log

n

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

n

log

n

-RRB-

T

-LRB-

m

n

-RRB-

Case

O

-LRB-

logn

-RRB-

f

-LRB-

n

-RRB-

-LRB-

plog

n

-RRB-

-RRB-

O

-LRB-

n

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

n

log

n

nf

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

n

log

n

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

n

log

n

-RRB-

T

-LRB-

m

n

-RRB-

Case

O

-LRB-

n

-RRB-

f

-LRB-

n

-RRB-

-LRB-

logn

-RRB-

-RRB-

O

-LRB-

n

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

n

log

n

nf

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

nf

-LRB-

n

-RRB-

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

nf

-LRB-

n

-RRB-

-RRB-

T

-LRB-

m

n

-RRB-

Case

f

-LRB-

n

-RRB-

-LRB-

n

-RRB-

-RRB-

O

-LRB-

f

-LRB-

n

-RRB-

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

f

-LRB-

n

-RRB-

log

f

-LRB-

n

-RRB-

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

T

-LRB-

m

n

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

T

-LRB-

m

n

-RRB-

For

case

and

T

-LRB-

m

n

-RRB-

T

-LRB-

m

n

-RRB-

Combining

these

cases

T

-LRB-

m

n

-RRB-

T

-LRB-

m

n

-RRB-

if

f

-LRB-

n

-RRB-

-LRB-

plogn

-RRB-

In

other

words

our

algorithm

is

asymptotically

better

than

Hsu

's

algorithm

if

m

n

-LRB-

plog

n

-RRB-

Conclusion

In

this

paper

two

algorithms

are

presented

for

answering

the

decision

problem

and

optimally

assigning

a

chain-like

task

system

on

a

chain-like

network

computers

The

time

complexity

of

the

algorithm

for

the

decision

problem

is

O

-LRB-

m

-RRB-

where

m

is

the

number

of

modules

in

the

system

This

is

an

optimal

algorithm

which

returns

a

feasible

schedule

if

there

exists

one

For

optimal

schedule

Hsu

has

improved

the

Sheu

and

Chiang

's

algorithm

-LSB-

-RSB-

and

solved

this

problem

by

a

two

phase

algorithm

with

time

complexity

O

-LRB-

m

-LRB-

n

-RRB-

-RRB-

if

n

where

is

the

number

of

modules

after

the

merge

phase

-LSB-

-RSB-

If

n

the

time

complexity

is

O

-LRB-

m

-RRB-

All

of

the

existing

algorithms

use

a

layered

graph

approach

In

this

paper

we

use

a

new

approach

which

is

based

on

a

searching

strategy

to

find

an

optimal

schedule

The

algorithm

-LRB-

Algorithm

-RRB-

presented

in

this

paper

is

identical

to

Hsu

's

algorithm

if

n.

For

n

the

time

complexity

is

O

-LRB-

m

log

-RRB-

In

the

case

of

n

-LRB-

plog

n

-RRB-

our

algorithm

is

more

efficient

than

Hsu

's

algorithm

Furthermore

the

optimal

schedule

obtained

by

our

algorithm

uses

the

minimal

number

of

processors

References

-LSB-

-RSB-

Shahid

H.

Bokhari

Partitioning

problems

in

parallel

pipelined

and

distributed

computing

IEEE

Transactions

on

Computers

-LCB-

January

-LSB-

-RSB-

J.P.

Sheu

and

Z.F.

Chaing

Efficient

allocation

of

chain-like

task

on

chain-like

network

computers

Information

Processing

Letters

-LCB-

-LSB-

-RSB-

C.C.

Hsu

A

two-phase

approach

for

the

optimal

assignment

of

a

chain-like

task

on

a

chain-like

network

computer

Technical

report

National

Taiwan

Institute

of

Technology

-LSB-

-RSB-

Manuel

Blum

Robert

W.

Floyd

Vaughan

Pratt

Rivest

Ronald

L.

and

Robert

E.

Tarjan

Time

bounds

for

selection

Journal

of

Computer

and

System

Science

-LRB-

-RRB-

-LCB-

-LSB-

-RSB-

C.A.R.

Hoare

Algorithm

-LRB-

partition

-RRB-

and

algorithm

-LRB-

find

-RRB-

Communication

of

ACM

-LRB-

-RRB-

-LCB-

-LSB-

-RSB-

Robert

W.

Floyd

and

Ronald

L.

Rivest

Expected

time

bounds

of

selection

Communication

of

ACM

-LRB-

-RRB-

-LCB-

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O B I O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O B I O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O B I O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O B I O O O O O O O O B I O O O O O O O O B I O O B I O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

bottleneck processor
completion time
contiguity constraint
layered graph
merged module
optimal schedule
schedule length

chain-like task system
feasible length-k schedule
un-mergeable modules