Loading...

PPT – Three Classic Computer Science Problems, and the Algorithms to Solve Them PowerPoint presentation | free to view - id: eeaf9-ZDI2Y

The Adobe Flash plugin is needed to view this content

View by Category

Presentations

Products
Sold on our sister site CrystalGraphics.com

About This Presentation

Write a Comment

User Comments (0)

Transcript and Presenter's Notes

Three Classic Computer Science Problems, and the

Algorithms to Solve Them

- Matthew Hyde
- PhD Student in Computer Science
- ASAP Research Group

Outline

- 1) The 1 Dimensional Bin Packing
- 2) The Knapsack Problem
- 3) The Travelling Salesman Problem
- A hard real life problem made up of two of these

Outline

- 1) The 1 Dimensional Bin Packing
- 2) The Knapsack Problem
- 3) The Travelling Salesman Problem
- A hard real life problem made up of two of these

1 Dimensional Bin Packing

- You have a number of pieces of different sizes
- The pieces can be put into containers, called

bins - The bins have a certain capacity
- You must pack the pieces into the smallest amount

of bins possible

1 Dimensional Bin Packing

106

85

84

46

252

127

106

252

127

442

106

252

127

106

252

127

10

252

127

10

252

9

10

9

252

10

12

10

37

12

10

37

12

Capacity 524

Practical Applications

- Lengths of material in factories
- Cast metal comes in predefined stock lengths
- You have to cut the stock lengths to get the

lengths you want - Any waste at the end of a stock length is a cost

to be avoided - A 2 Dimensional example
- wrapping paper for presents comes in predefined

sizes - Any unused areas are waste and will mean you have

to buy more sheets

Practical Applications

- TV advert scheduling
- 5 minute break
- Adverts are all different lengths
- Fit as many adverts in as possible

Why do you need algorithms?

- For this problem you can solve a small example

with a pen and paper just trying all the

combinations of pieces - Like going through combinations on a combination

lock - What about if there were 100 pieces
- Or 100,000 pieces?

Algorithm First-Fit

- Order the pieces from largest to smallest
- Put each piece in the first bin that it will fit

in

Algorithm First-Fit

106

85

84

46

252

127

106

252

127

442

106

252

127

106

252

127

10

252

127

10

252

9

10

9

252

10

12

10

37

12

10

37

12

Capacity 524

Algorithm First-Fit

46

10

10

9

10

9

10

12

10

37

12

10

37

12

442 504 504 504 506 487

487

252

252

252

127

106

84

442

85

127

127

106

252

252

252

127

252

106

127

106

Algorithm First-Fit

524 524 524 524 524 524

524

9

10

37

37

12

10

10

9

10

12

10

10

252

252

252

127

12

46

106

84

442

85

127

127

106

252

252

252

127

252

106

127

106

Algorithm First-Fit

46

10

10

9

10

9

10

12

10

37

12

10

37

12

442 504 504 504 506 487

487

252

252

252

127

106

84

442

85

127

127

106

252

252

252

127

252

106

127

106

Algorithm First-Fit

516 516 516 516 516 517

516 9

9

10

10

12

12

12

37

252

252

252

127

10

10

10

10

84

106

37

442

85

127

127

106

252

252

252

127

252

106

127

106

9

Algorithm Best-Fit

- Order the pieces from largest to smallest
- Put the piece in the bin with the smallest gap,

out of the bins that it fits in

Algorithm Best-Fit

106

85

84

46

252

127

106

252

127

442

106

252

127

106

252

127

10

252

127

10

252

9

10

9

252

10

12

10

37

12

10

37

12

Capacity 524

Algorithm Best-Fit

Still fits into 7 bins!

10

10

9

10

9

10

12

10

37

12

10

37

12

442 504 504 504 506 487

487

442 504 516 516 518 524

524

500 524 516 516 518 524

524

37

37

10

12

12

12

10

252

252

252

127

9

9

106

84

10

10

10

10

442

85

127

127

106

252

252

252

127

252

106

127

106

Outline

- 1) The 1 Dimensional Bin Packing
- 2) The Knapsack Problem
- 3) The Travelling Salesman Problem
- A hard real life problem made up of two of these

The Knapsack Problem

- The Burglars dilemma!
- If a burglar breaks into a house, they cannot

take everything

- Some things are more valuable
- Their bag can only hold a certain amount

The Knapsack Problem

- One container
- Each piece has a weight
- Each piece has a value
- Maximise the value of the items in the bag

Algorithm Highest-Value-First

- For each piece, calculate its value per kg
- Order the pieces by value per kg
- Put the pieces in one by one
- If the piece doesnt fit, go to the next one

until you reach the end

Algorithm Highest-Value-First

A Problem For You

Weight / Value

50 / 100

50 / 25

30/80

30/80

30/80

5/15

5/15

5/15

15/40

5/15

5/15

15/40

15/40

15/40

The Knapsack

Capacity 120

Value 315

Optimal Answer

Weight / Value

50 / 100

50 / 25

5/15

5/15

15/40

15/40

15/40

The Knapsack

5/15

30/80

5/15

30/80

30/80

15/40

5/15

Capacity 120

Value 325

Outline

- 1) The 1 Dimensional Bin Packing
- 2) The Knapsack Problem
- 3) The Travelling Salesman Problem
- A hard real life problem made up of two of these

Travelling Salesman problem

- What is the shortest route visiting each city

exactly once and then returns to the starting

city?

Travelling monkeys

- Monkeys can solve the travelling salesman problem

to a certain extent - Apparently they consider three points into the

future at least

from Nature. 29 May 1997 Vol 387 pp437-532

Applications

- Satellite Navigation in a car finds the shortest

path to your destination, and is constantly

updating - School busses, picking up from many stops in an

area - Parcelforce, FedEx, DHL delivery companies. One

driver will pick up many parcels in an area

Algorithms

- Nearest neighbour algorithm
- Greedy, doesnt think ahead
- Insertion algorithm
- Starts with a rough outline and fills in the gaps
- http//www-e.uni-magdeburg.de/mertens/TSP/node2.ht

ml

Outline

- 1) The 1 Dimensional Bin Packing
- 2) The Knapsack Problem
- 3) The Travelling Salesman Problem
- A hard real life problem made up of two of these

Difficult real world example

- Superstore delivery - 2 problems combined

Superstore delivery

- Pack the lorries efficiently - 3D bin packing
- Using less lorries saves money

Superstore delivery

- Decide the route the lorry will take
- But more difficult than the TSP because of

limited fuel and space so it has to make multiple

trips from the depot

Superstore delivery

- The houses you decide to visit determines which

goods you need to fit into the lorry - If some of the goods fit together very well, then

you may decide to alter the planned routes to

take advantage - So the two problems are interrelated in the

superstore delivery problem

About PowerShow.com

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

Recommended

«

/ »

Page of

«

/ »

Promoted Presentations

Related Presentations

Page of

Home About Us Terms and Conditions Privacy Policy Presentation Removal Request Contact Us Send Us Feedback

Copyright 2018 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

Copyright 2018 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

The PowerPoint PPT presentation: "Three Classic Computer Science Problems, and the Algorithms to Solve Them" is the property of its rightful owner.

Do you have PowerPoint slides to share? If so, share your PPT presentation slides online with PowerShow.com. It's FREE!