# Constraint Programming Module Result – 80%

One of the more challenging modules I’ve taken at York is Constraint Programming. It’s was an interesting module to take because it was much more mathematical than other things I have done before, and also because it introduced an entirely new way to think about programming and problem solving in general.

Most of the programming I have done has been procedural or, in other words, telling the computer how to solve a problem. Constraint Programming on the other hand allows you to specify a problem through constraints and then ask a finite domain solver to solve it.

Important elements of the process that we covered were: Developing an abstract syntax of a problem; converting from an abstract syntax to a concrete syntax (The constraint programming language MinZinc); symmetry breaking, implied and dominance constraints, and configuring search through the problem space.

The complete process came together in the 100% weighted coursework, in which we developed a solution to determine the minimum number of sheets, of a given size, required to satisfy a given demand for certain sizes of ply wood.

I was given a grade of 80% for the coursework, which I was happy with :) This now means that I have all of my grades for the first half of the taught part of my course:

• Model-Driven Engineering: 80%
• Concurrent and Real-Time Programming: 99%
• Evolutionary Computation: 80%
• Constraint Programming 80%
• Average: 84.75%

This means that now, short of an absolute disaster, I should achieve an overall mark of distinction in the taught part of the degree.   :-) However, there is no rest for the wicked and I am already around half way through the coursework for my Formal Specification and Topics in Privacy and Security modules.

Danny

# Introducing CSBlogs.com

Between studying hard for my masters degree — and applying for jobs for when it ends — I have managed to find some time to set up a new website called CSBlogs.com

People who have been reading this blog for a few years will have seen HullCompSciBlogs.com mentioned a few times, for those that haven’t it was a service which aggregated all of the blog feeds of computer science students at the University of Hull.

John Van Rij did a great job of keeping that service online, but unfortunately doesn’t have time to maintain it anymore. Since the service went down I have grown to miss it — I guess I didn’t realise how much enjoyment I get from seeing how well everyone is doing from back in Hull — current students, alumni and even lecturers.

In order to resolve this problem I set up CSBlogs.com with the aim of getting all of the Hull Computer Science bloggers and others from around the country onboard.

The project is entirely open source, under the MIT license, and can be forked, modified and improved by the community on Github.

The website itself is hosted on Microsoft Azure and utilises CloudFlare to provide security, analytics and a global content delivery network. Node.js is used as the backend programming language and the MongoDB NoSQL database is used for persistent data storage. Nodes packages are used extensively, including Express.js for routing, Handlebars for data-binding to the front end and LESS-Middleware to improve CSS development.

Complicated acronyms aside I have worked hard to make setting up a local development environment and contributing source as easy as possible for beginners via the instructions I have written on the homepage of the Github repository. I would really recommend any 1st or 2nd year students give it a go — open source development looks great on your CV! And if you need any help contact me as per the instructions.

We are currently in the process of setting up all of the required frameworks and technologies and writing guides for how to get involved (this has actually been one of the more challenging and interesting parts of the project so far) and hope to have a working minimum viable product in the next week.

At this point I would like to thank Charlotte Godley, Alex Pringle & Rob Crocombe for their extensive help in getting the project to where it is now. Charlotte has taken on a role of project management, Alex has developed a rudimentary database controller and Rob has been working on implementing less.js support and developing a theme for the site.

I will keep the blog updated with progress on the project.

Danny

# EVCO – Evolutionary Computation Coursework and Module Result – 80%

The Evolutionary Computation module I took in my first term of this year was assessed through one piece of coursework worth 100% of the module.

In this coursework we had to design an evolutionary algorithm to produce tanks for a tank battle game called Robocode. The algorithms we designed were judged on their ability to produce tanks which were robust against a diverse range of other tanks — in other words their ability to solve a multi-objective problem evolutionarily.

Many forms of evolutionary algorithm could have been used to develop these tanks, however because all tanks in Robocode are compiled Java classes I decided to use a Grammatical Evolution algorithm. As well as the standard GE algorithm I also produced a coevolutionary algorithm which employed grammatical evolution.

I found the real skill in evolutionary computation was working out which parameters to use in such an algorithm (e.g. What population size, how often should mutation of a gene take place on average, which breeding method should be used, how many codons of genes should there be), and developing a BNF grammar that wouldn’t result in too much recursion and therefore invalid tanks once you ran out of genes to generate code which got you out of the recursion, but was still useful.

The coursework was marked based on the report we produced explaining our decision making processes, analysing our algorithms and using statistical methods to evaluate our algorithms and tanks. By the time I was finished I had written 15 pages and had a further 25 pages of appendices.

Overall I found the coursework quite enjoyable, and the best tank I produced was quite amusing to watch as it flailed around the screen constantly rotating its turret and shooting at any enemy it could find.

I’m happy to say that I found out last week that I achieved a grade of 80% for the coursework, and therefore for the module overall. This keeps me on track for the Distinction I so badly want in the degree overall.

Danny

# 5 cool reasons to use LaTeX

One of the differences between undergraduate level study and masters level study is the amount of report writing you do. I can only think of two times in my bachelors degree that I wrote a significantly sized report — and one of those was my dissertation. So far in my MSc I am yet to have handed in a coursework without a report.

During he early stages of my third year I discovered a tool (language?) called $\LaTeX$, however it would be yet another thing to learn alongside my 4 large modules and everything I needed to learn to do my dissertation, so I gave it a miss. This year I decided I would finally give it a go, see what all the fuss was about and see whether it could really replace a Microsoft Word shaped hole in my life.

It did. LaTeX offers a lot of advantages over Microsoft Word, LibreOffice and many other Word Processors, some of the more interesting ones I’ll talk about here. (Note: this isn’t a tutorial, just some observations — so if you don’t know anything about LaTeX I recommend you look it up online first)

## 1 – Better Source Control

$\LaTeX$ produces full PDF output, including tables images and other complex objects, from declarations made in plain text. If you’re not quite sure how to think about $\LaTeX$ sometimes it’s best to think of it like a Markup language — such as HTML — in which you tell it what you want in plain text and it creates the graphical representation.

Git Diff of LaTeX

Because all of the declarations are in plain text it makes source control really easy. Above you can see an image of a git diff in the Github application on OS X. Showing the difference between binary (.doc) word files is impossible, showing differences between Open Office XML files is difficult to decipher at best.

## 2 – Include code and automatically Syntax Highlight it

Using the listings package you can pull it code from other files on your system and automatically syntax highlight it using colours of your choice. No more copy and pasting code into your report over and over when you make changes.

First use the listings package, and load the programming language(s) you would like to include in your document. Optionally include the XColour package for some more interesting colours to use to syntax highlight your code.

% In your preamble
\usepackage{listings}
\usepackage[usenames,dvipsnames]{xcolor}


Then set up the colours you want keywords, comments and strings etc to appear as, as well as some basic settings such as line wrapping. You can redefine these at any point in your document if you need to change the colours for different bits of code for any reason:

\lstset{%
basicstyle=\ttfamily\color{black},
keywordstyle=\ttfamily\color{CornflowerBlue},
stringstyle=\color{SeaGreen},
identifierstyle=\color{Mahogany},
showstringspaces=false,
breaklines=true}


Now you can just include any code files…

\lstinputlisting[language=Ruby]{path/to/code.rb}


or any inline code snippets you like

\begin[language=Java]{lstlisting}
//This is a comment in Java
System.out.println("I love printing to stdio");
\end{lstlisting}


I personally prefer to include from files, so that I can edit the code that is being displayed in my preferred editor for that language. Additionally, if you are required to dump all of your source code in a report, as was required of me recently, this is a nice way to ensure any updates to that source code are displayed in your final document without any work on your behalf.

## 3 – Run a Script from inside your documents

If you run a Unix-like operating system with a bash shall, such as Linux or OS X, then you can compile your $\LaTeX$ documents with the --shell-escape flag which allows you to embed bash scripts inside your document that get run when the document gets compiled.

I recently used this to run a bash script which counted the number of words inside the document that was being compiled, meaning I could have an always accurate word count printed inside the document. Handy.

I could also envisage this being useful to generate pretty PDF reports of services on a server or other systems. An guide on how to achieve something like this is available at CTAN.

## 4 – Easily cite other peoples work and change reference style

Using the Bibtex bibliography subsystem for $\LaTeX$ you can write your references in a simple, almost JSON like, syntax — as shown below:

@online
{
demes,
author = {Vesselin K. Vassilev and Julian F. Miller and Terence C. Fogarty},
title = {The Evolution of Computation in Co-evolving Demes of Non-uniform Cellular Automata for Global Synchronisation},
year = 2007,
urldate = {2015-01-25}
}


When you come to cite this article in the body of your document you can just write \cite{demes} and it will print out the correct citation style as specified in your documents preamble, and print the full information about the article in the correct style in your bibliography. At York we use the IEEE citation system, and so the above is output like so:

Inline citation IEEE

Bibliography IEEE

However, if I change this one line in my preamble from:

\usepackage[backend=biber, style=harvard]{biblatex}


to

\usepackage[backend=biber, style=authoryear-ibid]{biblatex}


Then my references and citations show up in the Harvard style, as I used in my final year project at Hull. No retyping citations.

Harvard Style Reference

## 5 – Write and Read Anywhere

Because the ‘source files’ for $\LaTeX$ are just plain text, and the output files are PDF files everyone, on any operating system, can make changes to and read the output of your documents. No more worrying about what version of word someone has, or whether or not they’ll have Calibri in their font library. Furthermore there is a LaTeX compiler available for almost any machine.

There is an abundance of editors for  $\LaTeX$ including features such as syntax highlighting, autocomplete, automatic packing including and simplification of the PDF generation process. My personal favourite is TexPad.

I hope I will have convinced at least a few of you to try out LaTeX when you’re next writing a report for university of work. Let me know how it goes if you do!

Danny

# MODE Assessment 2 Coursework Result and Module Result

Today I received my grade for the second assessment of the Model-Driven Engineering module. In this open assessment we built on the work we had done in assessment 1 by developing a graphical editor for users of our Media Library model, developing two model-to-model (m2m) transformations, and a model-to-text HTML report transformation.

I’m happy to say that I received a mark of 83% for part two of this module, giving me an overall grade of 80% for MODE.

This grade alongside my 99% for CRTP means I’m currently in a very good position to get a distinction in my masters degree, which has always been the aim.

Due to some mitigating circumstances I am still working on my EVCO and COPR module assessments, and expect to have these finished by the end of this week. I will keep the blog updated with information about them (and hopefully some non-academic blog posts once I get some more free time)

Danny

# Concurrent and Real-Time Programming Module Result – 99%

Last week I took my first sit-down exam at The University of York, it was for the module “CRTP – Concurrent and Real-Time Programming” and was worth 100% of said module.

The module focused on the concepts and theories of concurrent and real-time programming that would be useful independent of any particular programming language as well as having a series of practicals in which we used the Real-Time Specification for Java. Having only used very basic threading a few times it was nice to flesh out my knowledge in this area.

Due to the fact that I hadn’t taken an exam here at York before, and not knowing much about the institution and its style of examination I was a bit worried about how well I would do. Therefore I made it my aim to do a week and a half of solid revision — which was tough, but cemented all of the concepts in my head really well.

The examination consisted of 3 questions, each worth 50 marks, of which we had to answer 2. Each question had some Book Work — essentially questions asking about concept for which an answer could be recited from a book — some Analysis, usually of code, and a hard unseen problem — which involved writing Java code for the Real-Time Specification for Java, by hand.

Even after having completed the exam I wasn’t sure how well I’d done. Fortunately the papers were marked 3 days later and I was very surprised, relieved and happy to find I had achieved a mark of 99%. I was later told this was the highest mark that had ever been achieved in the module.

The same day as the CRTP exam I had to hand in a coursework for my Model-Driven Engineering module. I will of course keep the blog updated about that and the two other courseworks I am currently working on for my Evolutionary Computation and Constraint Programming modules.

Thanks,
Danny

# DannyBrown.net updated

The website on both Desktop and Mobile platforms

Recently I’ve updated my website, dannybrown.net, to remove out-of-date information and make it easier for users to get to content they need.

Rather than having a list of projects I’ve completed and an over-the-top introduction the site now consists of a short introduction and a few rectangular tiles for commonly accessed information from the site — namely this blog, my CV, my LinkedIn profile and a contact email address. Any information that was previously on my website is in those resources.

In addition to the changes made on the client side I have also enabled IPv6, SSL and a Content Delivery Network via the free service provided by CloudFlare. IPv6 support will allow people who don’t have an IPv4 address to connect to my site without issues — which is important seen as we’ve technically ran out of IPv4 addresses. SSL will encrypt traffic between the user and my CloudFlare system and the Content Delivery Network will mean that my content is stored closer to the physical location of many international users resulting in faster download speeds.

On my server side I have also updated my configuration to allow for the use of dannybrown.net/cv and dannybrown.net/blog so you don’t have to remember dannybrown.net/cv.pdf and dannycomptuerscientist.wordpress.com respectively.

In the future I’m hoping to run this blog using the Ghost Blogging Platform hosted in the same Microsoft Azure instance as my static html website. This will allow me to have the same HTML/CSS theme on both and use all of the lovely features provided by Ghost. Currently I don’t think ghost is quite ready for my usage, due to the large amount of posts I have which have image galleries (which ghost doesn’t support) and the lack of two-factor authentication for logging in. However, these issues are currently being worked on and I hope to make the switch soon.

Danny