Australian National University

College of Engineering and Computer Science

ENGN2219

Computing for Engineering Simulation


Assignment 1

Maximum marks 100
Weight 15% of the total marks for the course
Submission deadline 5pm, Friday, April 19
Submission mode Electronic, using subversion
Estimated time 20 hours
Penalty 10% per day

This assignment tests your understanding of the material covered in the first five weeks, up to and including the lecture on Plotting. The assignment will be updated on a regular basis. Clarifications and modifications will be added as and when required. Note that answers should be submitted electronically, using subversion. You will be required to commit one or more files for each question, with specific file names. If you want to commit additional files, for functions that you may have written, that's fine. Just remember to commit the specified files for each question, since that is what we will be looking for as a starting point for your solution.

This is a group assignment and should be completed in groups of 2, unless permission has been obtained from the course convenor to work by yourself. Both people in the group must contribute equally to the assignment. It is strongly recommended that both people in the group work collaboratively, rather than split the workload and work in isolation. Please note that a engn2219 student can only form a group with another engn2219 student, and not with a comp6719 student. Likewise, a comp6719 student can only form a group with another comp6719 student, and not with a engn2219 student.

Note that all work submitted must be entirely your own work. Make certain you use quality information and that you carefully reference all the material that you use. It is unacceptable to cut and paste another author's work and pass it off as your own. Anyone found doing this, from whatever source, will get a zero for the assignment. Any material that you wish to quote should have the source clearly referenced. Read the school's policy on plagiarism, to be found in the Research School of Computer Science Student Handbook.

It is strongly suggested that you start working on the report right away. You can commit as many times as you want. Only the most recent commit will be assessed. Check that your files work on the student system before committing. Please ensure that you copy your committed files to an appropriate folder in your directory on the student system as well.

Note that the ENGN2219 assignment is for the undergraduate students and the COMP6719 assignment for the postgrad students. The two are not interchangeable. If you find problems with this assignment (e.g., something is not clear, or there are broken links), please get in contact with the course lecturer immediately.


Task - Robot Movement Simulation
First posted: Wed Mar 13 11:07:42 EST 2013
Last modified: Tue Mar 19 16:50:13 EST 2013
Questions to: Ramesh Sankaranarayana

R robots are located at the centre of a square room of length L. Each robot moves randomly in a series of discrete steps, in one of four directions, namely, North, East, South or West. At each step, the step size is a random number in the range [0,S] and there is an equal probability of one of the four directions being chosen.

Each wall of the room is of one of the following two types:

  1. Reflecting
    In this case, when the next step of the robot is outside the wall, it is pushed back by the amount that it exceeded the wall. For example, if the step size is 10cm and the current step took it beyond the wall by a distance of 4.4cm, then it will be bounced back by a distance of 4.4cm.
  2. Absorbing
    In this case, when the next step of the robot touches or exceeds the wall, it is absorbed by the wall and terminated.
What you will need to do is to simulate the motion of the robots for a given number of steps, N. You can ignore the width of the walls and assume that more than one robot can occupy the same location. You will need to get the required values as input from the user, namely:
  1. The number of robots R.
  2. The length of the room L, in metres.
  3. The number of steps N.
  4. The maximum size of each step S, in cms.
  5. The type of each wall, reflecting or absorbing.

You are required to do the following tasks:

  1. For a given input, draw a plot, with appropriate title and labels, of the position of the robots from the origin (the centre of the room), as a function of time. Draw a single 3D graph with time on the z-axis, connected lines showing the positions of each robot and use different colors for different robots.
  2. For the same input, draw plots, with appropriate titles and labels, of the average position and standard deviation of the position of the robots, respectively, as a function of time.
  3. Does the absorbing or reflecting nature of the walls have an effect on the measures in task 2? Include your answer as comments in your script. Draw plots, with appropriate titles and labels, to substantiate your answer.

Design your program keeping in mind functionality, the potential for reuse and efficiency of code, and error handling. Your code for the first two tasks should be in a file called robots.m, with user input required for moving from task 1 to task 2. You may use as many functions as required. Functions that you think can be reused must be located in separate files. Document your code as appropriate and write a short report on your approach to solving the problem and on the design of your program in this file, in the form of comments. Your code and answer for task 3 must be in a file called robotAnalysis.m.

Marking Scheme

The marks will be allocated as follows:

Criteria Description Marks
Your solution and design A brief write up of your approach to solving the problem and of your program design as comments in the main program file. Good program construction; appropriate use of data structures and functions; and efficiency of code, including use of builtin operators and functions, and error handling, where appropriate. 15
Documentation Appropriate documentation. This includes program and function descriptions, author details and appropriate commenting of code. Also include the appropriate time spent, in hours, and your feedback, if any, on the assignment. 10
Coding Style This includes use of indentation to make the code easy to read; descriptive variable names; and avoiding the use of global variables. 5
Task 1 The code runs and is correct. The correct plot is generated with appropriate and descriptive title and labels. 30
Task 2 The code runs and is correct. The correct plots are generated with appropriate and descriptive titles and labels. 15
Task 3 The code runs and is correct. Good explanation with appropriate plots, with descriptive titles and labels. 25

Bonus Marks [10 marks]

Only attempt this task after completing the required tasks listed above and ensuring that it all works. Now, assume that the walls can be of the following type as well, in addition to the two stated in the main problem:

  1. Mutating
    In this case, when the robot encounters a wall, a coin is flipped to see if the robot is reflected or absorbed.
Allow for this type of wall in your program. Draw a plot of the number of surviving robots as a function of time, with appropriate title and labels. Save this program in a file called robotsBonus.m.

Submission Guidelines

As stated earlier, you will need to submit your assignments electronically using subversion. Read the information on the assignments page for instructions on electronic submission of assignments.

Late Assignments

If your submission is late, then a late penalty of 10% per day applies. Assignments will not be accepted one week after the deadline.

Extensions

Extensions will only be given under special circumstances. Students should send an email to Dr. Ramesh Sankaranarayana stating the reason for the request and attach supporting documentation (e.g., medical certificate). This should be done before the deadline. Requests for extensions after the deadline will not be accepted.


Last modified: Tue Mar 19 16:50:13 EST 2013
Ramesh Sankaranarayana