Weeknotes S04E22: maidens call it love-in-idleness

I’ve been working on something immensely nerdy this week. I’m going to do my best to explain it with my usual verve and flair. Plus, I saw Gwendoline Christie swinging from an aerial silk while I reclined in the comfort of a cinema seat.

the assignment problem

Suppose you’re running a hospital. You’ve got a list of jobs that need to be done, and they all need to be done at the same time – so whoever’s doing one can’t be simultaneously doing another one. Equally, that means each employee can only be given one task (for this time period, at least).

For the nice easy purposes of this explanation, we’ll assume there’s the same number of employees as tasks.[mfn]This is because math is easy and real life is very hard. This is true even when the math is hard: it just means that real life is even harder[/mfn] Nobody is overworked, and nobody is underemployed. However, each employee has a couple of specialisms that mean they’ll perform some tasks more or less efficiently than the others.

This is known generally as “The Assignment Problem” and it is reasonably difficult for humans to compute. This is because the number of potential combinations – the number of potential employee/task pairings – is n2. So with our three tasks/employees, there are 9 pairings. There are also n! possible rotas – with three employees/tasks, there are 3 x 2 x 1 = 6 possible ways we could organise them.

Which isn’t difficult when you’ve only got three employees, but gets more difficult when you’ve got 10 – because now you’ve got 100 combinations and 3,628,800 different potential rotas – and even worse when you’ve got 100 employees, because now the grid you’re writing to show all the pairs has 10,000 cells in it so Excel is really struggling. Meanwhile you’re printing out the rotas to sense-check them to find the right one and the little screen says now printing page 1 of 9.3 x 10157, a number with 158 digits, a number that is so massive I genuinely don’t have any idea how to express it to you. If you counted every second since the universe began you still wouldn’t be anywhere near this number. If you counted all the times I’ve wanted to tell you I love you you’d still be way out (although closer than you were before).

And bear in mind that these rotas at least have only one person doing each role. Your job is to ensure that the total “cost” – calculated from the efficiency with which all the tasks will be done – is as low as possible. You try not to reflect on whether “efficiency” should be the goal. Like you know that Jiya wants to try out working on the paediatrics ward, but she’s not specialised there. Maybe people are complicated and evolving, and trying to view a hospital as just a grid of tasks and resources – human resources – is an inhuman way of helping people to find work that gives them purpose.

And again, looking through 6 rotas is easy. Looking through 3.6 million is going to take you at least 6 months, assuming you’re only doing it in work time,[mfn]which you should, don’t take this home with you! You work too hard as it is. Be kinder to yourself[/mfn] so the best time to get started on this Christmas rota was back in June. Shit.

There are neat little algorithms that can solve this problem in a short enough time to be useful, and one of those is called the Hungarian algorithm.[mfn]’Algorithm’ is a fancy word which here means “set of instructions”[/mfn] I’m currently trying to implement it in my favourite programming language, Python, using the data handling library pandas.

It’s a really interesting problem that’s making my brain squidge out of my ears on the regular, and frankly that’s very good, but it’s also reminding me (after the intense bout of imposter syndrome last week) that I’m actually a reasonably good developer. My code is cleaner, more tested, more thoughtful than it has been before. This might be my first published piece of genuinely open-sourced, re-usable code, that I can point to and say “I made this. It’s got my name on it. It’s got versions.

If I’m really lucky, someday they’ll read these posts and wonder if the task they’re using my code for might be calculated differently: whether the cost they’re trying to minimise should instead be a value that they’re trying to maximise; a value that comes from asking colleagues what it is that they want to do.

Maximising value will be in version 2 of the software.

think but this and all is mended

Queer is a word that has a lot of discourse around it. I’m not interested in the discourse and I’m not writing an essay for secondary school, so I’m going to sidestep the dictionary definition of it and instead talk about A Midsummer Night’s Dream, which was shown last night through National Theatre Live. It was absolutely spectacular. It was queer as all get out.

Titania and Oberon’s lines are almost all swapped: now it is the King of the Fairies humiliated and drugged, lovesick for a Bottom that is confident in his sexuality. The comedy doesn’t come from “the predatory gays”; rather, the absurdity of lust and love. We make fun of the fools who wake up and suddenly reflect on the choices that brought them to bed with an ass.

We can’t help but laugh too as Puck and Titania wreak havoc on the mortals, opening their eyes to a more fluid sexuality than I’ve seen previously performed in this piece. That fluidity is maintained all the way through: the Lovers in the closing seen are not shy about their expressions of desire. There is a tender moment between Lysander and Demetrius that is well known to many men, an impossible tension where touch must be performed with aggression to hide the vulnerability of physicality.

The Rude Mechanicals are exceptional. It takes an incredibly good actor to play a bad actor, and the Mechanicals are terrible actors. They – and the rest of the cast – have enormous fun with the script, as they should. This isn’t Branagh striding about the stage demanding answers in an accent so plummy it could be made into jam; oh no; this is the Shakespeare of the Globe, the Shakespeare that is closer to pantomime. It’s interactions with the audience, it’s smashing the fourth wall to bits, it’s Bottom (as Pyramus) stage-whispering to Thisbe (and Wall) that we’re performing in the round and doing a quick crab-shuffle so as “to best to use the space”.

They are bad actors, and I adored them entirely.

Puck too has enormous fun with a Scouse accent a mile wide. I feel like the accent was picked purely because “Fairy Queen” comes out “Furry Quin”. Alongside his richly animalistic physical acting and Titania’s bordering-on-evil-Disney-queen performance, it serves to set the fairies up not as Tolkein-esque beings of light and elegance but fey: shallow, cruel, and closer to animals in behaviour than humans. He too has absorbed the spirit of Shakespeare. The performance, given in the pit of the Bridge Theatre, offers an “immersive” ticket – an opportunity to stand in the pit alongside the actors.

This is a rich opportunity, and Puck does not waste it: at one point, having had to push his way through the crowd, takes a deep breath and curses all Londoners (to polite applause which is swallowed in a deep laugh as some wag in the audience cries “I’m Irish!”).

Puck’s arms are bound in rainbow ribbons; Bottom is topping; and the fairies are a mess of glitter and innuendo. It is the perfect antidote to the austere and Gileadean setting of Athens, where Hermia is offered the choice of death or a nunnery for refusing the marriage arranged by her father. She pleads her case to Theseus before Hyppolyta – the same actors who play Oberon and Titania – and is refused. Theseus is cold and distant but, as the dream unfolds and – as Oberon – he is tricked, Theseus too transforms and melts.

It is, it seems, the power of dreaming that makes things as they are. The landscapes we traverse in our mind’s eye are the ones we waking seek, and would make if could not find.

A Midsummer Night’s Dream played at the Bridge Theatre until August 2019, and so if you’ve not yet seen it you missed it.

Here’s a trailer to really rub it in:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s