# Application of Constraint Programming

Shared by:
Categories
-
Stats
views:
10
posted:
1/31/2010
language:
English
pages:
29
Document Sample

```							Applications of Constraint Programming

The Data Error Detection Problem and the
DDX Manpower Planning Problem
Outline of Presentation

• Data Error Detection Problem
• Manpower Planning Problem for the DDX
• Some Results of Constraint Programming
Applied to the Resource Constrained Project
Scheduling Problem (RCPSP)
Errors in Data Sets
• Large data files frequently contain missing, incorrect,
and inconsistent data.
• Such errors can be detected by formulating a set of
rules.
• First task is to form a set of rules for the EMF and
check the set for consistency and redundancy.
• Second task is to use the set of rules to detect
erroneous data and make the appropriate corrections
which modify the data as little as possible and
preserves the statistical distribution of correct data as
much as possible.
• Our research focuses on the first one.
Propositional Logic Formulation
• Due to Bruni and Sassano 2001
• An edit rule may be:
“If marital status is married, age must be not less than 14”
• The propositional logic formula for the above rule is:
(married_status = married) /\ (age <= 14)
• To get a formula which is satisfied by correct data, we
need to negate the above formula.
• This negated formula is satisfiable if and only if there
exists an assignment that makes the formula true;
otherwise the negated formula is unsatisfiable, which
implies an inconsistency in the edit set.
Complete Inconsistency

• Complete inconsistency occurs when every possible
set of entries to the fields activates an edit.
• In order to restore consistency it is useful to know
which are the offending edits, or the minimal
unsatisfiable sub formula.
• The core is to solve a SAT and a MAX_SAT
problem.
Redundancy
• Some edits could be logically implied by others,
thus being redundant. By removing these redundant
edits, we can reduce the number of clauses in the
system while maintaining the same power of
inconsistency detection.
• An edit, e, can be checked by removing its clausal
representation from the CNF formula, adding its
negation to the formula, and testing if the resulting
formula is unsatisfiable. If it is unsatisfiable, then e
is redundant.
• The core is again to solve a SAT problem.
SAT and MAX_SAT Problem
• Satisfiability (SAT) Problem (Gary and Johnson 1979):
Instance: A set U of variables and a collection C of clauses over U.
Question: Is there a satisfying truth assignment for C?
• MAX_SAT Problem:
Instance: A set U of variables and a collection C of clauses over U.
Question: What is the maximum number of clauses that can be
satisfied?
• Both SAT and MAX_SAT are NP-complete and not easily expressed
or solved with classical mathematical programming tools and
concepts.
• Intense interest in exploring outside mathematical programming in
areas such as Artificial Intelligence (AI) and Computer Science (CS)
to find ideas to use to represent and solve satisfiability problems.
Opportunities of Research

• Edit Generation. Attack the problem of generating a set
of consistent and redundancy-free edit rules. This problem
can be solved by encoding the formulation as a
propositional logic formula and solving a sequence of
satisfiability problems.
• Implementation. Design, implement, and test an
application that executes the efficient set of edit rules for
the types of personnel files handled by the Navy.
Manpower Planning for DDX Ship
• The reduction in crew size associated with the new DDX
class of ships, means that many of the routine and non
routine tasks that are now performed by our forces at sea
will need to be accomplished with fewer resources.
• Determining the correct crew size and a right mix of skills
for the crew will require that we understand how to
accomplish every day.
• Our Plan -- Formulate it as a Resource Constrained Project
Scheduling Problem (RCPSP) with special objective
function and resource type considerations.
Scheduling (RCPS) Problem
• Temporal time constraints (time windows)
S jk : starting time of task k in job j

   jkj ' k '   : minimum time delay between task jk and j ' k '

S jk  S j 'k '   jkj 'k '
j, j '  J
k, k '  K

• A set of renewable resources is required for
carrying out the activities of the project.
• Each activity must be carried out without
interruption (non preemption).
• Set-up time independent
• Objective is to find an optimal schedule to
minimize the make span (completion time of
the last project scheduled).
Notation
rk ( S , t ) : amount of resource k used at t for a schedule S
Rk : amount of resource k available

d : upper bound of the project duration
S jk : starting time of task k in job j
S 0 , S n 1 : starting time of dummy task
S : a schedule set of each task

   jkj ' k '   : minimum delay; if it equals duration of task
j'k' , it determines the precedence requirement

E : the edge set of activity on node graph, which
connects pairs of nodes having temporal relations
A General Model Formulation

Min S n 1
_
s.t. rk ( S , t )  Rk                (k  R,0  t  d )

S jk  S j 'k '     jkj ' k '   ( jk , j ' k '  E )
S jk  0                          ( j  J,k  K)
S0  0
An Illustration of RCPSP
Y11

Y12

Y13

Y14

Y21

Y22

Y23

Y24

Y31

Y32

Y33

Y34

1. The current illustration is not feasible for unary resources.
2. Our task is to find a feasible solution while optimizing an
objective function.
Where is the Gap?
• The manpower planning problem faced by the Navy is different
from the traditional RCPSP. It has combined characteristics of both
RCPSP and a generalized assignment problem (GAP).
• The assignment has to be made which is usually the case in GAP
but rare in RCPSP.
• The objective is to minimize the number of sailors on site (at
work), which is different from minimizing make-span in traditional
RCPSP. Also note that this is not simply minimizing the “number”
of sailors, but the “attendance” of sailors since one sailor might be
assigned several times for different tasks.
• On the other hand, it is significantly different from GAP because
the assignment needs to be made while satisfying the temporal
Introduction to Constraint Programming (CP)
• CP is the study of computational systems based on constraints.
• Earliest ideas leading to CP may be found in AI area of CSP
(Constraint Satisfaction Problem), dating back to 60’s and 70’s.
• In CP, the word “programming” refers to its roots in the field of
programming language. Other programming paradigms are
procedural programming, OOP, functional programming, logic
programming, etc. (Hentenryck, 1999)
• In Mathematical Programming, the word “programming” roots
in Dantzig 1963, which is associated with a specific
mathematical problem.
• “Constraint Programming represents one of the closest
approaches computer science has yet made to the Holy Grail of
programming: the user states the problem, the computer solves
it.” (E. Freuder)
An Illustration for Domain Reduction
Constraint Propagation
When a variable’s domain is modified, the effects of this modification
are then communicated to any constraint that interacts with that
variable. The domain reduction algorithms modifies the domains of all
the variables in that constraint, given the modification of one of the
variables in that constraint.

01234
01234                13
56789

Y=2X            Y<=10         (X modulo 2) = 1     Y=2X

01234
02468                         26
56789
Experimental Study of Constraint
Programming Approach to Solve RCPSP
• A RCPSP with unary resource, i.e. for each type of
resource there is only one unit available throughout the
process of the project.
• Implementing constraint programming with Optimization
Programming Language (OPL).
• Branching and Bound approach to solve the same problem
with Excel Solver as comparison.
• Our study indicates that the constraint programming
approach outperforms the B& B approach significantly.
Effects of Number of Types of Resources
Resource 1 Resource 2 Resource 3 Running Time
Instance 1          1          1          1         259.3
Instance 2          1          1          2        237.27
Instance 3          1          2          1         19.79
Instance 4          1          2          3         12.77
Instance 5          2          1          1 >3600
Instance 6          2          1          2 >3600
Instance 7          2          2          2           0.96
Instance 8          2          1          3 >3600
Instance 9          3          2          2 >3600
Instance 10         3          3          3           1.39
Instance 11         3          2          1 >3600
Instance 12         3          1          1 >3600

Note: 1. Time in seconds.
2. Performed on AMD Athlon 1GHz with 256 MB Memory.
3. Set the base case to include 9 jobs, 3 types of resources and 18 temporal
constraints.
Effects of the Number of Precedence Relations

3000
Running Time (in seconds)

2800
2600
2400
2200
2000
1800
1600
1400                                                                  Series1
1200
1000
800
600
400
200
0
-200
0     2    4      6       8      10      12     14   16   18

Number of Precedence Relations

Note: The base case has 9 tasks, 3 types of resources, 8
min-delay relations and no due date constraints. Resource 3
has two units and others have one unit each.
Effects of the Number of Minimum Delay Relations
Running Time (in seconds)

250

200

150

Series1
100

50

0
0      2     4     6        8       10     12   14   16

Number of Minimum Delay

Note: The base case has 9 tasks, 3 types of resources, 10
precedence relations and no due date constraints.
Effects of the Number of Due Date Requirment
Running Time (in seconds)
250

200

150

Series1
100

50

0
0    1     2        3        4        5        6   7   8

Number of Due Date Requirment

Note: The base case has 9 tasks, 3 types of resources, 10
precedence relations and 8 min-delay relations.
Number of Precedence = 8

25
20
Running 15                                                   6
Time (in                                                     8
10
seconds)
5                                                  10
2                       12
0                               Number of
6                                              14
8   10                  Due Date
12   14
Number of
Number of Precedence = 10
Min_Delay

25

20
15 Running Time   6
8
10 (in seconds)
10
5                 12
2                                                   14
Number of                                     0
Due Date       6                   12   14
8     10
6
Number of Min_Delay
Number of Precedence = 12

16
14
12                                               6
10                                              8
Runnng Time                                                  10
(in seconds) 8
6                                              12
4                         14                   14
2                    10        Number of
0                              Min_Delay
2            6
4   6
Number of Due                                           Number of Precedence = 14
Date

12
10
8                                                6
Running Time
6                                                8
(in seconds)
4                                                10
14
2                                                12
10        Number of
14
0                                    Min_Delay
6
2    4     6
Number of Due
Date
Integer Programming Approach
(Unary Resource)
Min S n 1

s.t. S jk  S j 'k '     jkj ' k '                    ( jk , j ' k '  E )
S jk  d jk  S j 'k '  My jkj'k '
S j 'k '  d j 'k '  S jk  M (1  y jkj'k ' )   { jk , j ' k ' | rjk  rj 'k ' }
S n 1  S jk                                     ( j  J,k  K)
S jk  0                                          ( j  J,k  K)
y jkj'k '  1                         if task jk precedes task j ' k '
0                            otherwise
Comparison of CP and B&B

Instance 1      Instance2     Instance 3      Instance 4      Instance 5
Number of Jobs                             5             5               6               4             6
Number of Types of Resources               4             3               3               3             3
Number Temporal Constraints               15            10              12              10            13
Running Time of B&B                       60           220           3245             3.52         420.5
Running Time of CP                      0.21          0.33            0.61            0.23          0.15

Note: 1. Time in seconds.
2. Performed on AMD Athlon 1GHz, 256 MB memory
Conclusion

• The declarative nature of Constraint Programming reduces
the effort to express and formulate the models for SAT,
MAX_SAT and RCPSP.
• The novelty of specifying the search procedure in OPL
separately from expressing the model will play an
invaluable part in solving these NP-hard combinatorial
problems.
• For large instances of these problems, we might need to
develop hybrid integer & constraint programming model to