Unformatted text preview: ne our formalization of the problem! 18 Problem definition
x Inputs: m: the number of miles done sine last refueling g: the number of gallons of gas consumed since last refueling c: the capacity of the gas tank (in gallons) defaultMpg: the usual average mpg of the car
x Rules: Hypothesis: the car will have the same mpg for the rest of the
Hypothesis:
tank than it achieved since the last refuel.
tank 19 Problem definition
x Rules: If m = 0, then mpg is defaultMpg, else mpg is m / g If m is negative (sensor default), then mpg is defaultMpg If g is negative (sensor default), then milesToRefuel is unknown We assume c and defaultMpg have no error (constants for the car) If g = 0 and m > 0 (electric), then mpg is ‘infinity’ • We select a numerical value, eg, 99, for the mpg in this case 20 A more complete algorithm
Algorithm ComputeMilesLeft:
IInput:
nput: •
•
•
• m: number of miles since last refuel
g: number of gallons consumed since last refuel
c: the capacity of the gas tank (in gallons)
defaultMpg: the default mpg of the car Output: • milesToRefuel: the number of miles before refuel is n...
View
Full Document
 Fall '00
 Melkanoff
 Input/output, mpg

Click to edit the document details