Using the Algorithm-Test Environment and Submitting Assignments


The Test Environment:

In this course, you will use two tools developed for testing and submitting programs.

The Algorithm Test Environment is a Java-based testing environment for algorithms:

Download the test environment and run the demo:
  1. Create a new directory called cs151 under your root directory.
  2. Download this jar file (or, if you prefer: a gzipped-tar version) in the cs151 directory.
  3. You will create subdirectories off of cs151 for various assignments and exercises.
  4. Set the class-path so that Java can access the algtest.jar file:
    • UNIX: Add this line in your .profile file in your root directory, substituting your username in the second path.
      
           export CLASSPATH=$CLASSPATH:/home/student/yourusername/cs151/algtest.jar:.
           
      Note: you might need to use:
      
           export CLASSPATH=$CLASSPATH:/home/ugrad/yourusername/cs151/algtest.jar:.
           
      if that's the path to your home directory.
      Don't forget the period at the end. Log out immediately and log back in for the change to take effect.
      Note: you will access a jar file in my submit directory.
    • Windows:
      
             set CLASSPATH=%CLASSPATH%;pathtocs151;. 
           
      where pathtocs151 corresponds to the path to your cs151 directory, for example, C:\myclasses\cs151.
  5. Download this jar file (or a gzipped-tar version) into the cs151 directory to unpack it:
    
           % jar xvf min.jar
         
  6. This will create a directory called min.
  7. Go to the cs151/min directory and run the demo:
    
         % java -jar ../algtest.jar alg.props
         
    You have just executed a test program, Min.java, in the Algorithm-Test environment. Here's an explanation:
    • The test-environment first does some correctness testing, the results of which are that some tests are "passed". If an algorithm fails a test, an appropriate message is displayed.
    • Next, the second phase is performance testing, which plots a graph.
    Now examine the source files:
    • Open the file Min.java.
    • Min.java is a really simple (demo) program: it scans an array to find the least element.
    • The import statements are necessary to be able to use the edu.gwu.algtest package.
      Important: you will need these import statements (but not package statements) for your code.
    • Check that your classpath is correct by compiling Min.java.
    • Now, note that the class Min implements the MinAlgorithm interface as well as the Algorithm interface (which MinAlgorithm extends). The methods getName() and setPropertyExtractor() methods are from the Algorithm interface.

Submission

We have also developed an "assignment submission" tool to help with encrypting and submitting jar files. Essentially, you will write your stuff in a directory, jar the directory, copy the jar file to your submit directory and run our tool on the jar file.

Note: all submissions are to be done on hobbes.

Here are the details, using the first exercise as an example. Substitute your actual Unix username in place of username below.