Set%20Based%20Search%20Modeling%20Examples%20II - PowerPoint PPT Presentation

About This Presentation
Title:

Set%20Based%20Search%20Modeling%20Examples%20II

Description:

Set Based Search Modeling Examples II M. Reza Zakerinasab mrzakeri_at_ucalgary.ca Please include [CPSC433] in the subject line of any emails regarding this course. – PowerPoint PPT presentation

Number of Views:66
Avg rating:3.0/5.0
Slides: 18
Provided by: amkuiper
Category:

less

Transcript and Presenter's Notes

Title: Set%20Based%20Search%20Modeling%20Examples%20II


1
Set Based Search Modeling Examples II
  • M. Reza Zakerinasab
  • mrzakeri_at_ucalgary.ca
  • Please include CPSC433 in the subject line of
    any emails regarding this course.
  • Slides originally created by Andrew M Kuipers.

2
Example 0-1 Knapsack
  • 0-1 Knapsack Problem
  • For a given list of n items
  • with weights W ltw1, , wngt
  • and values V ltv1, , vngt
  • we want to maximize the value of a knapsack with
    capacity C by either placing, or not placing,
    items from I into C

3
Example 0-1 Knapsack
  • Facts
  • The items in our knapsack, which we can simply
    represent by their index
  • F 1, , n
  • States
  • A state is a set of items, where the sum of the
    weight of the items is less than or equal to
    capacity C
  • S F ? F ??f?F wf ? C

4
Example 0-1 Knapsack
  • Extension Rules
  • Ext A ? B ?s?S ? A?S ((s-A) ? B) ? S
  • This basic extension rule definition allows us to
    perform all sorts of set manipulation, so long as
    the result is a valid state
  • ie adding and removing either single or multiple
    items from the knapsack, as long as the result
    weighs less than the maximum capacity C

5
Example 0-1 Knapsack
  • Example
  • W 20, 7, 13, 5
  • V 50, 30, 25, 15
  • C 25
  • s0
  • s1 2, 3 by A ? B 2, 3
  • s2 2, 3, 4 by A ? B 4
  • s3 1, 4 by A 2, 3 ? B 1

6
Example 0-1 Knapsack
  • Problems with this Model
  • The control must select between a large number of
    possible extension rules to apply
  • Only a single possible solution being
    manipulated how can we compare solutions?
  • How might we define the goal?
  • While we have correctly modeled the problem, this
    model does not lend well to a search process
  • Remember for a given problem, there are many
    ways to construct a model

7
Example 0-1 Knapsack GA
  • Another approach Genetic Algorithm
  • Brief Definition A genetic algorithm (GA) is a
    search heuristic that mimics the process of
    natural evolution.
  • Simplified Steps
  • Encode the problem,
  • Iteratively, apply operators, compare solutions

8
Example 0-1 Knapsack GA
  • GA Operators Brief Introduction
  • Mutation
  • Crossover

9
Example 0-1 Knapsack GA
  • Genetic Algorithm Approach
  • I ?(w1, v1), , (wn, vn)?, C capacity
  • where w((wi, vi)) wi and v((wi, vi)) vi
  • Facts
  • F i1, , im (?j1..m w(ij) ? C)

10
Example 0-1 Knapsack GA
  • States
  • S ? 2F
  • do we need to get any more specific?

11
Example 0-1 Knapsack GA
  • States
  • S ? 2F
  • do we need to get any more specific? YES!
  • S F ? 2F ??f?F wf ? C
  • Extension Rules
  • Ext A ? B ?s?S ? A?S (s-A)?B?S ?
  • (Mutation(A,B) ?
  • Combination(A,B)

12
Example 0-1 Knapsack GA
  • Mutation(A,B) ?
  • A P ? B (P K) ? J
  • where K ? P , J ? I and (K ? J) ?
  • Remove some subset K from the fact P randomly
  • Replace it with some set of items J that does not
    contain any items in K
  • We dont want to replace the fact, just create a
    new fact that is a mutation of original fact.

13
Example 0-1 Knapsack GA
  • Mutation Example
  • W 3, 9, 7, 6, 11
  • V 4, 7, 3, 9, 8
  • C 25
  • A 1, 3, 4 P
  • K 1, 4 ? P
  • J 2, 5 ? I
  • (K ? J) ?

B (P K) ? J B 2, 3, 5
14
Example 0-1 Knapsack GA
  • Combination(A,B) ?
  • A P, Q ? B K
  • where
  • K ? (P ? Q) ?
  • (K ? P) ? (K ? Q) ?
  • min(P,Q) ? K ? max(P, Q)
  • Use existing facts P and Q to generate a new fact
    K, which is a combination of P Q, yet not equal
    to P or Q, and of size between that of P and Q

15
Example 0-1 Knapsack GA
  • Combination Example
  • W 3, 9, 7, 6, 11
  • V 4, 7, 3, 9, 8
  • C 25
  • P 1, 3
  • Q 2, 3, 4
  • P ? Q 1, 2, 3, 4
  • K 2, 3 ? (P ? Q)

B 2, 3
16
Example 0-1 Knapsack GA
  • Actually, whats happening in this mutation /
    combination scenario???

17
Example 0-1 Knapsack GA
  • Using this mutation / combination scenario, we
    act as follows
  • We select some random solutions which are valid
    states.
  • In a loop
  • We compare the solutions to find our best
    solution.
  • We apply mutation on some random solutions from
    our solution set or combination on random pairs.
  • This loop stops when some certain condition
    satisfies.
  • We find an enough good solution.
  • Our best solution does not improves after some
    specific time.
Write a Comment
User Comments (0)
About PowerShow.com