Posts

Showing posts from November, 2017

Problem solving using generic algorithms

Generic algorithms ( GA)  can be very useful for solving complex optimization problems such as the knapsack problem. The knapsack problem aims to maximise the total profit for a specific selection of items while simultaneously  not exceeding the knapsack capacity. Every item has a profit and a weight.  This is how I initialise everything with the given data from the lab: p = vector<int> = {  92, 57, 49, 68, 60 , 43 , 67, 84, 87, 72 }; // profits w =  vector<int> = {  23, 31, 29, 44, 53 , 38 , 63, 85, 89, 82 }; // weights c = 165; // capacity os = vector<int> = { 1, 1, 1, 1, 0, 1, 0, 0, 0, 0 }; // optional selection n = profits.size(); // number of items

Use GA to solve TSP + Mini Project

Image
A somewhat cryptic but intentional title, but for people knowing the lingo, this is a problem that could be solved using GA which stands for Genetic Algorithms and our problem TSP stand for Traveling Salesman Problem. The Traveling Salesman Problem has been around for hundreds of years and I first heard of the problem over the summer when I was reading a book called ‘Algorithms to live by’ which was an interesting read which I can really recommend. Here is a brief explanation of the problem. The Travelling Salesman Problem describes a salesman who must travel to X amount of cites. The order of which he does this does not matter, the only thing that matters is that he only visits each city once and that he finish where he started. This problem is regarded as a very hard problem to solve, it’s also called a NP-hard problem by computer scientists. I found it very interesting to approach solving this problem by using GA and I will try throughout this post to describe

Genetic Algorithms ( GA )

Genetic algorithms is a specific type of search technique which is a separate evolutionary algorithms branch within our tree search techniques. These algorithms uses genes where each gene contains chromosomes, just like our own biology. These genes can evolve to our benefit to find the best possible solution to our problem. In the concept of natural selection the resources are limited and our genes/agents will be struggling to survive. The fitness of each individual gene/agent will determine their success. If the gene is successful and it has a good fitness, then the fittest gene is more likely to reproduce and pass on their genes to the next generation. These algorithms is based on our understanding of evolution and the term “survival of the fittest” is basically how our genetic algorithms work. We are trying to find the best possible solution but in order to find it, there must be some variance within our population. Just as we do with our DFO, we have to randomly allocat

Physical Computing - Project Idea

Image
Physical Computing - Project Idea I am going to make an analog modular synthesizer. I am a huge fan of electronic music instruments and I thought it would be a great idea to build one from scratch, so that I can learn as much as possible about how to create custom made electronic music. Synthesizers can be very complex and have thousands of different sound parameters. In this project I will start small and I want to focus on the fundamental of synthesizer, such as the oscillators or in other words VCO ( voltage control oscillator ) and CCO ( current control oscillator ). Oscillators will mainly produce sound waves such as sine, square and triangle waves which in not very interesting for an instrument, but it’s the sounds every synthesizer is based on. In my oscillator I will add effect such as frequency modulation, Sample & Hold and low frequency oscillation ( LFO ) to generate some more interesting sounds. The oscillator will be patchable, which means that you will be