Title: G52AIP Artificial Intelligence Programming
1G52AIPArtificial Intelligence Programming
Dr Rong Qu
- Constraint Optimisation Problems
2Constraint Satisfaction Problems
- So far
- All solutions are equally good
- In some real world applications, we
- Not only want feasible solutions, but also good
solutions - We have different preferences on constraints
- Problems are too constrained that there is no
solution satisfying all constraints
3Constraint Optimisation Problems
- Real world problems present to be messy
- In some cases a conflict-free solution is needed
- All constraints must be satisfied
- In some cases preferences are given, rather than
constraints - Hard and soft constraints
- In some cases, some constraints are more
important than others - Constraints with different weights
4Constraint Optimisation Problems
- What are good solutions?
- Objective function
- Problem specific function
- How much are constraints satisfied
- Relatively new research
- Scheduling
- Timetabling
- Resource allocations, etc
5Constraint Optimisation Problems
- Constraint optimisation problems
- Find feasible solutions with the best value of
objective function - Constraint optimisation problems (C,f)
- Constraint Satisfaction Problem (C)
-
- Objective function (f)(maps every solution to a
numeric value)
6Constraint Optimisation Problems
- A solution ? is preferred to solution ?
- If the value of objective function f under ? is
less (or larger in maximisation problem) than ? - An optimal solution of COP (C,f)
- A solution ? of C, such that no other solution of
C is preferred to ?.
7Constraint Optimisation Problems
- Examples
- Graph colouring
- Minimum number of colours used
- Linear expression
- With constraints for variables in the expression
- Minimise the result of linear expressions
8Branch and Bound (BB)
- General method
- In COP most widely used
- CPLEX in ILOG software
-
- Based on depth first search
- Branches pruned during the search by a bound
9Branch and Bound (BB)
- Keep the best solution so far
- During the search
- If partial solution (node) are proved cannot
improve the result - Prune the branch under the node
- All solutions in branches under the node are
abandoned
10Branch and Bound (BB)
X
X
Best solution
Best solution
11B B
- Two important factors
- A heuristic function, h
- Estimated objective values for compound labels of
partial solutions - A bound, b
- Used to prune brunches with no optimal solutions
- Updated during the search
12B B
- During the search in the search tree
- Before labelling a variable, a value of the
heuristic function is calculated - If the heuristic value is greater than the bound
- The whole sub-tree under the node is pruned
- If the heuristic value of a solution is less than
the existing bound - Update the bound
- Store the newly found solution
- For a minimisation problem
13B B heuristic
- Heuristic h
- Function maps partial solution to an estimate of
the objective function value - Good estimate of the best values of all branches
under the current node - If the best value under the branch are worse than
the current bound, then there is no need to
explore these branches - Problem specific
14B B heuristic
- Use heuristic to prune the search tree
- There is no solution in the sub-tree (under the
node) - All solution in the sub-tree are not optimal
- So that
- Solutions can be found earlier
- Reduce the search space
- Speed up the search
15B B heuristic
- A good heuristic h is the key to successful BB
- Must underestimate
- Admissible
- Return the lower bound of the heuristic value
- Otherwise the optimal solution may be pruned
- h is the actual cost, h lt h
- For a minimisation problem
16B B heuristic
- A good heuristic h is the key to successful BB
- Must underestimate
- The closer the estimation of heuristic, the
larger the part of search tree pruned - h is the actual cost, the closer h is to h the
better
17B B bound
- Usually set as infinite value at the beginning
- Updated during the search by recording the best
so far heuristic value - For a minimisation problem
18B B bound
- Better bound, b
- Helps to find good solutions earlier
- In practice, user can provide a bound
- Satisfied even the solution is not optimal
v
19SEND MORE MONEY - Problem
- S E N D
- M O R E
- M O N E Y
- Cryptarithmetic problem mathematical puzzles
where digits are replaced by symbols - Find unique digits the letters represent
satisfying the above constraints
20SEND MORE MONEY - Model
- Variables
- S, E, N, D, M, O, R, Y
- Domain
- 0, , 9
21SEND MORE MONEY - Model
- Constraints
- Distinct variables, S ? E, M ? S,
- S1000 E100 N10 D
-
- M1000 O100 R10 E
-
- M10000 O1000 N100 E10 Y
22SEND MORE MONEY How?
- How would you solve the problem using CP
techniques? - Search tree with backtracking
- Constraint propagation
- Forward backward checking
- Combination of above?
- Different problems may find different techniques
more appropriate
23SEND MORE MONEY - Solution
- 9 5 6 7
- 1 0 8 5
- 1 0 6 5 2
- Is this the only solution?
- Sometimes we want to maximise an objective
S E N D M O R E M O N E Y
24SEND MOST MONEY - Problem
- S E N D
- M O S T
- M O N E Y
- Objective we now want to maximise MONEY
25SEND MOST MONEY - Problem
- Modelling
- What does best mean
- How to find best solution
- Search
- Assign scores for proposed solution, h
- Update the bound, b
26Constraint Optimisation Problems
- Real world problems
- Resource allocation
- Nurse rostering systems in hospitals
- BT services
- Airport scheduling at British Airways
- Flight scheduling, ECLiPSe
- Aircraft allocation, ILOG
27Constraint Optimisation Problems
- Real world problems
- Timetabling
- University course/exam scheduling systems
- Transportation
- ILOG vehicle routing
- Scheduling
- Job shop scheduling
28Summary
- Constraint optimisation problem
- Branch and bound (BB)
- Heuristic h
- Bound b
- Example
- SEND MORE MONEY (CSP)
- SEND MOST MONEY (COP)