Friday, September 30, 2016

An Overview of Genetic Programming


     "One of the central challenges of computer science is to get a computer to do what needs to be done, without telling it how to do it. Genetic programming addresses this challenge by providing a method for automatically creating a working computer program from a high-level problem statement of the problem". [1] This is achieved by "genetically breeding" a population of programs based on Darwin's theory of natural selection (aka 'survival of the fittest'), using biology - inspired methods such as reproduction, crossover, mutation, and so forth. So, in short, what genetic programming does is it tries to simulate natural processes and apply them to existing programs, in order to transform them into new, hopefully better ones.
     But who determines which program is the 'fittest'? Well, the answer is the computers. This doesn't mean however that the computers switch on one day and are all of a sudden able to judge whether a program is worth breeding or not - there is an algorithm behind their 'decisions'. The human programmer gives the computer a set of criteria. The computer runs a program, and if it satisfies those criteria, that program is labeled as 'fit' and is then bred to form new programs, each of which in turn undergoes the same examination process. The overall control flow of this operation can be seen in the image below.




 (More details on the breeding process to come...)


 
References
[1] http://geneticprogramming.com/tutorial/
[2] http://www0.cs.ucl.ac.uk/staff/w.langdon/ftp/papers/poli08_fieldguide.pdf

Image References
[a] http://www.genetic-programming.com/evolveV2DF2003621.GIF
[b] http://www0.cs.ucl.ac.uk/staff/w.langdon/ftp/papers/poli08_fieldguide.pdf

Friday, September 23, 2016

Shortest Path Problem Extension - Traveling Salesman Problem


Let's say there is a salesman and he is trying to go from town to town to sell his products. He has to visit all the towns, but he is in a hurry to get back so he needs to find the route that will get him around the fastest.

If it's a simple problem with few towns, the salesman can find his own solution. In a case however  like the one shown above, he would need the help of the computer.

One way a computer could solve this problem is, through Opt-Swap, by taking all the possible paths between these towns (edges connecting the points), and generating a random path. Then, taking two edges at random and if swapping them is an improvement to the total distance traveled, then it would perform the swap. It would repeat that loop until it the route could not be improved by an immediate opt-swap. This however does not mean that that resulting route is the optimal one, and there are various algorithms that attempt to control for that like simulated annealing by which the computer is told to probabilistically accept non-optimal solutions earlier on in the process.

This is a very rough overview of the traveling salesman problem but if you are interested I would highly recommend watching the two referenced videos. They go into more detail and they explain it much better.

Also, I randomly ran into this: https://www.youtube.com/watch?v=8WjUVEamGKA . Very interesting! If you have 4 minutes to spare it's definitely worth watching.

References:
  • https://www.youtube.com/watch?v=SC5CX8drAtU
  • https://www.youtube.com/watch?v=-cLsEHP0qt0
Image references:
  •  http://permutationcity.10gbhost.com/projects/mutants/tspresults.gif?i=2


Friday, September 16, 2016

Shortest Path Problem - Real LIfe Applications



Ever had 10 different things to do in one day at 10 different locations and wondered what is the most efficient/less time-consuming way to do all of them? Computer Science has the solution to your problem, and it's name is 'Shortest Path' (also referred to as 'Dijkstra's algorithm' or 'Minimum spanning tree').


What 'Shortest Path' is, is an algorithm that computes which path (option) gets you to your goal (destination) with the least possible weight (cost). "In graph theory, the shortest path problem is the problem of finding a path between two vertices (or nodes) in a graph such that the sum of the weights of its constituent edges is minimized."

So let's assume you have to do 5 things today:
  1. Go to lunch with your Advisor (he/she is available any time you tell them)
    • location: Dining Hall
    • estimated time of completion: 40 minutes
  2. Do your homework
    • location: Library
    • estimated time of completion: 5 hours
  3. Go to Dr. Jory's office hours
    • location: Jepson
    • estimated time of completion: 1 hour
  4. Do Laundry
    • location: Gateway apartments
    • time of completion: 1.5 hours

Assuming you are starting from your room in Gateway and you want to eventually end up in your room again to sleep. Some possible paths you can take are shown below:









1 is where you start off, 2 is the dining hall, 3 is the library, 4 is Jepson, 5 is Gateway laundry room, and 6 is your room where you end up.

Taking into account the time each of these activities takes, and the distance/walking times between each of these locations, and the importance/benefit of getting each done, you would assign a specific value called 'weight' to each edge (line).

Then, for each path that takes you from 1 to 6, you would add up the weight of all the segments you follow, and whichever path ended up having the smallest value would be the most efficient/cost-effective way to go about your day.

Now for a simple task like this you may not necessarily need the help of a computing system to run an algorithm, but if you had to make a more complicated and multivariate decision, this could be very helpful.

References:
 https://en.wikipedia.org/wiki/Shortest_path_problem
 https://en.wikipedia.org/wiki/Minimum_spanning_tree#Classic_algorithms

Image References:
 https://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/6n-graf.svg/500px-6n-graf.svg.png


Friday, September 2, 2016

Intelligent Personal Assistant - How does Siri work?


The last decade has shown a trending shift towards Apple products, and especially iPhones. With most of these products, comes an Intelligent Personal Assistant called Siri.
Siri is and AI system installed on iPhones, iPods, and iPads, that helps automate some of their functions, but also helps the users perform small day-to-day tasks more easily, and also serves as a search engine.
In contrast to other intelligent personal assistants like Windows's Cortana, Siri is more interactive, in the sense that it somewhat participates in dialog, seems to possess a sense of humor / a keen sense of wit. One of my favorite examples is when a user asked Siri: "Who's taller? Kobe Bryant or LeBron James?" and Siri's response was: "If you squint, you can see that LeBron James is slightly taller."
Now how can a computer system have humor? Phrased that way, the answer is, it can't. Perhaps a more proper question would be, "Where does this system find these witty responses?" The short answer is, it has been programmed to follow a specific algorithm. More specifically:
How Siri works is (in a simplified model) it takes the inputted text (or sound which it then converts to text), parses it, and looks for keywords that signify commands (e.g. "search", "call", "message") - not much unlike what a compiler does ;) . Then, it decides whether or not this information corresponds to the phone's/tablet's local database of commands/actions (e.g. "Write", "Send", or a name), or if it is more accurately described as a global problem(e.g. temperature in Chicago), that would require retrieving information from a global database. (This sounds a lot like a boolean expression!)
If it is a local command, it goes through the local database, executes the command, and outputs the result. Otherwise, if it cannot recognize the command as something local, it connects to Apple's servers and accesses their database, then links what it finds to the local database, and continues to execute and output the result.
In this simplified explanation of how Siri works, it is not much unlike any other computer program which takes an input and, through an algorithm, outputs a result or answer.
If you are interested in more details about how Siri works, thee first two links in my references are very interesting.

References:
  • https://www.quora.com/How-does-Siri-work-2
  • http://electronics.howstuffworks.com/gadgets/high-tech-gadgets/siri.htm
  • https://www.youtube.com/watch?v=loOHmMFVJcE
  • http://intelligentpersonalassistants.blogspot.com/
Image Reference: https://www.google.com/search?q=Siri&biw=2144&bih=1084&tbm=isch&source=lnms&sa=X&ved=0ahUKEwjVjeuQ6oPPAhVDHR4KHUtgAlsQ_AUICCgD&dpr=0.9#imgrc=YBUpF0WL22PW6M%3A

Automated Systems Run Loose


     Robot Taxi is a new experiment in Japan. The company is manufacturing and testing automated cars that pick up clients from their GPS location and take them to their destination, whilst attempting to provide a unique passenger experience. As the company states in its mission statement, "Select where you want to go on your mobile device, and Robot Taxi will come to pick you up. When it arrives, it detects where you are and the door opens automatically for easy boarding. Once underway, Robot Taxi selects the quickest route based on real-time traffic information in order to reach your destination smoothly and safely. Just like a good friend, Robot Taxi also makes sure you enjoy your trip by providing on-board entertainment. All the while, ensuring to use the best driving route to make your ride comfortable as well as enjoyable."
    How safe is it though for such cars to exist? How far do their sensors' abilities stretch? How inclusive and effective is their troubleshooting program? What are their limitations? Could they avid accidents caused by others as well as a person could? What if there is a glitch, or a bug in the system that has not been discovered during testing? 
     On the other hand, how would that affect society? There would no longer be the need to get a driver's license, or to be a taxi-driver so jobs would be lost but, what I find more important is, road-trips would not be the same ever again, would they?

Writing References:
https://robottaxi.com/en/
Image Sources:
https://www.google.com/imgres?imgurl=https%3A%2F%2Fi.ytimg.com%2Fvi%2FD6wgTIJ5e00%2Fsddefault.jpg&imgrefurl=http%3A%2F%2Fwww.ikfirus.com%2F2015%2F10%2Fjapan-introduce-robot-taxis.html&docid=3FBJl0Wv0KkBwM&tbnid=xSVSzcOjsDTlfM%3A&w=640&h=480&itg=1&bih=1065&biw=1070&ved=0ahUKEwiFz_u32fDOAhUBXh4KHb8wB5IQMwhVKC0wLQ&iact=mrc&uact=8

Computer Science Can Save Lives...or End Them



     With the advancements in technology and the evolution of computers, mankind has been able to accomplish great things in all disciplines. Without computers, doctors would not be able to take advantage of the precision of laser surgery, or use MRI scans to visualize a tumor in a patient's brain, or even simpler than that, automatically regulate medication dosages. Without computers, Pirates of the Caribbean would not have looked as awesome.
     Computers play a tremendous role in our everyday lives, whether we realize it or not. That however, makes them all the more dangerous. The ways in which they affect our lives and our society make it so that the simplest computing mistake could have dire consequences. Taking the example of medicine, how easy would it be to make a small computational error that would change the formula by which medication dosage is calculated, and overdose a patient, or give them less medication then they need and hence not cure them properly or in time? The answer, VERY! Similarly, how easy is it to forget one number or one variable of a 3-page code when programming a space rocket, and hence causing it to explode or take the wrong path? The answer? Extremely easy! The proof? Delta II, 1992: The graphite-epoxy casing of one of the solid-rocket boosters split 7.2 seconds into the flight, triggering the rocket's self-destruct system. Titan IV, 1998, began to pitch over the Atlantic Ocean and safety officers had to send a destruct signal. Delta III, 1998, was also commissioned a destruct signal after appearing to break up during flight. In these three cases luckily no injuries were reported, but there could have just as easily been astronauts on board those rockets at the time of explosion.

 
    The point to be taken away from this blog is not that computers are bad, but that they are important, that they have become an integral part  of our lives, seen in almost every aspect of them, that it takes extreme precision, patience, and care to be equipped to work in that field, and that all the people behind these machines carry a lot of weight on their shoulders.

Writing References:
  • http://www.floridatoday.com/story/tech/science/space/2016/09/01/spacex-falcon9-rocket-explosion-one-of-many-florida-launch-failures/89716540/
Image Sources:
  • https://www.google.com/search?q=computer+lab&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjznJfx1vDOAhXCpx4KHeAmAwYQ_AUICCgB&biw=1070&bih=1065&dpr=0.9#tbm=isch&q=scientific+computer+lab&imgrc=_YBoHKp6MA0O6M%3A
  • https://www.google.com/search?q=rocket+explosion&newwindow=1&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjlwvaz2PDOAhXEFx4KHdIkA8QQ_AUICigD&biw=1070&bih=1065&dpr=0.9#imgdii=U5stWnFA0UnfyM%3A%3BU5stWnFA0UnfyM%3A%3BFqHT1dgif5RjwM%3A&imgrc=U5stWnFA0UnfyM%3A