Two Problems - Two Solutions: One System - ECLiPSe. Mark Wallace and Andre Veron. April 1993

Similar documents
These advantages are exemplied by a scheduling workbench called Oz Scheduler [13]. This workbench makes use of dierent OR algorithms for propagation a

Modelling Combinatorial Problems for CLP(FD+R) Henk Vandecasteele. Department of Computer Science, K. U. Leuven

Modelling and Solving Fleet Assignment in a. Flexible Environment. Hani El Sakkout. IC-Parc, Imperial College, London SW7 2AZ.

or X::3#6 X::4#10 [] Y::1000#1050 end

Outline. A Puzzle Example. Outline DMP204 SCHEDULING, TIMETABLING AND ROUTING

Hybrid Constraint Solvers

A Hybrid Algorithm for Compiling Equality. Constraints and its Implementation. Department of Computer and Information Science

The element the node represents End-of-Path marker e The sons T

size, runs an existing induction algorithm on the rst subset to obtain a rst set of rules, and then processes each of the remaining data subsets at a

Chalmers University of Technology. Without adding any primitives to the language, we dene a concurrency monad transformer

With the advent of cost-eective massively parallel computers, researchers

those planners manage to produce correct solutions for a quite large number of problems into simple and static domains, they can not cope with most of

Modelling Producer/Consumer Constraints

Constraint Optimisation Problems. Constraint Optimisation. Cost Networks. Branch and Bound. Dynamic Programming

M. I. T. Articial Intelligence Laboratory. 545 Technology Square Room NE43{412. Cambridge MA internet:

Path Consistency Revisited. Moninder Singh. University of Pennsylvania. Philadelphia, PA

Algebraic Properties of CSP Model Operators? Y.C. Law and J.H.M. Lee. The Chinese University of Hong Kong.

Ecient Implementation of Sorting Algorithms on Asynchronous Distributed-Memory Machines

has to choose. Important questions are: which relations should be dened intensionally,

Eddie Schwalb, Rina Dechter. It is well known that all these tasks are NP-hard.

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

2 Keywords Backtracking Algorithms, Constraint Satisfaction Problem, Distributed Articial Intelligence, Iterative Improvement Algorithm, Multiagent Sy

On the Complexity of Interval-Based Constraint. Networks. September 19, Abstract

Ecient Implementation of Sorting Algorithms on Asynchronous Distributed-Memory Machines

of m clauses, each containing the disjunction of boolean variables from a nite set V = fv 1 ; : : : ; vng of size n [8]. Each variable occurrence with

A Two-stage approach for an optimum solution of the car assembly scheduling problem. Part 2. CLP solution and real-world example

Kalev Kask and Rina Dechter. Department of Information and Computer Science. University of California, Irvine, CA

Journal of Global Optimization, 10, 1{40 (1997) A Discrete Lagrangian-Based Global-Search. Method for Solving Satisability Problems *

Title of Publication: Encyclopedia of Cognitive Science. Article title: Constraint Satisfaction. Article code: 26. Authors: Rina Dechter

An Efficient Arc Consistency Algorithm for a Class of CSP Problems

Building Industrial CHIP Applications from Reusable Software Components

Concurrent Programming Lecture 3

The topic of search has been at the heart of AI since GPS [97]. Inuential ideas were generate and test [56], branch and bound [79], the A* algorithm [

Transport protocols are of practical. login, le transfer, and remote procedure. calls. will operate on and therefore are generally


Local consistency for ternary numeric constraints. Boi Faltings and Esther Gelle. Articial Intelligence Laboratory (LIA)

Intersection of sets *

On Computing the Minimal Labels in Time. Point Algebra Networks. IRST { Istituto per la Ricerca Scientica e Tecnologica. I Povo, Trento Italy

Constraint-Based Intelligent Scheduling. Donald Smith. Technical Report CS June Department of Computer Science. University of Regina

SAMOS: an Active Object{Oriented Database System. Stella Gatziu, Klaus R. Dittrich. Database Technology Research Group

Kevin Skadron. 18 April Abstract. higher rate of failure requires eective fault-tolerance. Asynchronous consistent checkpointing oers a

. The problem: ynamic ata Warehouse esign Ws are dynamic entities that evolve continuously over time. As time passes, new queries need to be answered

2 The Service Provision Problem The formulation given here can also be found in Tomasgard et al. [6]. That paper also details the background of the mo

Let us dene the basic notation and list some results. We will consider that stack eects (type signatures) form a polycyclic monoid (introduced in [NiP

Tilings of the Euclidean plane

In search of the best constraint satisfaction search 3. Daniel Frost and Rina Dechter.

A CSP Search Algorithm with Reduced Branching Factor

A stack eect (type signature) is a pair of input parameter types and output parameter types. We also consider the type clash as a stack eect. The set

Unimodular probing for minimal perturbance. in dynamic resource feasibility problems. Hani El Sakkout, Thomas Richards, Mark G.

What Is An Algorithm? Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the same whether

The Constraint Database Approach to Software Verification

Part 2: Balanced Trees

sing_adj sing_noun plur_noun

Constraint Programming

Algebra of Logic Programming Silvija Seres Michael Spivey Tony Hoare Oxford University Computing Laboratory Wolfson Building, Parks Road, Oxford OX1 3

2 [Ben96]. However, this study was limited to a single mapping. Since the choice of mapping can have a very large impact on our ability to solve probl

Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have

is a kind of generalization of AC-3 to non-binary constraints. As AC-3, that algorithm has a bad worst-case time complexity (O(er 2 d r+1 ), with e th

GSAT and Local Consistency

2WKHUZLVH 6HOHFWFRQIOLFW& LL 6HOHFWFRQVWUDLQW7& WKDWZRXOGOHDGWRUHSDLU& LLL &UHDWHDFKRLFHSRLQWFRUUHVSRQGLQJD GLVMXQFWLRQRI7& DQGLWVQHJDWLRQ*RWR

Our approach is based on the fact that it is not necessary to explicitly characterize all (numerous) clauses in T h(ex), in order to classify new exam

Optimal Partitioning of Sequences. Abstract. The problem of partitioning a sequence of n real numbers into p intervals

EFFICIENT INTEGER ALGORITHMS FOR THE GENERATION OF CONIC SECTIONS

Network. Department of Statistics. University of California, Berkeley. January, Abstract

Copyright (C) 1997, 1998 by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for

Constraint Programming

Rajiv Chopra, Rohini Srihari and Anthony Ralston. labeling problem. However, these are dicult to

requests or displaying activities, hence they usually have soft deadlines, or no deadlines at all. Aperiodic tasks with hard deadlines are called spor

Constraint Satisfaction Problems

n-ary constraints are provided by many constraint programming languages and libraries. There are two main approaches to deal with n-ary CSPs. The rst

Enhancing Integrated Layer Processing using Common Case. Anticipation and Data Dependence Analysis. Extended Abstract

Constraint-Directed Backtracking Algorithm. Wanlin Pang. Scott D. Goodwin. May 1996

1 A Tale of Two Lovers

University of Utrecht. 1992; Fokker, 1995), the use of monads to structure functional programs (Wadler,

SORT INFERENCE \coregular" signatures, they derive an algorithm for computing a most general typing for expressions e which is only slightly more comp

Prewitt. Gradient. Image. Op. Merging of Small Regions. Curve Approximation. and

Chapter 2. Convex Hull. 2.1 Convexity. The following terminology should be familiar from linear algebra. Consider P R d. courses.

Crossword Puzzles as a Constraint Problem

Basic Concepts And Future Directions Of Road Network Reliability Analysis

constraint logic language over nite domains based on the cc framework (non-linear) arithmetic constraints over natural numbers which are approximated

Conditional Branching is not Necessary for Universal Computation in von Neumann Computers Raul Rojas (University of Halle Department of Mathematics an

Heap-on-Top Priority Queues. March Abstract. We introduce the heap-on-top (hot) priority queue data structure that combines the

the average case. Developing good benchmark problems for constraint database systems is a topic of research in the future. The paper is organized as f

A Boolean Expression. Reachability Analysis or Bisimulation. Equation Solver. Boolean. equations.

Constructive Negation and Constraints

Henning Koch. Dept. of Computer Science. University of Darmstadt. Alexanderstr. 10. D Darmstadt. Germany. Keywords:

A Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable

to automatically generate parallel code for many applications that periodically update shared data structures using commuting operations and/or manipu

Search Strategy Simulation in Constraint Booleanization

CAD with use of Designers' Intention. Osaka University. Suita, Osaka , Japan. Abstract

Constraint Logic Programming and Integer Programming approaches and their collaboration in solving an assignment scheduling problem

The temporal explorer who returns to the base 1

Localization in Graphs. Richardson, TX Azriel Rosenfeld. Center for Automation Research. College Park, MD

TITLE : Costas Arrays

FB(9,3) Figure 1(a). A 4-by-4 Benes network. Figure 1(b). An FB(4, 2) network. Figure 2. An FB(27, 3) network

MAX-PLANCK-INSTITUT F UR. Ordered Semantic Hyper-Linking. David A. Plaisted. MPI{I{94{235 August 1994 INFORMATIK. Im Stadtwald. D Saarbrucken

Mid-term Exam of Operations Research

Proposed running head: Minimum Color Sum of Bipartite Graphs. Contact Author: Prof. Amotz Bar-Noy, Address: Faculty of Engineering, Tel Aviv Universit

Outline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations

On the Max Coloring Problem

Transcription:

Two Problems - Two Solutions: One System - ECLiPSe Mark Wallace and Andre Veron April 1993 1 Introduction The constraint logic programming system ECL i PS e [4] is the successor to the CHIP system [1]. Computation in ECL i PS e alternates between two modes: constraint handling and host program execution. The host programming language is (an extended) Prolog, which handles search, and interaction with the programming environment. The control for host program execution mode is the usual Prolog control. The constraint handling mode has a quite dierent form of control, which generalises data-driven computation. During constraint handling all possible information is extracted from the constraints. When there is no more information to be extracted, the system returns to host program execution, which continues until another constraint is posted and constraint handling restarts. In the next section we show the advantage of combining Prolog programming with constraints handling for a shift planning application. In the third section we indicate how to control the constraint handling itself, and the application of such control for optimising job-shop scheduling programs. Shift Planning Application The problem is to decide the best shift rota to make optimal use of a resource which is only available for a restricted time each day. Clearly there is a limit on the weekly hours for each shift worker, and there are other application-specic constraints. The problem is to choose start times and end times for the shifts throughout the week. The diculty lies in the cost function, since the hourly pay varies with the time of day and day of the week. It quickly emerged that the best approach is to divide the week into half hour periods, and associate nite domains with the start and end times of the shifts. Unfortunately the constraints do not prune the search space suciently to allow the optimum to be found in a practical time. The reason is that the problem exhibits a huge number of symmetries This paper appears in the Proceedings of the IEE Colloquium on Advanced Software Technologies for Scheduling, London, April 1993 1

(based on extending one shift by a period of time, and reducing another by the same period). A solution was nally reached using an approach based on [3]. The approach is an extension of backchecking, and relies on the concept of a nogood environment in the ATMS. We now show how nogoods were programmed in ECL i PS e for this application. The search routine is an essential component of most CLP programs, and in the shift planning application it appears as a labelling procedure. This procedure, which non-deterministically assigns values to the problem variables, has the form label(vars) :- Vars=[]. label(vars) :- Vars=[V Rest], chooseval(v), label(rest). % Recursive call to label routine Suppose the procedure chooseval which assigns a value to a variable makes some bad choices, and at some point all attempts to label the remaining variables fail. If V 1 = V al1; :::; V n = V aln are the bad choices already made when backtracking occurs, the system has proved that there is no solution with these values for these variables. However there is little use in recording this deduction, since the system will never try the same partial labelling again. However taking the problem constraints into account, we can draw a more general conclusion about the cause of failure. As a trivial example, suppose the problem has just one constraint, that the sum of all the variable values must be greater than some given constant (i.e. V 1 + V 2 + ::: + V m > Const, where m is the number of problem variables). Now when backtracking occurs as outlined above, we can draw a much more useful conclusion than just saying V 1 = V al1; :::; V n = V aln is no good. We can conclude that, whatever values are chosen for V 1; :::; V n, if V 1 + V 2 + ::: + V n =< V al1 + V al2 + ::: + V aln then this partial labelling will still be no good! ECRC, Arabella Strasse 17, 8000 Munich 81, Germany For the shift planning problem we introduced just such a measure. If a partial assignment of start and end times to shifts leads to a failure, the program calculates the cost Cn of the partial assignment, and the period of time U n during which the resource is unused. If any other partial assignment leads to a cost C >= Cn and unused time U =< U n, then this will lead either to a failure or to a solution with greater cost than one already found. The extension of the labelling routine to check for nogood is simple in ECL i PS e. First extra parameters are introduced to record the cost and unused times for the current partial labelling. Then an extra clause is added to check if the current partial assignment is no good. If it is no good, the subgoals 2

!,fail cause the current labelling goal to fail too. Finally a last clause is added to update the nogoods when backtracking occurs: label(vars,cost,unused) :- Vars=[]. % Unchanged label(vars,cost,unused) :- recorded(nogood,[cn,un]), % Find a(nother) nogood Cost >= Cn, Unused =< Un, % Test it!, fail. % Fail the labelling call label(vars,cost,unused) :- Vars=[V Rest], chooseval(v), calc(ncost,nunused,cost,unused,v), % Calc new cost and unused label(rest,ncost,nunused). % Use new cost and unused label(vars,cost,unused) :- record(nogood,[cost,unused]), % Record another nogood fail. % Fail the labelling clause Not only is the extension quite trivial in ECL i PS e, it also leaves the usual constraint handling unaected. The resulting program therefore uses reactive constraints to prune the search tree and nogoods as an additional mechanism. Experiments showed that neither feature alone enabled a solution to be found - it was the combination which made the problem tractable to ECL i PS e. 2 Constraints Handling for Job Shop Scheduling In this section we concentrate on constraint handling. We distinguish two varieties of constraints: primitive constraints and reactive constraints. Primitive constraints are added, during computation, to a global constraint store. Thus primitive constraints are a generalised form of data. They allow not only a value to be associated with a variable (as in traditional data stores) but any primitive constraint to be imposed on any variable or variables. To ensure that the system does not hold contradictory constraints in its store, such as X > Y and Y > X, ECL i PS e provides a global procedure which to decide the consistency of each new primitive constraint with the current store. The CLP Scheme [2] describes the integration of primitive constraints in logic programming. Dierent classes of primitive constraints admit dierent decision procedures. For example the decision procedure for linear equations and inequations over the rationals can be used to detect the inconsistency of the above constraints. However such a decision procedure can be computationally expensive when the number of primitive constraints in the store grows. We now introduce reactive constraints. Reactive constraints are agents with a behaviour which may be either program-dened or built into ECL i PS e. Shortly, the behaviour is as follows: the agent does nothing until a certain condition (or guard) is entailed by the current constraint store; then it transforms 3

itself into a new set of agents, possibly adding new primitive constraints to the store. Often a reactive constraint is dened by a (nite) number of alternative possible behaviours. A behaviour is then chosen non-deterministically at runtime. A very simple example of a reactive constraint which occurs in every scheduling problem is the constraint that two tasks cannot run on a machine at the same time. If S1 and D1 are the start time and duration of one task, and S2 and D2 are those for another, the reactive constraint can be dened as follows: nonoverlap(s1,d1,s2,d2) ==> S1+D1>S2 S1 >= S2+D2 nonoverlap(s1,d1,s2,d2) ==> S2+D2>S1 S2 >= S1+D1 This constraint has two alternative behaviours, one specied by each line in the denition. Informally this denition makes sure that the two tasks do not overlap by adding, as soon as one task A cannot be completed before the other B starts, a constraint that A must start after B is completed. The rst line says that if the current constraint store entails the guard S1+D1>S2 then the reactive constraint nonoverlap(s1,d1,s2,d2) transforms itself into the empty set of constraints (i.e. it disappears), and a new primitive constraint S1 S2 + D2 is added to the constraint store. The second line denes a symmetric behaviour. The nonoverlap constraint can be used for solving small scheduling problems, but it generates a large number of primitive constraints and the linear solver mentioned above quickly becomes too inecient for tackling non-toy scheduling problems. An advantage of reactive constraints is that their behaviour is program de- ned. Thus we can dene a reactive behaviour for constraints that is weaker, and computationally less costly, than solving. A simple example is the treatment of non-linear equations by delaying them until they are linear. A more radical example is the treatment of linear inequations and disequations by - nite domain propagation as in cc(fd) [5]. This is (usually) much cheaper than treating them as primitive constraints and testing them for global satisability. Propagation is simply a reactive constraint behaviour. Using this approach we can replace the primitive constraints S1 >= S2+D2 and S2 >= S1+D1 in the denition of nonoverlap with reactive constraints which perform nite domain propagation. The resulting scheduling program is ecient enough to solve small, but non-toy, problems. For larger more complex scheduling problems it is necessary to perform more global reasoning, on all the tasks which run on a single machine, rather than just pairs of such tasks. Such global reasoning is also straightforward using reactive constraints, though the form of the guards required is more general. For example we need to extract the earliest possible start time and the latest possible end time for a set of tasks, and the sum of their durations. ECL i PS e provides facilities for accessing this information, and for tailoring constraint propagation to the application at hand. 4

Explicit control of constraint behaviour has been used to obtain a guaranteed optimal solution the 10X10 job shop problem. More generally, the integration of primitive constraint solving, reactive constraint behaviours and host program control provide a complete armoury for tackling practical job shop scheduling problems. 3 Conclusion With ECL i PS e we have introduced a second generation constraint logic programming language in which the advantages of CHIPs built-in constraint handling have been retained while \opening" the box and enabling users to construct new reactive constraints. Moreover the open architecture of ECL i PS e has enabled us to add new solvers and test new features, such as intelligent backtracking, without modifying the system itself. Ongoing experimentation with practical problems continues to reveal the eciency and expressive power of ECL i PS e. References [1] 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 (FGCS'88), pages 693{702, Tokyo, Japan, December 1988. [2] J. Jaar and J.-L. Lassez. Constraint logic programming. In Proceedings of the Fourteenth ACM Symposium on Principles of Programming Languages (POPL'87), Munich, FRG, January 1987. [3] F. Maruyama, Y. Minoda, Sawada S., and Y. Takizawa. Constraint satisfaction and optimisation using nogood justications. In Proc. 2nd Pacic Rim Conf. on AI, 1992. [4] M. Meier, J. Schimpf, and et.al. ECL i PS e, ecrc common logic programming system, user manual. Technical Report TTI/3/93, ECRC, 1993. [5] P. Van Hentenryck, H. Simonis, and M. Dincbas. Constraint satisfaction using constraint logic programming. Articial Intelligence, 58, 1992. 5