Computer Science Large Practical coursework

50
Computer Science Large Practical Stephen Gilmore School of Informatics Friday 28th September, 2012 Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 1 / 45

description

A description of the Computer Science Large Practical coursework.

Transcript of Computer Science Large Practical coursework

Page 1: Computer Science Large Practical coursework

Computer Science Large Practical

Stephen Gilmore

School of Informatics

Friday 28th September, 2012

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 1 / 45

Page 2: Computer Science Large Practical coursework

Introduction

The requirement for the Computer Science Large Practical is tocreate a command-line application implemented in Objective-C.

The purpose of the application is to implement a stochasticdiscrete-event simulator for chemical reactions.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 2 / 45

Page 3: Computer Science Large Practical coursework

Turing completeness

In theory all programming languages are equally powerful so why notimplement this simulator in Java instead of Objective-C?

In practice certain programming languages are better suited to sometasks than others so it is necessary to learn more than one.

In reality having additional language skills brings additionalopportunities (it turns out that everyone can program in Java).

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 3 / 45

Page 4: Computer Science Large Practical coursework

Simulation

Stochastic simulation is an important tool to help understand thechemical and biochemical processes which are constantly underway inall living things.

Simulation is leading the way in scientific breakthroughs in medicine,farming and veterinary science, with demonstrable benefits for thehealth and wellbeing of humans, plants and animals.

Simulation is important in many other fields also, such as aerospace,transport, logistics, healthcare, and many others.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 4 / 45

Page 5: Computer Science Large Practical coursework

Chemical reactions

Chemical reactions change the concentration of chemical species suchas proteins because molecules are created, altered, combined, brokenapart, or destroyed.

The simulation of these processes takes place one reaction event at atime.

The simulation tracks the number of molecules of each species andterminates when no other reaction can fire, or when a pre-definedsimulation end-time has been reached.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 5 / 45

Page 6: Computer Science Large Practical coursework

Exact versus approximate simulation

We are concerned here with exact stochastic simulation, in whicheach reaction event is simulated.

Other stochastic simulation algorithms exist, called approximatesimulation algorithms.

These estimate the effect of numerous reaction events in order tospeed up a simulation, but we will not be concerned with these here.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 6 / 45

Page 7: Computer Science Large Practical coursework

Chemical reactions

Reaction events change one chemical species into another. For example,the reaction event f ,

f : E + S → C

describes a collision between a molecule of enzyme (E ) and a molecule ofsubstrate (S) to produce a molecule of a compound (C ).

Note

We write E + S to mean “E and S”, not “E plus S”.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 7 / 45

Page 8: Computer Science Large Practical coursework

Law of Mass Action

The rate at which a reaction takes place depends on the number ofmolecules of the reactants which are available (E and S are thereactants here).

The Law of Mass Action for such systems states that the rate atwhich a reaction occurs is proportional to the product of the numberof molecules of the reactants needed.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 8 / 45

Page 9: Computer Science Large Practical coursework

Law of Mass Action (Example)

For example, if there are 5 molecules of E and 5 of S then thereaction proceeds at rate 25f where f is the kinetic constant for thisreaction.

More generally, we would say that the reaction proceeds at ratef × E × S .

Note

We write “E × S” here to mean “the number of molecules of E multipliedby the number of molecules of S”.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 9 / 45

Page 10: Computer Science Large Practical coursework

Reactions and molecule counts

After this reaction has fired, the molecule count of E is decreasedby 1, as is the molecule count of S .

The molecule count of C is increased by 1.

For example, if E and S were 5 before, and C was 0 then afterwardsE and S are 4 and C is 1.

The reaction rate is correspondingly less (now 16f , not 25f ).

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 10 / 45

Page 11: Computer Science Large Practical coursework

Molecule counts can never become negative

Note that this means that when any reactant is exhausted(e.g. S = 0) then the reaction cannot fire.

The rate f × E × S is 0, because of the multiplication

Thus, molecule counts can never become negative.

Note

If your simulator generates negative molecule numbers on any simulationrun then you have a bug in your simulator.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 11 / 45

Page 12: Computer Science Large Practical coursework

Compounds can break apart

Having formed, compounds can break apart again. For example, thereaction event b,

b : C → E + S

describes a molecule of C breaking up into a molecule of E and a moleculeof S .

Law of Mass Action

This time C is the reactant and the Law of Mass Action states that thisreaction proceeds at rate b × C , where b is the kinetic constant for thisreaction.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 12 / 45

Page 13: Computer Science Large Practical coursework

Forming a product

Finally, consider an alternative product reaction which produces a newspecies P (a product).

p : C → E + P

This describes a molecule of C breaking up into a molecule of E and amolecule of P.

Law of Mass Action

Again, C is the reactant and the Law of Mass Action states that thisreaction proceeds at rate p × C , where p is the kinetic constant for thisreaction.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 13 / 45

Page 14: Computer Science Large Practical coursework

Simulation

The simulation of such a system depends on:

the values of the kinetic constants f , b and p,the initial molecule counts of the species E , S , C and P,and the stop-time, when the simulation should terminate.

Given this information in the form of a script, a simulator has enoughinformation to simulate the model, moving from state to state asallowed by the reactions.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 14 / 45

Page 15: Computer Science Large Practical coursework

Simulation script (1/2)

# The simulation stop time (t) is 200 seconds

t = 200

# The kinetic real-number constants of the three reactions:

# forward (f), backward (b) and produce (p)

f = 1.0

b = 0.5

p = 0.01

# The initial integer molecule counts of the four species,

# Enzyme, Substrate, Compound and Product

# (E, S, C, P) = (5, 5, 0, 0)

E = 5

S = 5

C = 0

P = 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 15 / 45

Page 16: Computer Science Large Practical coursework

Simulation script (1/2)

# The three reactions. The ‘forward’ reaction (f)

# makes the compound C, and the ‘backward’

# reaction (b) breaks it apart. The ‘produce’

# reaction (p) makes the product P and releases

# the enzyme E.

f : E + S -> C

b : C -> E + S

p : C -> E + P

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 16 / 45

Page 17: Computer Science Large Practical coursework

Possible forwards, backwards and produce reactions— starting from the state E = S = 5, C = P = 0.

(5, 5, 0, 0)

(4, 4, 1, 0) (5, 4, 0, 1)

(2, 2, 3, 0) (3, 2, 2, 1) (4, 2, 1, 2) (5, 2, 0, 3)

(3, 3, 2, 0) (4, 3, 1, 1) (5, 3, 0, 2)

(1, 1, 4, 0) (2, 1, 3, 1) (3, 1, 2, 2) (4, 1, 1, 3) (5, 1, 0, 4)

(0, 0, 5, 0) (1, 0, 4, 1) (2, 0, 3, 2) (3, 0, 2, 3) (4, 0, 1, 4) (5, 0, 0, 5)

(E, S,C, P )

(E − 1, S − 1, C + 1, P )

(E + 1, S + 1, C − 1, P )

(E + 1, S, C − 1, P + 1)

f

bp

fb

fb fb

fb

fb fb fb

fbfb

fb

fb fb fb fb fb

p

p p

p p p

p p p p

p p p p p

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 17 / 45

Page 18: Computer Science Large Practical coursework

A sample simulation of the first four seconds of theenzyme-substrate example

Columns are time, E, S, C and P.

0.0 5 5 0 0

0.1 4 4 1 0

0.2 4 4 1 0

0.3 4 4 1 0

0.4 4 4 1 0

0.5 3 3 2 0

0.6 2 2 3 0

0.7 2 2 3 0

0.8 2 2 3 0

0.9 1 1 4 0

1.0 1 1 4 0

1.1 1 1 4 0

1.2 2 2 3 0

1.3 1 1 4 0

1.4 1 1 4 0

1.5 1 1 4 0

1.6 1 1 4 0

1.7 1 1 4 0

1.8 1 1 4 0

1.9 0 0 5 0

2.0 0 0 5 0

2.1 0 0 5 0

2.2 0 0 5 0

2.3 0 0 5 0

2.4 1 1 4 0

2.5 2 2 3 0

2.6 1 1 4 0

2.7 1 1 4 0

2.8 1 1 4 0

2.9 1 1 4 0

3.0 1 1 4 0

3.1 1 1 4 0

3.2 1 1 4 0

3.3 1 1 4 0

3.4 1 1 4 0

3.5 1 1 4 0

3.6 1 1 4 0

3.7 1 1 4 0

3.8 1 1 4 0

3.9 1 1 4 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 18 / 45

Page 19: Computer Science Large Practical coursework

A sample simulation of the first four seconds of theenzyme-substrate example

Columns are time, E, S, C and P.

0.0 5 5 0 0

0.1 4 4 1 0

0.2 4 4 1 0

0.3 4 4 1 0

0.4 4 4 1 0

0.5 3 3 2 0

0.6 2 2 3 0

0.7 2 2 3 0

0.8 2 2 3 0

0.9 1 1 4 0

1.0 1 1 4 0

1.1 1 1 4 0

1.2 2 2 3 0

1.3 1 1 4 0

1.4 1 1 4 0

1.5 1 1 4 0

1.6 1 1 4 0

1.7 1 1 4 0

1.8 1 1 4 0

1.9 0 0 5 0

2.0 0 0 5 0

2.1 0 0 5 0

2.2 0 0 5 0

2.3 0 0 5 0

2.4 1 1 4 0

2.5 2 2 3 0

2.6 1 1 4 0

2.7 1 1 4 0

2.8 1 1 4 0

2.9 1 1 4 0

3.0 1 1 4 0

3.1 1 1 4 0

3.2 1 1 4 0

3.3 1 1 4 0

3.4 1 1 4 0

3.5 1 1 4 0

3.6 1 1 4 0

3.7 1 1 4 0

3.8 1 1 4 0

3.9 1 1 4 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 18 / 45

Page 20: Computer Science Large Practical coursework

A sample simulation of the first four seconds of theenzyme-substrate example

Columns are time, E, S, C and P.

0.0 5 5 0 0

0.1 4 4 1 0

0.2 4 4 1 0

0.3 4 4 1 0

0.4 4 4 1 0

0.5 3 3 2 0

0.6 2 2 3 0

0.7 2 2 3 0

0.8 2 2 3 0

0.9 1 1 4 0

1.0 1 1 4 0

1.1 1 1 4 0

1.2 2 2 3 0

1.3 1 1 4 0

1.4 1 1 4 0

1.5 1 1 4 0

1.6 1 1 4 0

1.7 1 1 4 0

1.8 1 1 4 0

1.9 0 0 5 0

2.0 0 0 5 0

2.1 0 0 5 0

2.2 0 0 5 0

2.3 0 0 5 0

2.4 1 1 4 0

2.5 2 2 3 0

2.6 1 1 4 0

2.7 1 1 4 0

2.8 1 1 4 0

2.9 1 1 4 0

3.0 1 1 4 0

3.1 1 1 4 0

3.2 1 1 4 0

3.3 1 1 4 0

3.4 1 1 4 0

3.5 1 1 4 0

3.6 1 1 4 0

3.7 1 1 4 0

3.8 1 1 4 0

3.9 1 1 4 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 18 / 45

Page 21: Computer Science Large Practical coursework

A sample simulation of the first four seconds of theenzyme-substrate example

Columns are time, E, S, C and P.

0.0 5 5 0 0

0.1 4 4 1 0

0.2 4 4 1 0

0.3 4 4 1 0

0.4 4 4 1 0

0.5 3 3 2 0

0.6 2 2 3 0

0.7 2 2 3 0

0.8 2 2 3 0

0.9 1 1 4 0

1.0 1 1 4 0

1.1 1 1 4 0

1.2 2 2 3 0

1.3 1 1 4 0

1.4 1 1 4 0

1.5 1 1 4 0

1.6 1 1 4 0

1.7 1 1 4 0

1.8 1 1 4 0

1.9 0 0 5 0

2.0 0 0 5 0

2.1 0 0 5 0

2.2 0 0 5 0

2.3 0 0 5 0

2.4 1 1 4 0

2.5 2 2 3 0

2.6 1 1 4 0

2.7 1 1 4 0

2.8 1 1 4 0

2.9 1 1 4 0

3.0 1 1 4 0

3.1 1 1 4 0

3.2 1 1 4 0

3.3 1 1 4 0

3.4 1 1 4 0

3.5 1 1 4 0

3.6 1 1 4 0

3.7 1 1 4 0

3.8 1 1 4 0

3.9 1 1 4 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 18 / 45

Page 22: Computer Science Large Practical coursework

A sample simulation of the first four seconds of theenzyme-substrate example

Columns are time, E, S, C and P.

0.0 5 5 0 0

0.1 4 4 1 0

0.2 4 4 1 0

0.3 4 4 1 0

0.4 4 4 1 0

0.5 3 3 2 0

0.6 2 2 3 0

0.7 2 2 3 0

0.8 2 2 3 0

0.9 1 1 4 0

1.0 1 1 4 0

1.1 1 1 4 0

1.2 2 2 3 0

1.3 1 1 4 0

1.4 1 1 4 0

1.5 1 1 4 0

1.6 1 1 4 0

1.7 1 1 4 0

1.8 1 1 4 0

1.9 0 0 5 0

2.0 0 0 5 0

2.1 0 0 5 0

2.2 0 0 5 0

2.3 0 0 5 0

2.4 1 1 4 0

2.5 2 2 3 0

2.6 1 1 4 0

2.7 1 1 4 0

2.8 1 1 4 0

2.9 1 1 4 0

3.0 1 1 4 0

3.1 1 1 4 0

3.2 1 1 4 0

3.3 1 1 4 0

3.4 1 1 4 0

3.5 1 1 4 0

3.6 1 1 4 0

3.7 1 1 4 0

3.8 1 1 4 0

3.9 1 1 4 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 18 / 45

Page 23: Computer Science Large Practical coursework

A sample simulation of the first four seconds of theenzyme-substrate example

Columns are time, E, S, C and P.

0.0 5 5 0 0

0.1 4 4 1 0

0.2 4 4 1 0

0.3 4 4 1 0

0.4 4 4 1 0

0.5 3 3 2 0

0.6 2 2 3 0

0.7 2 2 3 0

0.8 2 2 3 0

0.9 1 1 4 0

1.0 1 1 4 0

1.1 1 1 4 0

1.2 2 2 3 0

1.3 1 1 4 0

1.4 1 1 4 0

1.5 1 1 4 0

1.6 1 1 4 0

1.7 1 1 4 0

1.8 1 1 4 0

1.9 0 0 5 0

2.0 0 0 5 0

2.1 0 0 5 0

2.2 0 0 5 0

2.3 0 0 5 0

2.4 1 1 4 0

2.5 2 2 3 0

2.6 1 1 4 0

2.7 1 1 4 0

2.8 1 1 4 0

2.9 1 1 4 0

3.0 1 1 4 0

3.1 1 1 4 0

3.2 1 1 4 0

3.3 1 1 4 0

3.4 1 1 4 0

3.5 1 1 4 0

3.6 1 1 4 0

3.7 1 1 4 0

3.8 1 1 4 0

3.9 1 1 4 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 18 / 45

Page 24: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (5, 5, 0, 0)

0

1

2

3

4

5

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 19 / 45

Page 25: Computer Science Large Practical coursework

The problem with randomnessHow do you know when you’ve got it right?

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 20 / 45

Page 26: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (10, 10, 0, 0)

0

2

4

6

8

10

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 21 / 45

Page 27: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (50, 50, 0, 0)

0

10

20

30

40

50

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 22 / 45

Page 28: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (100, 100, 0, 0)

0

20

40

60

80

100

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 23 / 45

Page 29: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (500, 500, 0, 0)

0

100

200

300

400

500

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 24 / 45

Page 30: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (1000, 1000, 0, 0)

0

200

400

600

800

1000

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 25 / 45

Page 31: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (5000, 5000, 0, 0)

0

1000

2000

3000

4000

5000

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 26 / 45

Page 32: Computer Science Large Practical coursework

Plotting the simulation output as a time-series plot— initially (10000, 10000, 0, 0)

0

2000

4000

6000

8000

10000

0 50 100 150 200

mol

ecul

e co

unt

time

ESCP

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 27 / 45

Page 33: Computer Science Large Practical coursework

Other ways to display the outputHere we plot the state after each reaction event

0.00000 5 5 0 0

0.08231 4 4 1 0

0.56568 3 3 2 0

0.67220 2 2 3 0

0.83951 1 1 4 0

1.12897 2 2 3 0

1.24503 1 1 4 0

1.84901 0 0 5 0

2.34504 1 1 4 0

2.47735 2 2 3 0

2.57656 1 1 4 0

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 28 / 45

Page 34: Computer Science Large Practical coursework

Removing molecules

In addition to the kinds of reactions we have seen so far, chemical speciescan decay, or otherwise be removed from the simulation.

d : X →

The molecule count of species X is decreased by 1 when this reaction fires,and no other species count is changed.

Reaction rate

The reaction proceeds at rate d × X .

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 29 / 45

Page 35: Computer Science Large Practical coursework

Adding molecules

Chemical species can be created, or otherwise be introduced into thesimulation.

c : → Y

The molecule count of species Y is increased by 1 when this reaction fires,and no other species count is changed.

Reaction rate

This reaction has no reactants and hence fires at a constant rate,determined by the kinetic constant for this reaction.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 30 / 45

Page 36: Computer Science Large Practical coursework

Types of reactions considered

In this practical we will never be concerned with reactions whichinvolve a collision between more than two molecules.

Tri-molecular collisions occur only vanishingly rarely in dilute fluids.

Hence, the number of reactants which a reaction has will either bezero, or one, or two.

Similarly, the number of chemical species produced by a reaction willeither be zero, or one, or two.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 31 / 45

Page 37: Computer Science Large Practical coursework

A special case: dimerisation

Reactions in which two molecules of the same species collide constitutes aspecial case (called dimerisation). In a reaction such as:

d : A + A→ B

the reaction proceeds at rate d × (12 × A× (A− 1)), not d × A× A.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 32 / 45

Page 38: Computer Science Large Practical coursework

A special case: dimerisation (explanation)

This adjusted rate reflects the fact that there are fewer ways for twomolecules of the same type to collide with one another.

Firstly, a molecule cannot collide with itself: hence the subtractionof 1.

Secondly, a collision between A1 and A2 is exactly the same as acollision between A2 and A1: hence the 1

2 factor.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 33 / 45

Page 39: Computer Science Large Practical coursework

SummaryGiven a reaction script, produce a time-series output

# simulate to a limit

# of 10 seconds

t = 10

# decay rate d is 1

d = 1.0

# 100 molecules of X

X = 100

# X decays to nothing

d : X ->

model.txt

⇒Your simulator

written inObjective-C

# t X

0.00, 100

0.01, 98

0.02, 97

0.03, 96

0.04, 95

0.05, 95

0.06, 93

0.07, 91

0.08, 90...

...

model.csv

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 34 / 45

Page 40: Computer Science Large Practical coursework

Requirements (1/2)

It should be possible to read and parse a reaction script

Reaction scripts can be formatted with comments and blank lines

Comments are indicated by a hash symbol (#) and continue until theend of the line

It should be possible to specify the simulation stop-time, reactionkinetic constants and species initial concentrations

The simulation stop-time is always denoted by t

Reaction kinetic constants are positive real values and their identifiersalways begin with a lowercase letter (e.g. a, b, c, . . . , but not t, whichis reserved).

Species initial molecule counts are non-negative integer values and theiridentifiers always begin with an uppercase letter (e.g. A, B, C, . . . ).

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 35 / 45

Page 41: Computer Science Large Practical coursework

Requirements (2/2)

Reaction events should fire according to their propensity, asdetermined by the reaction kinetic constants and the speciesmolecular populations.

The application should produce a comma-separated time-series ofmolecule counts for the species in the reaction script up to thesimulation stop time.

The first column should be the time points of the observations.

The time series should be preceded by a header listing the speciesidentifiers in the order in which they appear in the file.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 36 / 45

Page 42: Computer Science Large Practical coursework

Extra credit

The requirements listed in the section above illustrate the corefunctionality which is required from your application.

A well engineered solution which addresses all of the aboverequirements should expect to attract a very good or excellent mark.

Additional credit will be awarded for additional useful features whichare not on the above list.

Thus, if you have time remaining before the submission deadline andyou have already met all the requirements listed above then you canattract additional marks by being creative, conceiving of new featureswhich can helpfully be added to the application, and implementingthese.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 37 / 45

Page 43: Computer Science Large Practical coursework

Examples of additional features

Examples of features which you might like to consider adding could be thefollowing:

good diagnostic error messages for non-well-formed input scripts;

static analysis to generate warnings for kinetic constants or speciespopulations which are defined but never used;

support for descriptive identifiers for reactions and species (e.g.forward instead of f, and backward instead of b; and Enzyme

instead of E, and Substrate instead of S);

support for numbers in scientific notation (e.g. writing 1e-10 insteadof 0.0000000001 and 1e12 instead of 1000000000000).

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 38 / 45

Page 44: Computer Science Large Practical coursework

Early submission credit (1/2)

In software development, timing and delivery of completed applicationsand projects can be crucial in gaining a commercial or strategic advantageover competitors. Being the first to market means that your product hasthe opportunity to become known and similar products which come latermay struggle to make the same impact, simply because they becameavailable second.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 39 / 45

Page 45: Computer Science Large Practical coursework

Early submission credit (2/2)

In order to motivate good project management, planning, and efficientsoftware development, the CSLP reserves marks above 90% for work whichis submitted early (specifically, one week before the deadline for Part 2).To achieve a mark above 90%, a practical submission must be excellent inall technical and functional aspects, correctly implement the Gillespiealgorithm, be implemented in idiomatic Objective-C, and otherwise meetall requirements of the practical, and in addition to this it must besubmitted early.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 40 / 45

Page 46: Computer Science Large Practical coursework

Assessment criteria (1/2)

This practical exercise will be assessed in terms of the completeness,correctness and efficiency of the simulator, and the quality of theObjective-C code using features of the language well.

For example, all other things being equal, a simulator which correctlyimplements dimerisation will get more marks than one which doesnot.

A more accurate simulator will get more marks.

Efficiency is very important in simulators which may need to deal withmillions of reaction events. The main loop of the simulation shouldbe carefully coded to avoid unnecessary object allocations and otherinstructions.

A more efficient simulator will get more marks.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 41 / 45

Page 47: Computer Science Large Practical coursework

Assessment criteria (2/2)

A well-structured Objective-C application with classes, interfaces andprotocols will be preferred to one which is not structured.

Writing idiomatic Objective-C code will gain marks.

All else being equal, an application which compiled reports staticanalysis errors should expect to attract fewer marks than one whichdoes not.

Sloppy development style ignoring compiler warnings will lose marks.

Additionally, all else being equal, an application whose code containsexamples of poor programming style (such as unused variables, deadcode, blocks of commented-out code etc) should expect to attractfewer marks than an application which does not have these problems.

Poor programming style will lose marks.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 42 / 45

Page 48: Computer Science Large Practical coursework

Marking process (1/3)

1. A new, previously-unseen simulation script is created.

The application will be tested on both seen and unseen simulationscripts.

2. The accompanying documentation is read for instructions on how touse the application.

Submissions with insufficient documentation will lose marks here.

3. The Objective-C project is compiled and inspected for errors orwarnings

Submissions with errors or static analysis warnings will lose marks here

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 43 / 45

Page 49: Computer Science Large Practical coursework

Marking process (2/3)

4. The compiled code is run on previously-seen sample simulation scripts

Submissions which fail to execute will lose marks here

Submissions which produce incorrect output will lose marks here

5. The compiled code is run on previously-unseen sample simulationscripts

Submissions which fail to execute will lose marks here

Submissions which produce incorrect output will lose marks here

6. The submitted simulation scripts are inspected as evidence ofdeveloper testing.

Submissions which have had insufficient testing will lose marks here

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 44 / 45

Page 50: Computer Science Large Practical coursework

Marking process (3/3)

7. Other additional features of the application will be explored

Submissions with useful additional features will gain marks here

8. The Objective-C source code will be inspected for good programmingstyle

Submissions with insufficient structure will lose marks here

Submissions which do not use Objective-C features will lose marks here

Submissions with too few comments will lose marks here

Submissions with blocks of commented-out code will lose marks here

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 28th September, 2012 45 / 45