Laboratory Exercise

Introduction to Experimentation

Supplemental Material for Baldwin and Scragg, Algorithms and Data Structures: The Science of Computing; Charles River Media, 2004 (Now published by Cengage Learning)

Site Index


Purpose

This lab provides direct experience with the design and conduct of rigorous experiments in computer science. In doing this, it helps students understand what the experimental process involves, and the challenges of doing it well.

Prerequisites

{Prerequisites}

Background

When one of the robots introduced in Chapter 2 of Algorithms and Data Structures: The Science of Computing receives a move message, it does one of two things: either the tile in front of the robot is unobstructed and the robot moves forward, or the tile is obstructed and the robot flashes to indicate a collision. Both of these responses take a noticeable amount of time. This lab involves doing an experiment motivated by the question “which takes longer?”

Experimentation

Good experiments generally require more thought and care than it seems at first. Chapter 4 of Algorithms and Data Structures: The Science of Computing discusses some of the issues that arise in computer science experiments. Sections 4.5 and 4.7, on mathematical tools for controlling and estimating error, and measuring time in Java, respectively, may be particularly useful in this exercise.

Robots

The robot is available as a Java class named Robot (and a supporting class named RobotRoom). Programs that use these classes need to include two Java files: Robot.java and RobotRoom.java. The “Final Details” section of this document explains how to find these files and their documentation.

Any Java source file that refers to the Robot or RobotRoom classes should “import” those classes, via the statement

    import geneseo.cs.sc.*;

at the beginning of the file.

Exercise

Based on informal observations of the robots, intuitions about whether hitting walls or moving freely should be faster, or other criteria, suggest a hypothesis about whether it is faster for a Robot object to handle a move message when the robot is free to move, or when the robot is obstructed. Then design, carry out, and report on an experiment that tests this hypothesis. (Note that the important thing about this exercise is the process of doing the experiment, not whether the hypothesis is right or wrong.)

All experiments follow the same general outline (hypothesis, prediction, procedure, data analysis, conclusions, etc.), but some elements of that outline merit particular note in this experiment:

Final Details

The Robot Class

Students can download both Robot.java and RobotRoom.java from the Web.

Documentation on both classes is also available on the Web. The main documentation page is an index to documentation for all the Java classes written for use with Algorithms and Data Structures: The Science of Computing. To see the documentation for a specific class, click on that class’s name in the left-hand panel of the page.

Submitting Your Work

This lab is due no later than the beginning of your lab session on Monday, Feb. 9.

Turn in a lab report describing your experiment. This report should contain the following:

  1. A statement of the hypothesis the experiment tested.
  2. A statement of the prediction.
  3. An explanation of experimental procedure. A printout of any code written for the experiment can provide much (but seldom all) of the necessary information, shortening the prose part of the report.
  4. All of the data collected. It is important to show raw data so that readers can check the data analysis and conclusions, make their own judgments about error levels, etc. Data are often clearest when shown in a table.
  5. A description of, and the results from, data analysis. In this experiment, this can simply consist of a few additional rows or columns in the table of raw data. (In which case, using a spreadsheet program to build the table, and attaching a printout of the result to the lab report, can save lots of work.)
  6. A statement of the conclusion(s). This should at least state whether the experiment does or does not support the initial hypothesis, and why. It is also an opportunity to comment on or speculate about other things that occur to you during the experiment (for example, do the data suggest new hypotheses or predictions? Are there further experiments that now seem worth doing? Improvements to the present one?)

One and a half to two pages (exclusive of code) is often sufficient to describe an experiment such as this one.


Copyright © 2004 Charles River Media. All rights reserved.

Revised Jan. 30, 2004 by Doug Baldwin

Site Index