Download presentation

Presentation is loading. Please wait.

1
**Set Based Search Modeling Examples II**

Andrew Kuipers Please include [CPSC433] in the subject line of any s regarding this course. CPSC 433 Artificial Intelligence

2
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack 0-1 Knapsack Problem For a given list of n items: with weights W = <w1, …, wn> and values V = <v1, …, vn> we want to maximize the value of a knapsack with capacity C by either placing, or not placing, items from I into C CPSC 433 Artificial Intelligence

3
**CPSC 433 Artificial Intelligence**

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 | fF’ wf C } CPSC 433 Artificial Intelligence

4
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack Extension Rules Ext = { A B | sS AS | ((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 CPSC 433 Artificial Intelligence

5
**CPSC 433 Artificial Intelligence**

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 } CPSC 433 Artificial Intelligence

6
**CPSC 433 Artificial Intelligence**

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 CPSC 433 Artificial Intelligence

7
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA Another approach: Genetic Algorithm Brief Definition: A genetic algorithm (GA) is a search model that mimics the process of natural evolution. A population of potential solutions (individuals) Mutate and combine to create new individuals Use a fitness function to evaluate individuals CPSC 433 Artificial Intelligence

8
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA GA Operators Brief Introduction Mutation Crossover CPSC 433 Artificial Intelligence

9
**CPSC 433 Artificial Intelligence**

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 } | 1 j m ij I (j=1..m w(ij)) C } CPSC 433 Artificial Intelligence

10
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA States S 2F * do we need to get any more specific? Extension Rules Ext = { A → B | sS AS | (s-A)BS (Mutation(A,B) Combination(A,B) } CPSC 433 Artificial Intelligence

11
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA Mutation(A,B) A = { P } B = { P, (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 don’t want to replace the fact, just create a new fact that is a mutation of original fact. CPSC 433 Artificial Intelligence

12
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA Mutation Example: I = (3, 4), (9, 7), (7, 3), (6, 9), (11,8) C = 25 A = { (3,4), (7,3), (6,9) } = P K = { (3,4), (6,9) } P J = { (9,7), (11,8) } I (K J) = CPSC 433 Artificial Intelligence

13
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA Mutation Example: I = (3, 4), (9, 7), (7, 3), (6, 9), (11,8) C = 25 A = { (3,4), (7,3), (6,9) } = P K = { (3,4), (6,9) } P J = { (9,7), (11,8) } I (K J) = B = { P, (P – K) J } = { P, { (7,3), (9,7), (11,8) } } CPSC 433 Artificial Intelligence

14
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA Combination(A,B) A = { P, Q } B = { P, Q, 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 CPSC 433 Artificial Intelligence

15
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA Combination Example: I = (3, 4), (9, 7), (7, 3), (6, 9), (11,8) C = 25 P = { i1, i3 } Q = { i2, i3, i4 } P Q = {i1, i2, i3, i4 } K = { i2, i3 } (P Q) CPSC 433 Artificial Intelligence

16
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA Combination Example: I = (3, 4), (9, 7), (7, 3), (6, 9), (11,8) C = 25 P = { i1, i3 } Q = { i2, i3, i4 } P Q = {i1, i2, i3, i4 } K = { i2, i3 } (P Q) B = {P, Q, { i2, i3 } } CPSC 433 Artificial Intelligence

17
**CPSC 433 Artificial Intelligence**

Example: 0-1 Knapsack GA How does search proceed in a GA? What does a search instance look like? Should a search control only select the best individuals in the state? Population control, genocide CPSC 433 Artificial Intelligence

Similar presentations

OK

Constraints Satisfaction Edmondo Trentin, DIISM. Constraint Satisfaction Problems: Local Search In many optimization problems, the path to the goal is.

Constraints Satisfaction Edmondo Trentin, DIISM. Constraint Satisfaction Problems: Local Search In many optimization problems, the path to the goal is.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google