{"id":154,"date":"2020-02-07T08:20:26","date_gmt":"2020-02-07T08:20:26","guid":{"rendered":"http:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/?p=154"},"modified":"2021-11-08T10:26:17","modified_gmt":"2021-11-08T10:26:17","slug":"heuristics-in-optimisation","status":"publish","type":"post","link":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/2020\/02\/07\/heuristics-in-optimisation\/","title":{"rendered":"Heuristics in Optimisation"},"content":{"rendered":"\n
Another fortnight, and another 10 presentations on research in STOR-i. The current phases of the MRes program is starting to introduce us to the different research areas that we may be able to choose our PhD topic in. There was also a fantastic performance by the ¶¶ÒõAPPµ¼º½ Korfball team at BUCS North Regional competition, which you can see for yourself on the ¶¶ÒõAPPµ¼º½ Korfball Facebook page<\/a>.<\/p>\n\n\n\n Korfball brilliance aside, one of the research topics we’ve seen was from Dr Ahmed Kheiri (a lecturer in the ¶¶ÒõAPPµ¼º½ Management School) called “Heuristic methods in hard computational problems”. This is an area I’ve previously had some experience in, so I thought it would be a good idea to dive a bit deeper into this.<\/p>\n\n\n\n Optimisation is the general area of maths of finding the highest or lowest solution to a problem, often given some constraints. A very simple example of this is a furniture maker, who has a certain amount of wood, and needs to decide how many chairs or tables to make to maximise profit, given the limits to the amount of wood each requires, and the amount of time they have to work on the problem. This problem could be formulated <\/strong>as:<\/p>\n\n\n\n Maximise (profit per chair x number of chairs made) + (profit per table x number of tables made) <\/em><\/p>\n\n\n\n subject to:<\/p>\n\n\n\n (wood used per chair x number of chairs made) + (wood used per table x number of tables made) <\/em>\u2264 Total wood available<\/em><\/p>\n\n\n\n and<\/p>\n\n\n\n (time taken to make a chair x number of chairs made) + (time taken to make a table x number of tables made) <\/em> \u2264 How much time they have<\/em><\/p>\n\n\n\n and finally<\/p>\n\n\n\n Number of chairs and number of tables are integers (i.e. you can’t make half a table\/chair)<\/em><\/p>\n\n\n\n I’ll also use this problem to introduce some terminology:<\/p>\n\n\n\n This is a very simple optimisation problem, and you could probably find solution to it quite quickly (either directly<\/a>, or through some established algorithms<\/a>). However, these sorts of problems can quickly get out of hand. What if you actually have more products than you can make from your wood? What if the first few chairs sell for a higher cost than the next few? What if you have to sell chairs and tables as a set? A heuristic is really any optimisation technique\/algorithm for finding a good or approximate solution very quickly. It can be something as simple as the following:<\/p>\n\n\n\n There are two points about the above algorithm. Firstly, it will (the longer you do it) find a better solution; but secondly, there’s no guarantee that it’ll get there any time soon, or any guarantee that it’ll get close to the true best solution. This is because it’s just randomly jumping all over the solution space. It’s not actually looking for a good solution – it’s just stumbling around, hoping to find one.<\/p>\n\n\n\n A better heuristic will often try to move in the “direction” of better solutions. A classic example of this is the gradient descent method:<\/strong><\/p>\n\n\n\n The basic idea is to imagine putting a ball on the surface of the solution space, and letting it roll down, it will eventually settle in the lowest point. A very good gif of this is shown below (taken from the MI-Academy website<\/a>)<\/p>\n\n\n\n Think of your solution space as the surface of a table. Gradient descent is kind of like putting a ball table and simply letting the ball roll down to find the lowest point.<\/p>\n\n\n\n It’s quite clear from the above gif that this is a much better heuristic. However, there are still situations in where this doesn’t work to well. Imagine we have the following objective function:<\/p>\n\n\n\n If you can imagine placing a ball at the red point, it will roll down and settle at the “minimum” at the blue point. While this is the minimum for this bit of the solution space (we call this a local minimum<\/strong>), it completely misses the true minimum (or global minimum<\/strong>) at the green point.<\/p>\n\n\n\n In general, the more complicated the function, the more sophisticated the heuristics needed to find a good solution.<\/p>\n\n\n\n Moving back to the presentation by Dr Kheiri, we look at the problem of optimal wind turbine placement. To quote the presentation:<\/p>\n\n\n\n The problem involves finding the optimal positions of wind turbines in a 2 This problem will have many local minima, and so gradient decent will probably fail if we tried to use it.<\/p>\n\n\n\n The way this was solved in the paper was to use a genetic algorithm<\/strong>. This is a heuristic which tries to mimic natural selection in animal populations. The idea is that you generate a population of solutions, then you pick pairs of solutions from this population and from them “breed” new solutions, which have features from both of their “parent solutions”. The new solutions are then evaluated and the strongest (i.e. the best) survive, and the others are discard. This new solutions are then used to breed more solutions, and the process is repeated until you decide to stop.<\/p>\n\n\n\n Applying this to our wind turbine problem, we first set up our data as a binary vector of 1s and 0s. We do this by diving the plane into a 2-dimensional grid, with at most 1 turbine in each cell. Therefore, each cell is now associated with a binary variable, which takes the value of 1 if there is a turbine in it, and 0 otherwise. The decision then is which cells to but a wind turbine in (i.e. assign to a value of 1) and which to leave. From our matrix of 1s and 0s, we simply organise it into one long vector of turbine locations (mainly for computationaly simplicity), as shown in the gif below (in this example, every cell is a 1, but in truth, they will be a mix of 1s and 0s).<\/p>\n\n\n\n Once have set this up, we can start our genetic algorithm. First, we then generate a bunch of solutions, pair them off, and start breeding new solutions from these pairs. The breeding has two aspects:<\/p>\n\n\n\n The breeding is shown below (again, in this example, the mother and father are the same, but in reality, they will be different).<\/p>\n\n\n\n We then see how good all these child solutions are, and keep the best ones. From these, we breed more new solutions, keep the best, and so on. We keep doing this until we are satisfied we have a good solution.<\/p>\n\n\n\n By this point, you probably are starting to realise the many different types of heuristic you could use to solve an optimisation problem. However, this leads to an obvious question – how do you chose which one? Some will converge quite quickly (e.g. gradient descent) whereas some will be more robust against local minima (genetic algorithms). In general there is no such right answer.<\/p>\n\n\n\n However, for a given problem, it is possible to apply a number of different heuristics, and then use a hyper-heuristic<\/strong> (also called a meta-heuristic<\/strong>). The way it works is to start with a number of low-level heuristics<\/strong>. You then run them over the problem, and (when you would normally iterate you one chosen heuristic) you switch between heuristics. This could be as simple as changing between the breeding rules in genetic algorithms, or switch search methods altogether. Ideally, you would also keep track of how each heuristic is doing as you go, and use this information to help chose your next heuristic.<\/p>\n\n\n\n <\/p>\n","protected":false},"excerpt":{"rendered":" Another fortnight, and another 10 presentations on research in STOR-i. The current phases of the MRes program is starting to…<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[10,9,8,7],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-genetic-algorithm","tag-heuristics","tag-operations-research","tag-optmisation"],"_links":{"self":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":30,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts\/154\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
An overview of optimisation<\/h2>\n\n\n\n
The more complicated the problem is, the (computationally) harder it will be to solve exactly. However, if you’re willing to cheat a bit, there are some methods that can help.<\/p>\n\n\n\nHeuristics<\/h2>\n\n\n\n

<\/figure>\n\n\n\nOptimal wind turbine placement<\/h2>\n\n\n\n
dimensional plane, such that the cost of energy is minimised taking into
account several factors such as wind speed, turbines features, wake effects and
existence of obstacles<\/em><\/p>\n\n\n\n

Hyper-heuristics<\/h2>\n\n\n\n

In summary<\/h2>\n\n\n\n