APS - Problem Solving (Lesson)
Problem Solving
One algorithm may be a small part of a bigger problem. Programming is used to solve problems. Problems come in many forms. The problems may be small as in the previous lesson, or the problem may be complex, like creating a movie to entertain or a special program to educate others. Problem solving is of all types. However, the techniques used to solve the problems are the same. Let's take a look at some problem solving techniques below.
Part of problem solving and computer science is always learning. There is always something changing, new technology, new or upgraded software, a new software application. Being in computer science means learning, willingness to explore, and creativity, being willing to try and persevere to make a new reality happen, just like the computer pioneers did. Babbage did not even see his creations working fully. His design was the flowchart, the storyboard, the schematic diagram of the machine to be built, the eventual computer. Collaboration with Ada Lovelace added the vision of instruction input to run and solve many problems, creating a broader vision of what could be.
Solvable Problems (a particular solution)
As we have noted earlier, algorithms, the instructions to solve problems can be solved for exact answers. An algorithm may consist of many procedures or methods to eventually arrive at the answer. Each method or procedure can contain more algorithms within them depending on the complexity of the problem.
Consider the math problem below.
y = 3(x - 2) + 5
y = 3x - 6 + 5
y = 3x -1
To get this far, to get the simplified equation, several abstractions occurred that we take for granted.
The first was the distribution, 3 times (x - 2). How did this happen? Well we remembered that distribution had to occur. Are the directions for distribution written down here with all of the steps? No, the distribution method was abstracted and we put down the results. Our brain had the steps and knew that the 3 needed to be multiplied by each of the numbers inside the parentheses from our learning in math class. Those steps were abstracted from the problem and are not written down here.
Another way to help with the abstracted portion of the problem is to think what happens in a calculator when you provide the problem to the calculator to graph. The calculator provides you the graph of the problem. What else did you do except type the problem to be graphed in the calculator? Nothing, the rest was abstracted from you. Someone else did the programming that analyzed and broke down the bigger algorithm into smaller algorithms in order to create the graph. Try putting the problem in an online graphing calculator. Do you get back the answer?
Here is an example of mine typing in y = 3(x - 2) + 5.
Is this the same answer when giving the calculator input of y = 3x - 1?
Abstraction is all that happened that was hidden from you. The algorithm was the instructions you gave, the equation, the overall rules of the problem. The calculator broke the rules down into various methods or procedures to quickly process your request, put a graph on the screen and return your answer.
Alice Problem Solving
Here is another thought? Did I need to know all of the rules of distribution to get the graph of the equation? No, an elementary school student could have typed in the equation without knowing the distribution rules and the graph appeared as long as the student understood how to enter the function in the calculator.
Thus distribution was a method abstracted, just as when we create a computer program, other software takes care of saving the program on the computer efficiently and converting it back for use when the programmer wants to work with it in the programmer's language. Here is another example in our Alice environment.
Our language of use in Alice is Java if we move from the drag and drop environment to the actual programming language in Alice. Note that if you go to preferences under Window in Alice and change to display the "Java code on the side available"; an additional window opens showing you the actual programming language code that has been abstracted from you.
The code above illustrates multiple levels of abstraction that we create during problem solving. Yes, this was a basic problem, having two characters talk and begin a discussion. Notice that problems are of multiple levels, just as the algorithms and abstractions are. In the code above, note that delay and say are methods or procedures abstracted from the programmer. We don't know how the Alice software makes this happen, it does. We are happy because this allows us to create the animation without having to be detailed in items that can be made generic and coded one time for all uses.
As we continue our course, we will continue to use the Alice block language to write our programs. It is important to remember that as we solve our problems and create our expression for other people, just as they see the finished product and do not know "how" we created the video for them, we also have levels of abstraction that we used in solving the problem of getting the information to our end user.
Thus you can easily see that computer science continually builds on the work of others. It is up to us to interpret a new understanding for others. You create a video to help others understand or to entertain, or to have fun. Others built other levels of computer science for you to work with. We are building and creating based on what is currently available.
Problem solving is exact as in a math solution, created for a single solution, or providing a choice of options, not knowing which is best. Sometimes a computer program may be an interpretation or a solution for now, with others solving the issue later, building on what has been done with a new perspective.
Problem Types (P & NP)
Here is a unique concept. There are problems that cannot be solved and problems that can be solved given time. P stands for problems that can have a determined one answer, whereas NP stands for problems that provide more than a single answer, a choice of answers to the problem, an indeterminate answer.
Problems exist in all areas that are unknown, including currently how to combat and contain the zika virus from mosquitos, a human health problem that encompasses many areas of science including biology, chemistry, computer science, health science, etc. all working together to contain, isolate, and find solutions. Problems arise at all times in history, in all subjects to be solved. Creativity will provide education, hypotheses, and conclusions that sometimes over time will be adjusted if they are not the direct one solution problem of for example, graphing a particular line.
One comes quickly to mind from the math concepts of circles. Has mankind found the end of pi? No, even computers are working to see if there is an end, and therefore we call this an irrational number. The symbol pi, π, is a Greek letter and is used heavily in circle mathematics. This is the mathematical ratio of the circumference and diameter of a circle, an irrational number (never ending) with no known repeating pattern. Will a pattern be found one day? No one knows. Computers have not found any yet. We use the number pi approximately as 3.14 or with more decimals as needed.
There are two types of problems that computer scientists deal with. Those that can be determined with an answer, even if taking a long time with a computer. These are problems like the graphing problem above. A particular exact answer is available given the programmed algorithms.
Secondly, are the problems that have multiple solutions. Which is the correct solution that the computer should show? A GPS, global positioning system, is an example of this. If you ask to drive from New York City to Los Angeles, California, there are many ways to get there. Which way is the correct way? None really! Think about it. The possibilities are enormous.
Example
Let's take a small example. Look at the street map below. How could you get from the corner of Crown Point Road and Hunslet Lane (bottom right corner of the map) to an intersection near the Sports Centre at the corner of Mount Preston Street and Clarendon Way (upper left corner)? Is there just one way? No, there are many possibilities. This is an indeterminate problem because a computer (in this case using mapping technology) would not give you just one answer, but many. In this case there are lots of ways to go between the two places.
A further definition of the problem would be required to decide on a best solution, not an exact solution. More information may involve your mode of travel, your preference for type of streets, avoidance of construction which may not be known by the computer, etc. A narrowing of the choices must be made. After a choice is made and you are on your way traveling, construction or an accident on the road may change your mind about your choice. Now you may make another selection from options given by technology or adjusted based on the suggestions of the computer technology to get you from point A to point B.
In this case, the computer cannot give you a single answer but a best choice answer only. This method allows us, the human, to gather data and then compare options, invoking then the computer again to provide options.
Another example of computer technology that assists in decisions is the weather. Multiple models of what is the weather is going to do in an area are given and the weather forecaster chooses what he or she feels is the best option based on other factors that the computer may not be taking into account on a daily basis. Computer-aided modeling of rain is shown by the weather forecaster, but we do not always get the rain forecast.
As we continue in this course, continue to explore past what is on the page and learn to adapt. Computer science is always adapting to improve information available to all, so being adaptable will be a great trait.
We will continue with learning Alice in this lesson, but first, a different learning method will be used. To learn Alice, additional thinking skills must be developed.
PI IMAGE SOURCED FROM GAVS SUBSCRIPTION. MAP IMAGE FROM WIKIMEDIA COMMONS AND USED ACCORDING TO TERMS OF USE.