Computability - PowerPoint PPT Presentation

About This Presentation
Title:

Computability

Description:

Computability Reports. More examples. Homework: Optimization. Other follow-ups. Start to plan presentation. – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 21
Provided by: Jeanin76
Category:

less

Transcript and Presenter's Notes

Title: Computability


1
Computability
  • Reports. More examples.
  • Homework Optimization. Other follow-ups. Start
    to plan presentation.

2
Reports
  • FYK algorithm
  • Other shuffles
  • Other searches.

3
Overview
  • Describe certain problems
  • what are the critical metrics?
  • general description
  • You MAY investigate for topic for your
    presentation
  • Note computability topics also okay

4
Minimal spanning tree
  • Consider a directed weighted graph vertices and
    edges, with weights for the edges.
  • Find (a) tree a subset of all the edges that
    connects all the vertices, no cycles, and has
    minimal total weight.
  • Many solutions
  • O(e log(e)) where e is number of edges.
  • Trying everything is e!

5
Kruskal's algorithm
  • Class of algorithms called greedy does the
    immediate best thing.
  • sort the edges in order of weights
  • start off with each vertex in a partition by
    itself. The idea is to produce a partition
    containing all the vertices.
  • partition represented by a list of its vertices.
    There also is a list of vertices with a
    name/representative of its current partition.
  • add edges, next smallest first, say V to W
  • check if V and W in same partition. If so, don't
    add edge.
  • If different partitions, combine those two
  • stop when new partition has all the vertices
  • http//www.unf.edu/wkloster/foundations/KruskalAp
    plet/KruskalApplet.htm

6
Path finding
  • Find possible, shortest, cheapest path from a
    starting point to an end point in place with
    obstacles.
  • May or may not know address (coordinates of end
    point)
  • Problem represented using map and/or graph
  • Specific case Traveling Salesman's problem
  • Two forms find shortest route hitting all stops
    (cities) on a list
  • Find a route shorter than distance L.

7
Algorithms
  • See A http//www.policyalmanac.org/games/aStarTu
    torial.htm
  • Research map / direction programs.
  • Very general case find path of robot through
    crowded workspace
  • Space is more than 3D robot has position and
    orientation

8
Optimization problem
  • General description
  • A situation involves picking a set (vector) of
    values, x1, x2, , xn
  • There are constraints (specified as inequalities
    or equalities) and
  • there is a single objective function something
    to minimize or maximize.
  • What is the set of x's that satisfy constraints
    AND yield the best objective function?
  • If constraints and objective function linear
    equations, then this is linear programming
    problem.

9
Example
  • Let's suppose that a merry farmer has 75 roods (4
    roods 1 acre) on which to plant two crops
    wheat and corn. To produce these crops, it costs
    the farmer (for seed, water, fertilizer, etc. )
    120 per rood for the wheat, and 210 per rood
    for the corn. The farmer has 15,000 available
    for expenses, but after the harvest the farmer
    must store the crops while awaiting favorable or
    good market conditions. The farmer has storage
    space for 4,000 bushels. Each rood yields an
    average of 110 bushels of wheat or 30 bushels of
    corn. If the net profit per bushel of wheat
    (after all the expenses) is 1.30 and for corn is
    2.00, how should the merry farmer plant the 75
    roods to maximize profit?

10
Farmer example, cont.
  • Constraints
  • 120x 210y lt 15000 expenses
  • 110x 307 lt 4000 storage
  • xy lt75 space
  • Objective function isProfit (110)(1.3)x 
    (30)(2)y  143x  60y
  • See http//www.matrixlab-examples.com/linear-progr
    amming.html

11
Aside
  • General remark on decisions in life
  • can be useful to distinguish constraints from
    objective function.
  • For best results in mathematical/formal terms,
    need to focus on one objective function.
  • May not be guaranteed best answer, but perhaps a
    pretty good one.
  • ???

12
Encoding compression
  • How to take a data set and compress it in order
    to store or transmit. Then decompress
  • Methods are
  • lossless get back to original
  • Examples zipped files
  • lossy don't get back to original, but good
    enough
  • Example jpg, others.

13
Huffman encoding
  • Consider a text made up of symbols or words.
  • Initially, all symbols take the same amount of
    space. All words depend on their length.
  • But what if certain symbols are much more common?
    Say the letter e. What if certain words are much
    more common, say the?
  • Approach use small(er) number of bits for e and
    progressively more for other symbols. Do similar
    thing for words.
  • Complexity O(nlog(n))
  • Alternative use a common list of frequent
    symbols/words and encode accordingly. That is,
    assume the is most common.

14
Run length encoding
  • Consider a picture (best to NOT think of
    photograph)
  • Instead of storing w h pixels, consider row by
    row and store run information n pixels of the
    name color gets stored as (row,color,start,n)

15
Vector images
  • Consider again an image, say constructed using
    Flash or Illustrator.
  • Previous picture stored as
  • background aqua rectangle (w h)
  • smaller green circle at center x,y, radius r
  • rectangle at top x, top y, bottom x, bottom y
  • You can do experiment of comparing bitmapped
    images with rasterized/vectorized.

16
Media formats
  • Images jpg,png, bmp
  • Audio
  • music
  • mpg3
  • speech
  • ?
  • Video

17
Graphs
  • Existence of path from node a to node b in a
    directed graph
  • PATH ltG,s,tgtG is a directed graph that has a
    directed path from s to t
  • Proof Don't just do brute-force seach starting
    from s and trying all edges. Instead,
  • 1) Mark node s.
  • 2) Consider list of edges. If an edge (a,b) is
    from a marked node to an unmarked node, mark b.
    Were any new nodes marked? If no, stop. If yes,
    repeat.
  • 3) If t is marked, there is a path.

18
Analysis of algorithm
  • Size of problem is m number of edges.
  • Step 2 happens at most m times.
  • Each step 2 takes at most m operations.
  • So adding in constant for start and at most m for
    scanning to see if t is in the marked set, this
    is O(n2).

19
Hierarchy
  • constant
  • O(log(n))
  • linear O(n)
  • polynomial, strictly highest term O(np)
  • exponential, O(2n)
  • factorial, O(n!)

20
Homework/preview
  • Follow up on topics
  • Formulate a real-life problem that you are
    willing to share in optimization terms.
  • Preview will now define the class P and the
    class NP.
Write a Comment
User Comments (0)
About PowerShow.com