Uploaded by 12092000

Optimisasi HEURISTIC

advertisement
HEURISTICS
Combinatorial optimization
• Discrete decision variables
• Search space often finite but typically too vast for a brute force approach →
more efficient algorithms needed
Algorithms for combinatorial optimization
• Typically problem-specific but some general concepts are repeatedly used,
such as
–
–
–
–
–
Greedy algorithms
Integer linear programming
Branch-and-bound
Dynamic programming
Heuristics (e.g. local search, nature-inspired algorithms)
HEURISTICS
Definition:
A heuristic is an inexact algorithm that is based on
intuitive and plausible arguments which are “likely”
to lead to reasonable solutions for a given problem,
but are not guaranteed to do so.
Heuristic Search
A Heuristic is a function that, when applied to a state, returns a number that is an
estimate of the merit of the state, with respect to the goal.
In other words, the heuristic tells us approximately how far the state is from the goal
state*.
Note we said “approximately”. Heuristics might underestimate or overestimate the merit
of a state. But for reasons which we will see, heuristics that only underestimate are very
desirable, and are called admissible.
Heuristics
Common characteristics among heuristic procedures:
• Speed: A heuristic procedure usually has a relatively small computational requirement.
• Feasible solutions: A heuristic procedure usually finds a feasible solution for the given problem.
• Common sense: Many heuristic procedures are based on common sense, or an adaptation of an
exact method for simpler problems.
• Search: A heuristic procedure may or may no involve a “search” in the set of feasible solutions.
• No guarantee of optimality: A heuristic does not guarantee the solution it obtains is optimal for
the given problem.
Heuristics
Why use a heuristic method to solve a discrete optimization problem (integer
problem)?:
➢ The problem is difficult (e.g. known to be NP-Hard), and we must solve relatively “large”
instances of the problem.
➢ Needed in the branch and bound and implicit enumeration approaches for solving IPs.
The better the heuristic, the faster the B&B or implicit enumeration will solve.
➢ When you don’t necessarily need an optimal solution, but need a good solution fast.
Heuristic Search
• Heuristic - a “rule of thumb” used to help guide search
• often, something learned experientially and recalled when needed
• Heuristic Function - function applied to a state in a search space to indicate a likelihood of
success if that state is selected
• heuristic search methods are known as “weak methods” because of their generality and because they
do not apply a great deal of knowledge
• the methods themselves are not domain or problem specific, only the heuristic function is problem
specific
• Heuristic Search
• given a search space, a current state and a goal state
• generate all successor states and evaluate each with our heuristic function
• select the move that yields the best heuristic value
Invented by Lewis Carroll
Review point: A problem may have multiple
solutions. Different solutions may have
different costs. We generally want the
cheapest solution, the optimal solution.
1832 –1898
He suggested: APE → ARE→ ERE→ ERR→ EAR→ MAR → MAN
But we can do: APE → APT → OPT → OAT → MAT → MAN
which takes one less move…
Heuristic Search Techniques
• Direct techniques (blind search) are not always possible (require too much
time or memory).
• Weak techniques can be effective if applied correctly on the right kinds of
tasks.
• Typically require domain specific information.
9
Example: 8 Puzzle
1 2 3
7 8 4
6
5
1 2 3
8
4
7 6 5
10
1 23
8 4
7 65
GOAL
1 23
7 84
6 5
right
1 23
7 84
6 5
1 23
7 84
6 5
1 23
7 4
6 85
Which move is best?
11
8 Puzzle Heuristics
• Blind search techniques used an arbitrary ordering (priority) of
operations.
• Heuristic search techniques make use of domain specific information a heuristic.
• What heurisitic(s) can we use to decide which 8-puzzle move is “best”
(worth considering first).
12
8 Puzzle Heuristics
• For now - we just want to establish some ordering to the possible
moves (the values of our heuristic does not matter as long as it ranks
the moves).
• Later - we will worry about the actual values returned by the heuristic
function.
13
A Simple 8-puzzle heuristic
• Number of tiles in the correct position.
• The higher the number the better.
• Easy to compute (fast and takes little memory).
• Probably the simplest possible heuristic.
14
Another approach
• Number of tiles in the incorrect position.
• This can also be considered a lower bound on the number of moves from a
solution!
• The “best” move is the one with the lowest number returned by the heuristic.
• Is this heuristic more than a heuristic (is it always correct?).
• Given any 2 states, does it always order them properly with respect to the minimum
number of moves away from a solution?
15
1 23
8 4
7 65
GOAL
1 23
7 84
6 5
right
1 23
7 84
6 5
1 23
7 84
6 5
1 23
7 4
6 85
h=2
h=4
h=3
16
Example of a word ladder
Change DOG to CAT. Change ONLY one letter at a time
and form a new legal word at each step.
DOG
DOT
POT
POP
MOP
MAP
CAP
CAT
What is the depth of the solution?
Since all three letters are different in the
two words, and we have to change only
one letter at a time, it is clear that we have
to take at least three steps.
DOG
?
?
CAT
As it happens, there is a solution at
depth three
DOG
DOT
COT
CAT
Download