and problem solving techniques
play

and problem-solving techniques 2 Some mathematical principles and - PDF document

Problem Solving Skills (14021601-3 ) Part 2 Some mathematical principles and problem-solving techniques 2 Some mathematical principles and problem-solving techniques Invariant Principle 3 1 Gauss When Karl Friedrich Gauss was still in


  1. Problem Solving Skills (14021601-3 ) Part 2 Some mathematical principles and problem-solving techniques 2 Some mathematical principles and problem-solving techniques Invariant Principle 3 1

  2. Gauss When Karl Friedrich Gauss was still in elementary school (around the age of nine), a lazy teacher used to give some “ hard ” problems to his pupils, so that they would be busy solving them while he read the morning paper! One day, the teacher asked the students to calculate the total of all integer numbers from 1 to 100; he was sure he would be able to read for the next half hour! To his great surprise, young Gauss was ready in a couple of minutes. 4 Gauss By grouping all the numbers from 1 to 100 into pairs: (1 and 100), (2 and 99), (3 and 98), and so on till (50 and 51) he noticed that the total for each pair is 101. This was the invariant. Given that there were only 50 pairs, a simple multiplication of 101 × 50 = 5,050 gave him the answer! 5 Tennis tournament There is a tennis tournament with 937 players. The player who wins a game advances further, while the loser leaves the competition. How many games are required to complete the tournament? 6 2

  3. Tennis tournament There are many possible approaches for finding the solution … But if you notice the invariant : number of players left in the tournament + number of games played = 937 you arrive at solution immediately … 7 Puzzle 8 Puzzle After one exchange, what amount is greater? Amount of water in the juice or amount of juice in the water? 9 3

  4. Puzzle – A model • Volume of a glass: V • Volume of teaspoon x • The ratio of juice in the water: x / (V + x) • Amount of juice coming back: x × x / (V + x) • Etc. 10 Puzzle – Another model • Volume of water w and juice j on the return trip of the teaspoon • Volume of teaspoon x = w + j • Amount of water in the juice: w • Amount of juice in the water: x – j = w 11 Puzzle – Invariance principle 12 4

  5. Puzzle Invariance principle is very helpful in solving problems where there is repetition in the statement of the problem. The invariance principle simply advises to look for things that do not change (i.e. invariants ). For water & juice problem, the volumes in both glasses do not change … 13 Puzzle – Invariance principle 14 Puzzle – Invariance principle 15 5

  6. Puzzle A rectangular chocolate bar consists of m × n small rectangles and you wish to break it into its constituent parts. At each step, you can only pick up one piece and break it along any of its vertical or horizontal lines. How should you break the chocolate bar using the minimum number of steps (breaks)? 16 Puzzle The invariance principle simply advises to look for things that do not change (i.e. invariants ). For chocolate bar puzzle, the number of pieces is always greater by 1 than the number of breaks which has been made … 17 Puzzle Number of breaks Number of pieces 0 1 1 2 2 3 3 4 . . . . . . 62 63 18 6

  7. Invariance principle 19 Question A tetromino is a figure made from 4 squares of the same size. Consider five different tetrominoes, called O-, Z-, L-, T-, and I-tetrominoes (given below in this order): 20 Question (a) Is it possible to cover a rectangular board of 11 × 15 squares with the above tetrominoes? Justify your answer. (b) Is it possible to cover a rectangular × board of 10 30 squares with T- tetrominoes only? Justify your answer. 21 7

  8. Invariance principle again Puzzle . A knight fights a dragon with 100 heads. This knight can cut off 15, 17, 20, or 5 heads with one blow of his sword, however, in each of these cases a number of new heads will grow immediately: 24, 2, 14, or 17 heads, respectively. The dragon dies only if all his heads are cut off. Is it possible to kill the dragon? 22 Any Question ??? Some mathematical principles and problem-solving techniques Divide and Conquer & Backtracking 24 8

  9. Divide and Conquer Split the problem P into sub-problems P 1 , P 2 , … , P k For each sub-problem P 1 , P 2 , … , P k : If size ( P i ) is small then solve P i , otherwise split the sub-problem P i 25 Puzzle 26 Puzzle 27 9

  10. Puzzle 28 Puzzle 29 Backtracking Backtracking is a refinement of the brute force approach, which systematically searches for a solution to a problem among all available options. It does so by assuming that the solutions are represented by vectors ( v 1 , ..., v k ) of values and by systematically checking the domains of the vectors until the solutions are found. 30 10

  11. Puzzle Place 8 queens on the chessboard in such a way that none of the queens attacks any other 31 Puzzle 32 Puzzle 33 11

  12. Puzzle 34 Puzzle 35 Puzzle 36 12

  13. Puzzle 37 Puzzle 38 Puzzle 39 13

  14. Puzzle 40 Puzzle 41 Puzzle 42 14

  15. Puzzle 43 Puzzle 44 Puzzle 45 15

  16. Backtracking … 46 More backtracking … 47 Continuing 48 16

  17. Continuing 49 Even more backtracking 50 Forward again 51 17

  18. Puzzle : A solution 52 Backtracking You have used backtracking in your last homework: • If s = 1 then g = 81/6 which is not a whole number. • Consider the case, then, when n = 4, i.e., there were 4 events. You ’ ll use backtracking in solving many problems to come … 53 Knapsack problem There is a number n of items. Each item has some weight ( w 1 , w 2 , … , w n ). Each item has a value, often called profit ( p 1 , p 2 , … , p n ). The thief ’ s dilemma is to maximize the total value of the items while not making the total weight exceed W . How to find the best subset of items? 54 18

  19. Knapsack problem – example Items : 1 2 3 4 5 6 7 Weights : 12 10 9 13 8 11 10 Values : $25 $21 $18 $30 $16 $23 $22 The total weight W which can be carried away by a thief is 32. How to find the best subset of items? 55 Knapsack problem There are many possible approaches for such knapsack problem: • A greedy approach • Dynamic programming • Integer programming • Branch and bound • Heuristic methods • Modern heuristic methods • Backtracking … 56 Knapsack problem value $0 32 capacity left 57 19

  20. Knapsack problem value $0 32 Item #1 capacity left $25 20 58 Knapsack problem value $0 32 Item #1 capacity left $25 20 Item #2 $46 10 59 Knapsack problem value $0 32 Item #1 capacity left $25 20 Item #2 $46 10 Item #7 $68 0 60 20

  21. Knapsack problem $0 32 Item #1 Item #4 $25 $30 20 17 Item #2 $46 10 Item #7 $68 0 61 Puzzle  There are 100 pebbles on the table. There are two players, A and B, who move alternatively. Player A moves first. The rules of the game are the same for both players: at each move they can remove one, two, three, four, or five pebbles. The winner is the one who take the last pebbles. What is the winning strategy for player A, if one exists? 62 Games We will discuss games towards the end of this course if time permits – but you should see already a huge applicability of backtracking in a variety of strategic games (including checkers, chess, tic-tac-toe, etc). 63 21

  22. Any Question ??? Some mathematical principles and problem-solving techniques Constraints 65 Processing constraints • Constraints are helpful as they can lead you towards the solution of the problem … • Models are usually simple: A number of variables correspond to some objects and each variable has a domain. • The process of solving a problem is the process of narrowing the domain of variables. Example: Sherlock Holmes stories … 66 22

  23. Puzzle Two men meet on the street (they have not seen each other for many years): A : All three of my sons celebrate their birthday today. Can you tell me how old each one is? B : Yes, but you have to tell me something about them … A : The product of their ages is 36. B : I need more info … A : The sum of their ages is equal to the number of windows in the building next to us … B : I need more info … A : My oldest son has blue eyes. B : That is sufficient! 67 Puzzle Remember 3 rules? • Do you understand the problem? • Do you have any intuition on the solution? • Can we build a model? 68 Puzzle – A model • Age of the first son: x • Age of the second son: y • Age of the third son: z Safe assumption: x ≥ y ≥ z dom(x) = dom(y) = dom(z) = {1, 2, … , 36} 69 23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend