Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Optimization Problems2/23/2009Opening Discussion●Minute Essay comments–Practicing solving problems and looking over code is an ideal way to learn what we are doing.●When you read code keep an eye on both details of syntax and meaning.–Don't start to code immediately on a new problem.–Arrays–You don't need to learn any of the Excel stuff I have covered.More comments–What methods should you be able to recreate on your own?●Anything we write in class.●I'd rather you not think of it as recreating.–Translating ideas to code. Syntax.–When to use different things.–Making a web site.●Very few people have come to talk to me for any significant amount of time this semester.Optimization Problems●One of the most common type of problems that people solve on computers is the optimization problem.●This is a class of problems where we are looking for the best solution. It could be the smallest or the largest, but it is always an extreme value.●Examples include finding the shortest route, minimizing costs, maximizing utility, etc.Our Problem●The problem I want us to do today is this. Given a set of buildings at different locations, we want to build sidewalks that connect all the buildings.●Of course, we want to lay down as little sidewalk as possible.●How do we determine where to build sidewalks to do this?How do we go about doing this?●I want to try something a bit new today. Break up into groups of 2-3 and for five minutes I want you to discuss how you would solve this problem. Think in English terms, but break it down to the level where we have a chance of coding it.●At the end of five minutes I will be calling on some of you o hear what you came up with.New Scenario●To make this happen I want us to build a new scenario.●I want the scenario to have building randomly placed in the world that we have to connect with sidewalks.Greenfoot Graphics●Making the sidewalks will require something that we haven't done previously.●You might have noticed in the Greenfoot API that there is a class called GreenfootImage. This is what Greenfoot uses for the graphical display.●This class has methods that allow us to draw things to the image. We want to draw in lines for sidewalks.Coding the Solution●With whatever time we have let's start trying to code up a solution to this optimization problem.Minute Essay●What are some examples of optimization problems you can think of? They are everywhere, just give it a bit of thought and you should come up with several.●Wednesday is the due date for your project design. This is a document written in standard English where you tell me what classes your project will have, what methods and data members are in those classes and what the methods do. It is worth 20% of the project
View Full Document