# Modelling Complex Systems 2022

This webpage will be populated with material as the course progresses. The handing in of assignments is via studium.

There will be several office hours for people come to ask questions. These will be semi-hybrid so they will be held physically but if there is demand people will also able to ask questions over zoom. First office hour Tuesday 3rd May 1-2pm in office 74116 (hus 7 floor 4).

UPDATE: The resit assignments are now uploaded and linked in brackets after the original assignments for the course. All resit labs and the resit project are due by Friday 26th August (extended from Monday 22nd which it says on the task sheets).

#### Labs and project - task sheets

Lab 1 (resit) : Automata. Lab session Tuesday 5th April, deadline 25th April Wednesday 20th April, deadline 5th May.
Lab 2 (resit) : Networks. Lab session Thursday 28th April, deadline 17th May 11th May.
Lab 3 (resit) : Processes on Networks. Lab session 4th May, deadline 17th May 16th May.
Lab 4 (resit) : Self-propelled particles. Lab session 9th May, deadline 23rd May.
Lab 5 (resit) : Genetic Algorithms. Lab session 12th May, deadline 25th May.

#### Lecture materials

Slides will appear below after the lectures.

Automaton I & II : 21st and 23rd March.

Networks I & II : 7th and 19th April.

Self Propelled Particles I & II : 21st and 25th April.
Video - Simulations of Particle Swarm Optimisation here.

Genetic Algorithms : 25th, 29th April, 2nd May.
Focus on Monte Carlo Tests, second half of 29th April lecture: slides.
Focus on Phase transition plots, first half of 2nd May lecture: slides.

#### Final Project

In this project you are asked to implement and investigate a model described in a scientific paper. You may choose your own paper. It need not be published but it should be available online, e.g. on arxiv. The paper should include simulations and a clear description of a model. Possible topics include self-proplled particle models perhaps with multiple types of particles, genetic algorithms or testing properties of networks.

To discuss the paper, including: possible extensions and suitability of the paper for the project, you may sign up for a timeslot here. List of nice example papers here - note this is a starting point, you do not need to pick a paper from this list!

#### Lab sessions

Lab 5 : Genetic algorithms. Thursday 12th May 1-4pm.

Lab 5 Warm up: GA specifics and implementing painter robot
1. We investigate different ways to 'generate' generation g+1 from generation g. Our setup is k individuals, with 'fitnesses' f(1), f(2), ..... '. Recall parent 1 and parent 2 give rise to child 1 and child 2, via 'cross-over' as in lecture. In the mutation phase each locus on each choromosome can mutate independently with probability p. Choices - how to pick parent 1 and parent 2. E.g. tournament pick $t$ chromosomes at random then take one with highest fitness, with probability proportional to fitness, using threshold function etc. Also note one can choose parents with or without replacement.
2. Check you can implement the robot! As a starting point you may use the matlab or python implementations here.

Lab 4 : Self-propelled particle models. Monday 9th May 9am-12noon.

Lab 4 Warm up: Vicsek model
1. Run an implementation of the Vicsek alignment model with different parameter values. As a starting point you may use Align2D.m from here or the python implementation here. You may also find useful the fast python implementation online here.
2. By varying the parameter values create two videos with qualitatively different behaviour e.g. one with particles tending to become aligned and one where this does not occur.
3. Calculate the polarisation at each time step and plot how polarisation changes over time in one or more runs of the model.
NB: Polarisation of particles with angles $\theta_1, \theta_2, \ldots, \theta_N$ is defined to be $\frac{1}{N}\sqrt{(\sum_j {\rm sin}(\theta_j))^2 +(\sum_j {\rm cos}(\theta_j))^2}$.

Lab 3 : Processes on networks. Wednesday 4th May 9am-12noon.

Lab 3 asks for a phase diagrams as here. They are nothing but 2D histograms with the heights indicated by the shading of the squares. Also in Lab 4 they will be used give an indication of the proportion of runs of the vicsek model which have certain ranges of alignment as $\eta$ varies. Nice example python implementation here. Also in python are imshow and matshow in matplotlib see here for example; and the package seaborn has a heatmap function.

Lab 2 : Network analysis and statistics. Thursday 28th April 1-4pm.

Lab 2 Warm up: Network analysis
1. Find and load a real network with n>200 vertices.
2. Find modularity* of the network (*this will be heuristically calculated value, not the max)
3. Generate Erdos Renyi random graph which has expected number of edges the same as the number of edges in the real network
4. Generate a configuration model random graph with same degree sequence as real network

Lab 2 Resources :

Lab 1 : Automata. Wednesday 20th April 9am-12noon. Tuesday 5th April 1-4pm.
Lab 1 Warm up : Game of Life
1. Simulate Game of Life using your own or existing code.
2. Find an extra pattern of period 1 not covered in the lecture.
3. Find an extra pattern of period 2
4. Find an extra pattern which translates each t steps for some t

Lab 1 Resources :
Getting started. You may wish to start by running the following code.
In Python: a nice implementation with explanations and python file here, or also the following python file game_of_life.py.

#### Course Details

Each lab covers a project each consisting of a series of questions and which will follow the topic introduced in the couple of lectures before. There will be 5 labs (was 6 labs) based assignments each worth 12 points (was 10 points). After each question is a number of points associated with it - which adds to 12 points, except Lab 1 which adds to 10 but will be rescaled to 12 points. There is a final project which will be worth 40 points. The total points over all the questions is 100 (after labs rescaled).

To pass the course (grade 3) you must correctly answer questions amounting to at least 50 points. In order to get grade 4 you must get 70 points. In order to get a grade 5 you must get 75 points and at least 28 points on the final project (implementing a scientific article).

Resits. Deadline will be in summer: now set to be 22nd August. There will be an 'equivalent' re-sit version of Labs 1 to 5 and of the final project. The re-sit lab assignments will each be worth 12 points and the re-sit final project 40 points. It will be possible to do re-sits assignment by assignment, so one could choose to re-sit only some of the assignments. Anyone can choose to re-sit any subset. You will also be able to do these in groups.

Project. The breakdown of how marks will be awarded in the final project can be found here.