Chapter 4 (sort of): How Universal Are Turing Machines? CS105: Great Insights in Computer Science

Similar documents
CS 221 PROJECT FINAL

CSE 3401: Intro to AI & LP Uninformed Search II

The Mathematics of Gambling

Aryeh Rappaport Avinoam Meir. Schedule automation

CSE 3402: Intro to Artificial Intelligence Uninformed Search II

Process Control Loops

CS Lecture 5. Vidroha debroy. Material adapted courtesy of Prof. Xiangnan Kong and Prof. Carolina Ruiz at Worcester Polytechnic Institute

Full file at

CMIMC 2018 Official Contest Information

MIKE NET AND RELNET: WHICH APPROACH TO RELIABILITY ANALYSIS IS BETTER?

Basketball field goal percentage prediction model research and application based on BP neural network

Software Engineering. M Umair.

Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) Computer Science Department

Better Search Improved Uninformed Search CIS 32

Introduction. AI and Searching. Simple Example. Simple Example. Now a Bit Harder. From Hammersmith to King s Cross

Evaluating and Classifying NBA Free Agents

Tower Rescue Lesson Three Tower Rescue: Operations

Polynomial DC decompositions

CS472 Foundations of Artificial Intelligence. Final Exam December 19, :30pm

Machine Learning an American Pastime

Lesson 22: Average Rate of Change

PEAPOD. Pneumatically Energized Auto-throttled Pump Operated for a Developmental Upperstage. Test Readiness Review

Probability: Bernoulli Trials, Expected Value, and More About Human Beings!

CMSC131. Introduction to Computational Thinking. (with links to some external Scratch exercises) How do you accomplish a task?

Problem Solving Agents

NCSS Statistical Software

CENG 466 Artificial Intelligence. Lecture 4 Solving Problems by Searching (II)

LOCOMOTION CONTROL CYCLES ADAPTED FOR DISABILITIES IN HEXAPOD ROBOTS

A IMPROVED VOGEL S APPROXIMATIO METHOD FOR THE TRA SPORTATIO PROBLEM. Serdar Korukoğlu 1 and Serkan Ballı 2.

Queue analysis for the toll station of the Öresund fixed link. Pontus Matstoms *

A Hare-Lynx Simulation Model

BOOGIE WOOGIE FORMATION

Presented By: Arleigh Robar. President/CEO RuSafe Inc.

Predicting the Total Number of Points Scored in NFL Games

MEETPLANNER DESIGN DOCUMENT IDENTIFICATION OVERVIEW. Project Name: MeetPlanner. Project Manager: Peter Grabowski

STAT 625: 2000 Olympic Diving Exploration

7 th International Conference on Wind Turbine Noise Rotterdam 2 nd to 5 th May 2017

Cricket Team Selection and Analysis by Using DEA Algorithm in Python

Project Title: Pneumatic Exercise Machine

Decision Trees. Nicholas Ruozzi University of Texas at Dallas. Based on the slides of Vibhav Gogate and David Sontag

1 Streaks of Successes in Sports

Chapter 2 Ventilation Network Analysis

2.5. All games and sports have specific rules and regulations. There are rules about. Play Ball! Absolute Value Equations and Inequalities

Grade 2-3 MATH Traffic Safety Cross-Curriculum Activity Workbook

2 When Some or All Labels are Missing: The EM Algorithm

Online Companion to Using Simulation to Help Manage the Pace of Play in Golf

SEARCH TREE. Generating the children of a node

Estimating Paratransit Demand Forecasting Models Using ACS Disability and Income Data

Practice Task: Trash Can Basketball

Uninformed search methods II.

Koh Phi Phi Island, West Coast, Thailand Learn to dive Koh Phi Phi - Standard

Golf. By Matthew Cooke. Game Like Training

ECONOMICS DEPT NON - ASSESSED TEST. For Internal Students of Royal Holloway. Time Allowed: 1 hour. Instructions to candidates:

March Madness Basketball Tournament

Koh Phi Phi Island, West Coast, Thailand Learn to dive on Koh Phi Phi (Upgraded)

5.1 Introduction. Learning Objectives

Simplicity to Control Complexity. Based on Slides by Professor Lui Sha

CHAPTER 3 : AIR COMPRESSOR

OPTIMAL FLOWSHOP SCHEDULING WITH DUE DATES AND PENALTY COSTS

CVEN Computer Applications in Engineering and Construction. Programming Assignment #4 Analysis of Wave Data Using Root-Finding Methods

Become Expert at Something

Analysis of Professional Cycling Results as a Predictor for Future Success

January 2011 Condor Corner Frank Paynter

Uninformed search methods

Naïve Bayes. Robot Image Credit: Viktoriya Sukhanova 123RF.com

Ranking teams in partially-disjoint tournaments

A Network-Assisted Approach to Predicting Passing Distributions

Prediction Market and Parimutuel Mechanism

Rulebook Revision 2016 v1.0 Published September 18, 2015 Sponsored By

OXYGEN POWER By Jack Daniels, Jimmy Gilbert, 1979

Working with Object- Orientation

Tokyo: Simulating Hyperpath-Based Vehicle Navigations and its Impact on Travel Time Reliability

PREDICTING the outcomes of sporting events

MA PM: Memetic algorithms with population management

March Madness Basketball Tournament

Dive Planet. Manual. Rev Basic User Interface. 2 How to organize your dives. 3 Statistics. 4 Location Service and Map View.

The use of Control Charts with Composite materials. E. Clarkson, Statistician ASQ Certified Quality Engineer

Instruction Guide for using Dive Tables (draft)

Global Journal of Engineering Science and Research Management

Lesson five. Clearance. Terminal Objective

A Novel Gear-shifting Strategy Used on Smart Bicycles

Transposition Table, History Heuristic, and other Search Enhancements

ECE 697B (667) Spring 2003

AP Lab 11.3 Archimedes Principle

Box-and-Whisker Plots

A new Decomposition Algorithm for Multistage Stochastic Programs with Endogenous Uncertainties

Measuring Length. Goals. You will be able to

Opleiding Informatica

Robust Imputation of Missing Values in Compositional Data Using the R-Package robcompositions

How many intakes can I operate from the control center? Up to 4 intakes can be controlled from the control center.

Optimizing Cyclist Parking in a Closed System

Student Outcomes. Lesson Notes. Classwork. Example 1 (6 minutes)

FAI MICROLIGHT COMMISSION (CIMA) Meeting to be held at the Olympic Museum, 1, Quai d'ouchy, in Lausanne, Switzerland on 14 &15 November 2003

Well-formed Dependency and Open-loop Safety. Based on Slides by Professor Lui Sha

The Game of Yinsh (Phase II)

Iteration: while, for, do while, Reading Input with Sentinels and User-defined Functions

FEATURES. Features. UCI Machine Learning Repository. Admin 9/23/13

Cryostream 800 Series

Search I. Tuomas Sandholm Carnegie Mellon University Computer Science Department. [Read Russell & Norvig Chapter 3]

Critical Systems Validation

Transcription:

Chapter 4 (sort of): How Universal Are Turing Machines? CS105: Great Insights in Computer Science

Some Probability Theory If event has probability p, 1/p tries before it happens (on average). If n distinct events are equally likely, ~n ln n tries before we see all n of them (order independent) or ~n 2 (in order). If we start with a number n, we can cut it in half log n times before 1 is reached.

State of the Art The... Mersenne twister algorithm, by Makoto Matsumoto and Takuji Nishimura in 1997... has a colossal period of 2 19937-1 iterations (probably more than the number of computations which can be performed in the future existence of the universe), is proven to be equidistributed in 623 dimensions (for 32-bit values), and runs faster than all but the least statistically desirable generators. Python has a package for this generator.

Paranormal Clickers

Chapter 5: Algorithms and Heuristics CS105: Great Insights in Computer Science

Here s Where We Stand Before that, we discussed how a computer could be created starting from bits and wires and working up to a high-level language. In classic CS style (reduction!), we now take the lower levels for granted and build on them to create new capabilities.

Sock Matching Hillis begins Chapter 5 with an example. We ve got a basketful of mixed up pairs of socks. We want to pair them up reaching into the basket as few times as we can.

Sock Matching Hillis begins Chapter 5 with an example. We ve got a basketful of mixed up pairs of socks. We want to pair them up reaching into the basket as few times as we can.

Sock Sorter A Strategy: Repeat until basket empty - Grab a sock. - Grab another. basket empty grab a sock grab a sock ~ toss back sock1, sock2 - If they don t match, toss them back in the basket. Will this procedure ever work? Will it always work?

Measuring Performance Hillis asserts that the time-consuming part of this operation is reaching into the basket. Let s say we have 8 pairs of socks. How many times does this strategy reach into the basket? Min? Max? Average? How do these values grow with increasing numbers of pairs of socks?

Sock Sorter B Strategy: Repeat until basket empty - Grab a sock. - Is its match already on the bed? basket empty grab a sock on bed put sock on bed - If not, put it on the bed.

Measuring Performance Once again, let s imagine we have 8 pairs of socks. How many times does this strategy reach into the basket? Min? Max? Average? How do these values grow with increasing numbers of pairs of socks?

Repeat For Each Sock socka Do you have a matching pair? Set it aside. Do you have a nonmatching pair? Put them back in the basket. sockb Is there a match on the table? Pair them and set the pair aside. Otherwise, find an empty place on the table and set the sock down.

Notable if No Table One disadvantage of sockb is that you must have a big empty space available. What if you can only hold two socks at a time? Suggest for a competitor for socka?

Sock Sorter C Strategy: Repeat until basket empty - Grab a sock. - Grab another. basket empty grab a sock grab a sock ~ toss back sock2 grab a sock - Repeat until they match: - Toss one into the basket. - Grab a replacement.

Measuring Performance Once again, let s imagine we have 8 pairs of socks. How many times does this strategy reach into the basket? Min? Max? Average? How do these values grow with increasing numbers of pairs of socks?

Round #2 socka Do you have a matching pair? Set it aside. Do you have a nonmatching pair? Put them both back in the basket. sockc Do you have a matching pair? Set it aside. Do you have a nonmatching pair? Put one back in the basket.

Analysis of sockc Roughly the same number of matching operations, but since it always holds onto one sock, roughly half the number of socks taken out of the basket. When might this approach fail in the real world? Does socka suffer from this difficulty?

Algorithms socka, sockb, and sockc represent different approaches to solving the problem of sock sorting. A concrete approach to solving a problem is called an algorithm. Different algorithms can be better or worse in different ways.

Lessons Learned Given a notion of time (# of socks removed or # of statements executed), can compare different algorithms based on the time they take. Hard to believe they solved the same problem. They really are different, so use good algorithms.

You Think You Have Problems The sock matching problem is a little silly, because the right answer seems sort of obvious. Algorithms researchers pride themselves on finding simple-sounding problems for which the best algorithm is not obvious. Ah, but what s a problem? It should have a welldefined input and a well-defined output.

Decision Problems on Lists A natural class of problems is decision problems on lists of numbers. That is, the input is a list of numbers and the output is a decision, essentially a bit (True or False, yes or no). We ll try some examples and see if we can find efficient algorithms for solving different problems.

List Membership Problem: Is x in the list? Given a list of numbers and a number x, is the number x in the list? Is 83 in the list?

List Membership Problem: Is x in the list? Given a list of numbers and a number x, is the number x in the list? Is 83 in the list? 48, 40, 14, 46, 31, 0, 27, 12, 22, 71, 45, 63, 30, 64, 83, 28, 97, 90, 85, 52

Loop on List Runs through list. Checks if each element equals x. If it finds one, says yes right away. If it reaches the end of the list, says no.

Sum Divisible By 5? Problem: Is the sum divisible by 5? Given a list of numbers, is the sum of the numbers divisible by 5? Is the sum divisible by 5?

Sum Divisible By 5? Problem: Is the sum divisible by 5? Given a list of numbers, is the sum of the numbers divisible by 5? Is the sum divisible by 5? 48, 40, 14, 46, 31, 0, 27, 12, 22, 71, 45, 63, 30, 64, 83, 28, 90, 85, 52

Direct Method i points to each element of the list in turn total keeps the running sum afterwards, test divisibility by 5

Finding the Max Problem: Is the max x? Given a list of numbers and a number x, is the largest number in the list equal to x? Is the max 98?

Finding the Max Problem: Is the max x? Given a list of numbers and a number x, is the largest number in the list equal to x? Is the max 98? 48, 40, 14, 46, 31, 0, 27, 12, 22, 71, 45, 63, 30, 64, 83, 28, 97, 90, 85, 52

How Do You Do It? Specifying an algorithm to the computer is like talking to a little kid. You need to spell out everything precisely. Let s try.

Product Divisible By 5? Problem: Is the product divisible by 5? Given a list of numbers, is the product of the numbers divisible by 5? Is the product divisible by 5?

Product Divisible By 5? Problem: Is the product divisible by 5? Given a list of numbers, is the product of the numbers divisible by 5? Is the product divisible by 5? 48, 41, 14, 46, 31, 2, 27, 12, 22, 71, 44, 63, 33, 64, 83, 28, 96, 87, 52

Anatomy of a Loop Set initial conditions. Run through all elements (i is points to each of the elements). Update the value. Report the answer.

Finding the Median Problem: Is the median x? Given a list of numbers and a number x, is the median number in the list equal to x? Is the median 45?

Finding the Median Problem: Is the median x? Given a list of numbers and a number x, is the median number in the list equal to x? Is the median 45? 48, 40, 14, 46, 31, 0, 27, 12, 22, 71, 45, 63, 30, 64, 83, 28, 90, 85, 52

Check the Median Assuming we can sort (soon!)... Sort, then check the middle item. Sorting is relatively slow (try it).