Wk 1: Discussion 2 [Due Tomorrow]

Review the “Chapter Two Case: Michael Porter on TED – The Case for Letting Business Solve Social Problems” at the end of Ch. 2 of Business Driven Technology.

Answer the following questions:

  • Do you agree or disagree that business can solve social problems? Justify your answer.
  • How can the concepts discussed by Michael Porter help with the decision making process for managers at the three different managerial levels?

Respond to at least three of your peers. In your response, address any thoughts you have on if business can solve social problems and if it can help managers make decisions.

Students need to contribute three substantive posts in this discussion by the due date indicated. The substantive posts can be any combination of responses and replies.

Peer 1

If the statement was stated slightly different I would completely agree with it. I do believe that business can help with social problems, but they will not be the resolve for them. For example, many commercial grocery stores donate all the food that is past its “Selling” date to food banks and non-profits that feed the poor. Just because it has past its sell by date does not mean the food is bad, it just means you cannot legally sell the product. There are more and more non-profits to help the less fortunate in almost every community. The fact that businesses will not be the resolve for social problems is simply because they are a business they are here to make money, one of the reasons for even the handout of the food example is because they get to write that loss off on taxes.

Most businesses are broken into a few different management levels, Operations, VPs and executive staff. The operations management provide day to day decisions that affect the operations of say their bank branch which they manage. They make decisions such as who is working which teller line. VPs and support staff make decisions on who is doing what problems or incidents. The Executive staff focus on more of the business long term decisions which have an affect of the entire company.

Reference: Baltzan P (2017, Business Driven Technology (7th ed) New York, NY, McGraw-Hill

Peer 2

Do you agree or disagree that business can solve social problems? Justify your answer.

Yes, I do believe that businesses can help solve social problems. There have been an increasing number of restaurants, farmers markets, grocery stores and even some college campuses that donate fresh food that is past its’ selling prime, but still perfectly safe to eat, to food pantries who distribute it to low income families in both rural and urban food deserts. This not only helps feed many needy families but is also good for the planet. Wasted food is a huge producer of greenhouse gasses which contribute to climate change.

Publix supermarkets are active supporters of youth organizations in their communities and also donate to Habitat for Humanity. Stoneyfield farms are big contributors to environmental causes and nonprofits.          .

Bill and Melinda Gates created their foundation to help improve the health conditions for children in developing countries. They have also donated hundreds of millions of dollars to the library system to provide internet access and computers to libraries nationwide. Their foundation is also dedicated to improving our failing education system by donating millions of dollars to help schools hire and retain high-quality teachers, and educational materials. Warren Buffett is also a huge contributor to the foundation. While this is a non-profit, it does have a big social impact.

These are just a few examples of how businesses are working to help solve social problems. I also believe that when a business is involved in giving back to their communities and helping to solve social injustices or supporting environmental issues, this helps build customer goodwill which in turn can lead to increased profits. I know I would rather spend a little more with a company that does good things and gives back than one that only cares about their shareholders profits. Mr. Porter stated that we need to achieve scalability when it comes to businesses helping solve social problems. If businesses are to buy in to this, they need to see how much more profitable they could be by working on social problems and less profitable by not doing it.

·        How can the concepts discussed by Michael Porter help with the decision- making process for managers at the three different managerial levels?

Operational – These lower level managers make structured decisions that affect the day to day operations of their departments regarding internal functions, such as which machine an employee will run today or shifting people around to cover for someone who is out sick.

Managerial – These middle level managers make semi-structured decisions that affect a short-ish term time frame. Their performance indicators focus on efficiency and effectiveness.

Strategic – These high level, senior executives make unstructured decisions that affect a long term time frame. Their focus is on the effectiveness and success of the entire company.

Reference:

Baltzan, P. (2017). Business driven technology (7th ed.).

New York, NY: McGraw-Hill/Irwin.

Peer 3

After listen to the TED talk of Michael Porter, I believe business can solve Social problems, if they are willing. One of the main issues that Micheal bring up is the scale of the social issues, While the government and NGOs can make some progress the scale of the social problems are so large that they can not make large scale impacts on the problems, the resources are limited and not enough money being tax revenue and donations. Business have more resources and business create wealth from what Micheal talked about. (Porter, 2013). Since business make the wealth and money, the businesses need to be involve to have which will allow business resources to deal with the scales of the social problems. One social issue that is talked about is pollution, the conventional thing by business it is not worrying about pollution so that you make more money well the fact is business can be have less pollution and still be profitable, yes it is a balance however, if after the initial investment to be less polluting they will still be profitable and pollute less which will in-turn help with the social problem of pollution where the government and NGO can not assist.

Reference: Porter, M 2013. Retrieved from https://www.ted.com/talks/michael_porter_why_business_can_be_good_at_solving_social_problems#t-587925

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

NETWORKING QUIZ

Mike Meyers’

CompTIA Network+® Guide to Managing and

Troubleshooting Networks

Third Edition

(Exam N10-005)

 

 

This page intentionally left blank

 

 

Mike Meyers’

CompTIA Network+® Guide to Managing and

Troubleshooting Networks

Third Edition

(Exam N10-005)

Mike Meyers

New York Chicago San Francisco Lisbon London Madrid Mexico City Milan

New Delhi San Juan Seoul Singapore Sydney Toronto

BaseTech

 

 

Copyright © 2012 by the McGraw-Hill Companies. All rights reserved. Printed in the United States of America. Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication.

ISBN: 978-0-07-179981-2

MHID: 0-07-179981-8

The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-178911-0, MHID: 0-07-178911-1.

All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefi t of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.

McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at bulksales@mcgraw-hill.com.

McGraw-Hill is an independent entity from CompTIA®. This publication and digital content may be used in assisting students to prepare for the CompTIA Network+ exam. Neither CompTIA nor McGraw-Hill warrants that use of this publication and digital content will ensure passing any exam. CompTIA and CompTIA Network+ are trademarks or registered trademarks of CompTIA in the United States and/or other countries. All other trademarks are trademarks of their respective owners.

Fluke images printed with permission of Fluke Corporation, ©Fluke Corp. Intel image printed with permission of Intel Corporation, ©Intel Corp. TRENDnet images printed with permission of Trendnet Media, ©TRENDnet. Equalizer E650GX image printed by permission of Coyote Point Systems, ©Coyote Point Systems, Inc. www.coyotepoint.com. NetGear image printed with permission of NetGear, ©NETGEAR, Inc. Hewlett-Packard images printed with permission of HP, ©Hewlett-Packard CLEAR image printed with permission of CLEAR, ©CLEAR

TERMS OF USE

This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGrawHill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.

THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/ or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.

E-book conversion by codeMantra

Version 2.0

 

 

About the Author■■ Michael Meyers is the industry’s leading authority on CompTIA Network+ certifica- tion. He is the president and founder of Total Seminars, LLC, a major provider of PC and network repair seminars for thousands of organizations throughout the world, and a member of CompTIA.

Mike has written numerous popular textbooks, including the best-selling Mike Meyers’ CompTIA A+® Guide to Managing & Troubleshooting PCs, Mike Meyers’ CompTIA A+® Guide to Essentials, and Mike Meyers’ CompTIA A+® Guide to Operating Systems.

About the Contributor Scott Jernigan wields a mighty red pen as Editor in Chief for Total Seminars. With a Master of Arts degree in Medieval History, Scott feels as much at home in the musty archives of London as he does in the warm CRT glow of Total Seminars’ Houston head- quarters. After fleeing a purely academic life, he dove headfirst into IT, working as an instructor, editor, and writer.

Scott has written, edited, and contributed to dozens of books on computer liter- acy, hardware, operating systems, networking, and certification, including Computer Literacy—Your Ticket to IC3 Certification, and co-authoring with Mike Meyers the All-in- One CompTIA Strata® IT Fundamentals Exam Guide.

Scott has taught computer classes all over the United States, including stints at the United Nations in New York and the FBI Academy in Quantico. Practicing what he preaches, Scott is a CompTIA A+ and CompTIA Network+ certified technician, a Microsoft Certified Professional, a Microsoft Office User Specialist, and Certiport Inter- net and Computing Core Certified.

About the Technical Editor Jonathan S. Weissman earned his master’s degree in Computer and Information Science from Brooklyn College (CUNY), and holds nineteen industry certifications, including Cisco CCNA, CompTIA Security+, CompTIA i-Net+, CompTIA Network+, CompTIA A+, CompTIA Linux+, Novell CNE, Novell CNA, Microsoft Office Master, Microsoft MCAS Word, Microsoft MCAS PowerPoint, Microsoft MCAS Excel, Microsoft MCAS Access, Microsoft MCAS Outlook, and Microsoft MCAS Vista.

Jonathan is a tenured Assistant Professor of Computing Sciences at Finger Lakes Community College, in Canandaigua, NY, and also teaches graduate and under- graduate computer science courses at nearby Rochester Institute of Technology. In addi- tion, Jonathan does computer, network, and security consulting for area businesses and individuals.

Between FLCC and RIT, Jonathan has taught nearly two dozen different computer science courses, including networking, security, administration, forensics, program- ming, operating systems, hardware, and software.

Students evaluating his teaching emphasize that he simplifies their understanding of difficult topics, while at the same time makes the class interesting and entertaining.

Jonathan completely designed and configured FLCC’s newest Networking & Secu- rity Lab. Serving as IT Program Coordinator, he rewrote FLCC’s Information Technol- ogy course requirements for the degree, keeping it current with the changes in industry over the years.

This textbook is just one of the many that Jonathan has edited for thoroughness and accuracy.

BaseTech

 

 

This page intentionally left blank

 

 

vii

Acknowledgments■■ I’d like to acknowledge the many people who contributed their talents to make this book possible:

To Tim Green, my acquisitions editor at McGraw-Hill: Didn’t think I’d get the book out this quickly, did you? Thanks for your superb support and encouragement, as always.

To my in-house Editor-in-Chief, Scott Jernigan: Didn’t think we’d get the book out that fast, did you? How many 85s do you have now? Pelape still smokes them all in DPS.

To Jonathan Weissman, technical editor: Holy crap, you kicked my butt. Thanks for making my book dramatically better than it has ever been.

To LeeAnn Pickrell, copy editor: u made me write good, thx. To Michael Smyer, Total Seminars’ resident tech guru and photogra-

pher: Glad to see you staying focused. And your photos rocked as always! To Ford Pierson, graphics maven and editor: Superb conceptual art?

Check! Great editing? Check! Beating the boss in Unreal Tournament over and over again? Check, unfortunately.

To Aaron Verber, editor extraordinaire: Your quiet toils in the dark cor- ner of the office have once again paid outstanding dividends!

To Dudley Lehmer, my partner at Total Seminars: As always, thanks for keeping the ship afloat while I got to play on this book!

To Stephanie Evans, acquisitions coordinator at McGraw-Hill: You are my favorite South African ambassador since the Springboks. Thanks for keeping track of everything and (gently) smacking Scott when he forgot things.

To Molly Sharp and Jody McKenzie, project editors: It was a joy to work with you, Molly, and again with you, Jody. I couldn’t have asked for a better team! (Didn’t think I could resist making the pun, did you?)

To Andrea Fox, proofreader: You did a super job, thank you To Tom and Molly Sharp, compositors: The layout was excellent,

thanks!

To Staci Lynne ■■ Davis, vegan chef and

punk rocker: Thanks for showing me your world

and, in the process, expanding mine.

BaseTech

 

 

Key Terms, identified in red, point out important vocabulary and definitions that you need to know.

Tech Tip sidebars provide inside information from experienced IT professionals.

Cross Check questions develop reasoning skills: ask, compare, contrast, and explain.

Engaging and Motivational— Using a conversational style and proven instructional approach, the author explains technical concepts in a clear, interesting way using real-world examples.

Makes Learning Fun!— Rich, colorful text and enhanced illustrations bring technical subjects to life.

10BaseT also introduced the networking world to the RJ-45 connector (Figure 4.9). Each pin on the RJ-45 connects to a single wire inside the cable; this enables de- vices to put voltage on the indi- vidual wires within the cable. The pins on the RJ-45 are numbered from 1 to 8, as shown in Figure 4.10.

The 10BaseT standard designates some of these numbered wires for specific purposes. As mentioned earlier, although the cable has four pairs, 10BaseT uses only two of the pairs. 10BaseT devices use pins 1 and 2 to send data, and pins 3 and 6 to receive data. Even though one pair of wires sends data and another receives data, a 10BaseT device cannot send and receive simul- taneously. The rules of CSMA/CD still apply: only one device can use the segment contained in the hub without causing a collision. Later versions of Ethernet will change this rule.

An RJ-45 connector is usually called a crimp, and the act (some folks call it an art) of installing a crimp onto the end of a piece of UTP cable is called crimping. The tool used to secure a crimp onto the end of a cable is a crimper. Each wire inside a UTP cable must connect to the proper pin inside the crimp. Manufacturers color-code each wire within a piece of four-pair UTP to assist in properly matching the ends. Each pair of wires consists of a solid- colored wire and a striped wire: blue/blue-white, orange/orange-white, brown/brown-white, and green/green-white (Figure 4.11).

The Telecommunications Industry Association/Electronics Industries Alliance (TIA/EIA) defines the industry standard for correct crimping of four-pair UTP for 10BaseT networks. Two standards currently exist: TIA/ EIA 568A and TIA/EIA 568B. Figure 4.12 shows the TIA/EIA 568A and TIA/ EIA 568B color-code standards. Note that the wire pairs used by 10BaseT (1 and 2; 3 and 6) come from the same color pairs (green/green-white and orange/orange-white). Following an established color-code scheme, such as TIA/EIA 568A, ensures that the wires match up correctly at each end of the cable.

66 Mike Meyers’ CompTIA Network+ Guide to Managing and Troubleshooting Networks

Cross Check Check Your CATs!

You’ve already seen CAT levels in Chapter 3, “Cabling and Topology,” so check your memory and review the different speeds of the various CAT levels. Could 10BaseT use CAT 2? Could it use CAT 6? What types of devices can use CAT 1?

• Figure 4.9 Two views of an RJ-45 connector

• Figure 4.10 The pins on an RJ-45 connector are numbered 1 through 8.

• Figure 4.11 Color-coded pairs

The real name for RJ-45 is “8 Position 8 Contact (8P8C) modular plug.” The name RJ-45 is so dominant, however, that nobody but the nerdiest of nerds calls it by its real name. Stick to RJ-45.

AbouT ThIs book

Proven Learning Method Keeps You on Track Mike Meyers’ CompTIA Network+® Guide to Managing and Troubleshooting Networks is structured to give you comprehensive knowledge of computer skills and technologies. The textbook’s active learning methodology guides you beyond mere recall and—through thought-provoking activities, labs, and sidebars—helps you develop critical-thinking, diagnostic, and communication skills.

Information technology (IT) offers many career paths, leading to occupations in such fields as PC repair, network administration, telecommunications, Web development, graphic design, and desktop support. To become competent in any IT field, however, you need

certain basic computer skills. Mike Meyers’ CompTIA Network+® Guide to Managing and Troubleshooting Networks builds a foundation for success in the IT field by introducing you to fundamental technology concepts and giving you essential computer skills.

Important Technology skills ■

10BaseT also introduced the networking world to the RJ-45 connector (Figure 4.9). Each pin on the RJ-45 connects to a single wire inside the cable; this enables de- vices to put voltage on the indi- vidual wires within the cable. The pins on the RJ-45 are numbered from 1 to 8, as shown in Figure 4.10.

The 10BaseT standard designates some of these numbered wires for specific purposes. As mentioned earlier, although the cable has four pairs, 10BaseT uses only two of the pairs. 10BaseT devices use pins 1 and 2 to send data, and pins 3 and 6 to receive data. Even though one pair of wires sends data and another receives data, a 10BaseT device cannot send and receive simul- taneously. The rules of CSMA/CD still apply: only one device can use the segment contained in the hub without causing a collision. Later versions of Ethernet will change this rule.

An RJ-45 connector is usually called a crimp, and the act (some folks call it an art) of installing a crimp onto the end of a piece of UTP cable is called crimping. The tool used to secure a crimp onto the end of a cable is a crimper. Each wire inside a UTP cable must connect to the proper pin inside the crimp. Manufacturers color-code each wire within a piece of four-pair UTP to assist in properly matching the ends. Each pair of wires consists of a solid- colored wire and a striped wire: blue/blue-white, orange/orange-white, brown/brown-white, and green/green-white (Figure 4.11).

The Telecommunications Industry Association/Electronics Industries Alliance (TIA/EIA) defines the industry standard for correct crimping of four-pair UTP for 10BaseT networks. Two standards currently exist: TIA/ EIA 568A and TIA/EIA 568B. Figure 4.12 shows the TIA/EIA 568A and TIA/ EIA 568B color-code standards. Note that the wire pairs used by 10BaseT (1 and 2; 3 and 6) come from the same color pairs (green/green-white and orange/orange-white). Following an established color-code scheme, such as TIA/EIA 568A, ensures that the wires match up correctly at each end of the cable.

66 Mike Meyers’ CompTIA Network+ Guide to Managing and Troubleshooting Networks

Cross Check Check Your CATs!

You’ve already seen CAT levels in Chapter 3, “Cabling and Topology,” so check your memory and review the different speeds of the various CAT levels. Could 10BaseT use CAT 2? Could it use CAT 6? What types of devices can use CAT 1?

• Figure 4.9 Two views of an RJ-45 connector

• Figure 4.10 The pins on an RJ-45 connector are numbered 1 through 8.

• Figure 4.11 Color-coded pairs

The real name for RJ-45 is “8 Position 8 Contact (8P8C) modular plug.” The name RJ-45 is so dominant, however, that nobody but the nerdiest of nerds calls it by its real name. Stick to RJ-45.

10BaseT also introduced the networking world to the RJ-45 connector (Figure 4.9). Each pin on the RJ-45 connects to a single wire inside the cable; this enables de- vices to put voltage on the indi- vidual wires within the cable. The pins on the RJ-45 are numbered from 1 to 8, as shown in Figure 4.10.

The 10BaseT standard designates some of these numbered wires for specific purposes. As mentioned earlier, although the cable has four pairs, 10BaseT uses only two of the pairs. 10BaseT devices use pins 1 and 2 to send data, and pins 3 and 6 to receive data. Even though one pair of wires sends data and another receives data, a 10BaseT device cannot send and receive simul- taneously. The rules of CSMA/CD still apply: only one device can use the segment contained in the hub without causing a collision. Later versions of Ethernet will change this rule.

An RJ-45 connector is usually called a crimp, and the act (some folks call it an art) of installing a crimp onto the end of a piece of UTP cable is called crimping. The tool used to secure a crimp onto the end of a cable is a crimper. Each wire inside a UTP cable must connect to the proper pin inside the crimp. Manufacturers color-code each wire within a piece of four-pair UTP to assist in properly matching the ends. Each pair of wires consists of a solid- colored wire and a striped wire: blue/blue-white, orange/orange-white, brown/brown-white, and green/green-white (Figure 4.11).

The Telecommunications Industry Association/Electronics Industries Alliance (TIA/EIA) defines the industry standard for correct crimping of four-pair UTP for 10BaseT networks. Two standards currently exist: TIA/ EIA 568A and TIA/EIA 568B. Figure 4.12 shows the TIA/EIA 568A and TIA/ EIA 568B color-code standards. Note that the wire pairs used by 10BaseT (1 and 2; 3 and 6) come from the same color pairs (green/green-white and orange/orange-white). Following an established color-code scheme, such as TIA/EIA 568A, ensures that the wires match up correctly at each end of the cable.

66 Mike Meyers’ CompTIA Network+ Guide to Managing and Troubleshooting Networks

Cross Check Check Your CATs!

You’ve already seen CAT levels in Chapter 3, “Cabling and Topology,” so check your memory and review the different speeds of the various CAT levels. Could 10BaseT use CAT 2? Could it use CAT 6? What types of devices can use CAT 1?

• Figure 4.9 Two views of an RJ-45 connector

• Figure 4.10 The pins on an RJ-45 connector are numbered 1 through 8.

• Figure 4.11 Color-coded pairs

The real name for RJ-45 is “8 Position 8 Contact (8P8C) modular plug.” The name RJ-45 is so dominant, however, that nobody but the nerdiest of nerds calls it by its real name. Stick to RJ-45.

/ Mike Meyers’ CompTIA Network+ Guide to Managing and Troubleshooting Networks, Third Edition / Meyers / 911-1 / fm blind folio ix

 

 

consider that type of NIC. The spe- cific process by which a NIC uses electricity to send and receive data is exceedingly complicated, but luck- ily for you, not necessary to under- stand. Instead, just think of a charge on the wire as a one, and no charge as a zero. A chunk of data moving in pulses across a wire might look something like Figure 2.13.

If you put an oscilloscope on the wire to measure voltage, you’d see something like Figure 2.14. An oscilloscope is a powerful micro- scope that enables you to see elec- trical pulses.

Now, remembering that the pulses represent bi- nary data, visualize instead a string of ones and zeroes moving across the wire (Figure 2.15).

Once you understand how data moves along the wire, the next question becomes this: how does the net- work get the right data to the right system? All networks transmit data by breaking whatever is moving across the physical layer (files, print jobs, Web pages, and so forth) into discrete chunks called frames. A frame is basically a container for a chunk of data moving across a network. The NIC creates and sends, as well as receives and reads, these frames.

I like to visualize an imaginary table inside every NIC that acts as a frame creation and reading station. I see frames as those pneumatic canis- ters you see when you go to a drive-in teller at a bank. A little guy inside the network card—named Nick, naturally!—builds these pneumatic canisters (the frames) on the table, and then shoots them out on the wire to the hub (Figure 2.16).

Chapter 2: Building a Network with the OSI Model 15

Try This! What’s Your MAC Address?

You can readily determine your MAC address on a Windows computer from the command line. This works in all modern versions of Windows.

1. In Windows 2000/XP, click Start | Run. Enter the command CMD and press the ENTER key to get to a command prompt.

2. In Windows Vista, click Start, enter CMD in the Start Search text box, and press the ENTER key to get to a command prompt.

3. At the command prompt, type the command IPCONFIG /ALL and press the ENTER key.

• Figure 2.13 Data moving along a wire

• Figure 2.14 Oscilloscope of data

• Figure 2.15 Data as ones and zeroes

• Figure 2.16 Inside the NIC

A number of different frame types are used in different net- works. All NICs on the same net- work must use the same frame type or they will not be able to communicate with other NICs.

Each chapter includes Learning Objectives ■ that set measurable goals for chapter-by-chapter progress

Illustrations ■ that give you a clear picture of the technologies

Tutorials ■ that teach you to perform essential tasks and procedures hands-on

Try This!, Cross Check ■ , and Tech Tip sidebars that encourage you to practice and apply concepts in real-world settings

Notes, Tips ■ , and Warnings that guide you through difficult areas

Chapter Summaries ■ and Key Terms Lists that provide you with an easy way to review important concepts and vocabulary

Challenging End-of-Chapter Tests ■ that include vocabulary-building exercises, multiple-choice questions, essay questions, and on-the-job lab projects

This pedagogically rich book is designed to make learning easy and enjoyable and to help you develop the skills and critical-thinking abilities that will enable you to adapt to different job situations and troubleshoot problems.

Mike Meyers’ proven ability to explain concepts in a clear, direct, even humorous way makes this book interesting, motivational, and fun.

Effective Learning Tools ■

Proven Learning Method Keeps You on Track Mike Meyers’ CompTIA Network+® Guide to Managing and Troubleshooting Networks is structured to give you comprehensive knowledge of computer skills and technologies. The textbook’s active learning methodology guides you beyond mere recall and—through thought-provoking activities, labs, and sidebars—helps you develop critical-thinking, diagnostic, and communication skills.

Try This! exercises apply core skills in a new setting.

Chapter Review sections provide concept summaries, key terms lists, and lots of questions and projects.

Key Terms Lists presents the important terms identified in the chapter.

Offers Practical Experience— Tutorials and lab assignments develop essential hands-on skills and put concepts in real-world contexts.

Robust Learning Tools— Summaries, key terms lists, quizzes, essay questions, and lab projects help you practice skills and measure progress.

Notes,Tips, and Warnings create a road map for success.

consider that type of NIC. The spe- cific process by which a NIC uses electricity to send and receive data is exceedingly complicated, but luck- ily for you, not necessary to under- stand. Instead, just think of a charge on the wire as a one, and no charge as a zero. A chunk of data moving in pulses across a wire might look something like Figure 2.13.

If you put an oscilloscope on the wire to measure voltage, you’d see something like Figure 2.14. An oscilloscope is a powerful micro- scope that enables you to see elec- trical pulses.

Now, remembering that the pulses represent bi- nary data, visualize instead a string of ones and zeroes moving across the wire (Figure 2.15).

Once you understand how data moves along the wire, the next question becomes this: how does the net- work get the right data to the right system? All networks transmit data by breaking whatever is moving across the physical layer (files, print jobs, Web pages, and so forth) into discrete chunks called frames. A frame is basically a container for a chunk of data moving across a network. The NIC creates and sends, as well as receives and reads, these frames.

I like to visualize an imaginary table inside every NIC that acts as a frame creation and reading station. I see frames as those pneumatic canis- ters you see when you go to a drive-in teller at a bank. A little guy inside the network card—named Nick, naturally!—builds these pneumatic canisters (the frames) on the table, and then shoots them out on the wire to the hub (Figure 2.16).

Chapter 2: Building a Network with the OSI Model 15

Try This! What’s Your MAC Address?

You can readily determine your MAC address on a Windows computer from the command line. This works in all modern versions of Windows.

1. In Windows 2000/XP, click Start | Run. Enter the command CMD and press the ENTER key to get to a command prompt.

2. In Windows Vista, click Start, enter CMD in the Start Search text box, and press the ENTER key to get to a command prompt.

3. At the command prompt, type the command IPCONFIG /ALL and press the ENTER key.

• Figure 2.13 Data moving along a wire

• Figure 2.14 Oscilloscope of data

• Figure 2.15 Data as ones and zeroes

• Figure 2.16 Inside the NIC

A number of different frame types are used in different net- works. All NICs on the same net- work must use the same frame type or they will not be able to communicate with other NICs.

consider that type of NIC. The spe- cific process by which a NIC uses electricity to send and receive data is exceedingly complicated, but luck- ily for you, not necessary to under- stand. Instead, just think of a charge on the wire as a one, and no charge as a zero. A chunk of data moving in pulses across a wire might look something like Figure 2.13.

If you put an oscilloscope on the wire to measure voltage, you’d see something like Figure 2.14. An oscilloscope is a powerful micro- scope that enables you to see elec- trical pulses.

Now, remembering that the pulses represent bi- nary data, visualize instead a string of ones and zeroes moving across the wire (Figure 2.15).

Once you understand how data moves along the wire, the next question becomes this: how does the net- work get the right data to the right system? All networks transmit data by breaking whatever is moving across the physical layer (files, print jobs, Web pages, and so forth) into discrete chunks called frames. A frame is basically a container for a chunk of data moving across a network. The NIC creates and sends, as well as receives and reads, these frames.

I like to visualize an imaginary table inside every NIC that acts as a frame creation and reading station. I see frames as those pneumatic canis- ters you see when you go to a drive-in teller at a bank. A little guy inside the network card—named Nick, naturally!—builds these pneumatic canisters (the frames) on the table, and then shoots them out on the wire to the hub (Figure 2.16).

Chapter 2: Building a Network with the OSI Model 15

Try This! What’s Your MAC Address?

You can readily determine your MAC address on a Windows computer from the command line. This works in all modern versions of Windows.

1. In Windows 2000/XP, click Start | Run. Enter the command CMD and press the ENTER key to get to a command prompt.

2. In Windows Vista, click Start, enter CMD in the Start Search text box, and press the ENTER key to get to a command prompt.

3. At the command prompt, type the command IPCONFIG /ALL and press the ENTER key.

• Figure 2.13 Data moving along a wire

• Figure 2.14 Oscilloscope of data

• Figure 2.15 Data as ones and zeroes

• Figure 2.16 Inside the NIC

A number of different frame types are used in different net- works. All NICs on the same net- work must use the same frame type or they will not be able to communicate with other NICs.

BaseTech

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Creating Scatter Diagrams And Correlation Matrix Using Stata

1

BADM 735 – Comparative Economics – Assignment Five (C)

Creating Scatter Diagrams and Correlation Matrix Using Stata

A scatter diagram plots two variables taken from the same point in time for different countries

to show relationship between the two variables.

For better understanding of scatter plots watch the video contained in the link below

 

According to the text, economic outcomes measured by economic growth is affected by a number

of factors. Also, hundreds of empirical studies on economic growth across countries have

highlighted the correlation between economic growth and a variety of variables.

a) Using your data from Assignment 3 B: Construct a scatterplot, in stata, that shows the

relationship between:

 

 Economic growth and Gross capital formation (% of GDP) (A measure of Investment)

 Economic growth and General government final consumption expenditure (% of GDP)

 Economic growth and Trade (% of GDP)

 Economic growth and Inflation, consumer prices (annual %)

 Economic growth and Foreign direct investment, net inflows (% of GDP)

 Economic growth and Population, total

 Economic growth and Total natural resources rents (% of GDP)

**Economic growth is our dependent variable; all the other variables are independent**

The graphs below should serve as a guide.

According to the graph, there appears to be a

positive correlation between Economic

Growth and Investment. The Correlation

coefficient is about 0.154 which confirms a

weak positive correlation between the two

variables.

 

 

 

 

 

 

 

 

 

 

2

STATA COMMANDS FOR SCATTER PLOTS

STEP 1: USING THE COMMAND WINDOW INSTALL “asdoc” AS SHOWN BELOW

 

“asdoc” is an add-on to stata that allows you to produce nicely formatted tables tables in stata

 

STEP 2: USING THE YOUR DO-FILE YOU CAN CREATE SCATTER PLOTS AS

SHOWN BELOW

 

 Why twoway -Because a scatter diagram plots two variables or shows the relationship

between two variables.

 Ifit- Fit a line in the scatter plot

 Note that your dependent variable comes before the independent variable ( as you can see

economic growth comes before trade)

Please note also that you have to run the same command for all the other relationships; for

example to show the relationship between economic growth and inflation you run:

twoway (scatter Economic_Growth Inflation) (lfit Economic_Growth Inflation)

 

STEP 3: EDITING, FORMATTING AND SAVING YOUR GRAPH

 It is important you edit your graph to conform to the scatter plot shown above. The video

contained in the link below should help you edit and format your graph.

 

 

STEP 4: COPY YOUR GRAPHS INTO WORD

 

 

 

3

b) Create a correlation matrix table that shows pairwise correlation coefficients between the

following variables (without significance test): GDP growth (annual %), Gross capital

formation (% of GDP), General government final consumption expenditure (% of GDP),

Trade (% of GDP), Inflation, consumer prices (annual %), Foreign direct investment, net

inflows (% of GDP), Population, total, and Total natural resources rents (% of GDP)

For better understanding of correlations watch the video contained in the link below

 

STATA COMMANDS FOR CORRELATION MATRIX

USING THE YOUR DO-FILE YOU CAN GENERATE THE CORRELATION MATRIX

AS SHOWN BELOW

 

 

A sample shot of a correlation matrix

 Column (1) is Economic Growth

 Column (2) is Investment

 Column (3) is Government Expenditure

The 0.154 shows the strength of the relationship between Economic growth and Investment

 

 

 

 

 

 

 

 

 

4

c) Compare the correlation matrix with the scatter graphs. See the example below

According to the graph, there appears to be a

positive correlation between Economic

Growth and Investment. The Correlation

coefficient is about 0.154 which confirms a

weak positive correlation between the two

variables.

 

 

 

 

 

 

 

 

 

 

 

***Please do not hesitate to call or email if you need assistance***

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

P5_CS6262

Project 5 : Machine Learning for Security

Spring, 2021

Contents:

1 Goals 2

2 Section 1: Project quiz (5 points) 3-4

3 Section 2: Project setup 5

4 Section 3: Project tasks (95 points) 6-11

5 Section 4: Final deliverables and rubric 12-14

6 Section 5: FAQs 15-18

7 Section 6: Academic integrity 19

1

 

 

Goals of the Project

● The goal of this project is to introduce students to machine learning techniques and methodologies that help to differentiate between malicious and legitimate network traffic.

● In summary, students are introduced to: ○ how to build a machine-learning model based on normal network traffic. ○ how to conduct a blending attack producing artificial network traffic that

resembles the normal one, and bypasses the learned model.

Suggestion We recommend you to use the Linux VM provided. However, in the past, students faced no difficulty in setting up the project and working on either Windows or Macintosh OS.

Readings and Resources This project relies on the following readings:

● “Anomalous Payload-based Worm Detection and Signature Generation”, Ke Wang and Salvatore J.Stolfo, RAID2004

● “Polymorphic Blending Attacks”, Prahlad Fogla, Monirul Sharif, Roberto Perdisci, Oleg Kolesnikov, Wenke Lee, Usenix Security 2006

● “Sensitivity and specificity”

2

 

 

Section 1: Project Quiz (5 points)

We have created a small quiz to help you understand the topics covered in this project. Please read the papers (under Readings and Resources) before attempting the quiz and the subsequent tasks.

1. In 1-gram PAYL, the byte frequency is calculated by counting the number of occurrences of a

particular byte and dividing it by the length of the payload.

a. True

b. False

2. The threshold for Mahalanobis distance is used to determine if the current payload is normal

or malicious. Specifically, if the Mahalanobis distance of the current payload is LESS than the

threshold, the current payload is malicious and an alert is raised by PAYL.

a. True

b. False

3. Since polymorphic blending attacks try to evade network anomaly based intrusion detection

system (IDS) by making the attacks look like normal traffic, they can be viewed as a subclass of

mimicry attacks.

a. True

b. False

4. In polymorphic blending attacks, the attacker uses an artificial profile which can be defined as:

a. The attack payload’s profile which can bypass the IDS

b. The profile of the payload generated by the polymorphic decryptor

c. The profile estimated by observing normal traffic

d. None of the above

5. Polymorphic blending attacks use the following basic steps: (1) Blend the attack body within

an instance of normal traffic payload and create an artificial payload using polymorphic

encryption, (2) Let the IDS analyse this artificial payload and monitor the response received

from IDS (3) Based on the response received repeat step 1 with another instance of normal

traffic payload. Repeat until you find an artificial payload that can evade the IDS.

a. True

b. False

3

 

 

1.1: Deliverables

For each question, please enter your option in answers.txt as shown in the sample file below. You

will deliver answers.txt for this part.

You can find answers.txt under the project directory.

4

 

 

Section 2: Project Setup

You can either use the provided VM to complete the project OR you can set up your own environment locally.

2.1: VM Setup 1. Download the VM using one of the links provided in the project description on canvas. 2. All the required packages/dependencies are already installed in the VM. The project files are under: Desktop -> project 5

2.2: Local Setup 1. Download the project zip file from the link provided in the project description on canvas .

2. Please refer SETUP.txt in the PAYL directory to install the dependencies, using the same versions specified in the SETUP.txt.

TIP: Even if you are using the provided VM, please check SETUP.txt to understand how the project is set up and to get an overview on the various code components in the project. This might help in debugging any issues you might face later.

5

 

 

Section 3: Project Tasks (95 points)

3.1: Task A – (30 points)

3.1.1: Preliminary Reading Please refer to the reference readings to learn about how PAYL model works, in particular,

a) how to extract byte frequency from the data b) how to train the model c) the definitions of parameters, threshold and smoothing factor

3.1.2: Code and data provided The PAYL directory provides he PAYL code and data for model training.

3.1.3: PAYL Code Workflow Here is the workflow of the provided PAYL code:

● Operates in 2 modes: a) training mode: It reads pcap files provided in the ‘data’ directory, and tests

parameters and reports the True Positive rates. b) testing mode: It first builds a model using parameters and data specified in the

directory. Then it will test a specific packet and decide whether the test packet fits the model.

● Training mode ○ Read the normal traffic data and divide it into two parts, 75% of the data for

training and the rest 25% for testing (NOTE: You will NOT change these portions in the code).

○ Sort the payload strings by length and generate a model for each length. ○ Each model per length is based on [mean frequency of each ascii, standard deviation

of frequencies for each ascii].

To run PAYL in training mode

$ python3 wrapper.py

Testing mode

● Read the normal traffic data from the directory, and train a model using specific parameters. Then test the specific packet (fed from the command line) using the trained model.

● Compute the mahalanobis distance between each test payload and the model (of the same length)

● Label the payload: If the mahalanobis distance is below the specified threshold, label the payload as normal traffic. Otherwise, label the packet as attack traffic.

6

 

 

To run PAYL in testing mode

$ python3 wrapper.py [FILE.pcap]

where FILE.pcap is the data you will test.

3.1.4: Tasks – Conduct experiments to select parameters

● You are provided with artificial payloads (normal network traffic) to train a PAYL model. ● After reading the reference papers, it should make sense that you cannot train the PAYL

model on the entire traffic of different protocols. So first you need to select a protocol: a) HTTP or b) DNS by changing the hard-coded option in wrapper.py.

● The next step is to select a proper pair of parameters for the model. For the selection process, you will provide a range for both parameters (by modifying the threshold and smoothing factor in wrapper.py). Then run wrapper.py on training mode and make sure the normal traffic (artificial payloads stored in the default data folder) is fed while training.

● The code will output the statistics for the parameters in the range. As shown in the figure below, for each pair of parameters, you will observe a True Positive Rate. You need to report a pair of parameters (mSF and mTmd) output by the code that achieves True Positive rate of 96% or more. More than 99% true positive rate is possible and you may find multiple pairs of parameters that can achieve that.

The figure shows a sample output from the wrapper.py. You will find mSF and mTMD values which make mTP>96% for both HTTP and DNS protocols respectively. The parameters can be different for the two protocols.

3.1.5: Deliverables

Please report for each protocol that you used, the parameters that you found (output by

wrapper.py) in a file named parameters.txt. Please report a decimal with 2-digit accuracy for

each parameter.

7

 

 

NOTE: You are given a sample parameters.txt with dummy values in the PAYL directory. Please

update the relevant values with your own answer. Check section 4 for more details.

NOTE: The value for “Distance” in parameters.txt will be obtained in the next task (section 3.2).

TIP: You can set lower and upper bound values of both parameters in wrapper.py as the values you found in training mode to avoid multiple iterations during testing mode.

3.2: Task B – (5 points)

Download your unique attack payload [YOUR_GTUSERNAME.pcap] from Files in Canvas. (Path: Files -> Projects -> Project Five -> student pcaps) Replace YOUR_GTUSERNAME with your GT username.

For this part, your task is to examine the parameters you chose in Task A. Once the parameters are fixed, make sure the attack data does not fit the model, while the artificial ones (normal network traffic) fit. If such properties do not hold, you may want to redo Task A to modify the parameters to fulfill the requirements for both Task A and Task B. This procedure is essential for demonstrating the polymorphic blending attack in Task C.

Use PAYL in testing mode ● You will first test your unique attack payload for both HTTP and DNS protocols ( NOTE:

DO NOT forget to change Smoothing Factor and Threshold for Mahalanobis Distance when you change the protocol).

● Verify that your attack payload gets rejected for both protocols. By rejected, we mean that you will get the “It doesn’t fit the model” message on your test screen as presented in the following figure.

● Then verify the artificial payloads (normal traffic). We provide two artificial payloads; one for HTTP (http_artificial_profile.pcap) and one for DNS (dns_artificial_profile.pcap). Both

8

 

 

are in the PAYL folder. Test each artificial payload against your model. That is, use testing mode as explained above by giving each artificial payload as parameter. (NOTE: DO NOT forget to change parameters according to each protocol while testing relevant payload, e.g., DNS parameters to test dns_artificial_profile.pcap.) These should be accepted by the model. That is, you should get an output message that says “It fits the model” as presented in the following figure.

3.2.1: Deliverables Please report your calculated distance (mDISTANCE in above figures) in parameters.txt for each protocol with the values of the attack payload (YOUR_GTUSERNAME.pcap) after completing Task B.

NOTE: You are given a sample parameters.txt with dummy values under PAYL directory. Please

update the relevant values with your own answer. Check section 4 for more details.

3.3: Task C – (60 points)

Preliminary reading. Please refer to the “Polymorphic Blending Attacks” paper. In particular, section 4.2 that describes how to evade 1-gram and the model implementation. More specifically we are focusing on the case where m <= n and the substitution is ONE-TO-MANY.

We assume that the attacker has a specific payload (attack payload) that she would like to blend in with the normal traffic. Also, we assume that the attacker has access to one packet (artificial profile payload) that is normal and is accepted as normal by the PAYL model.

The attacker’s goal is to transform the byte frequency of the attack traffic so that it matches the byte frequency of the normal traffic, and thus bypass the PAYL model.

9

 

 

NOTE: Complete this task ONLY for the HTTP protocol.

Code provided: Please look at the Polymorphic_blend directory. All files (including attack payload) for this task should be in this directory. Hence, copy your unique attack payload also in this directory. Rename ATTACKBODY_PATH in task1.py with your unique attack payload name (YOUR_GTUSERNAME.pcap).

How to run the code

$ python3 task1.py

NOTE: You need to complete Task C before running task1.py.

Main function task1.py contains all the functions that are called to transform the byte frequency of the attack traffic.

Output ● The code should generate a new payload (filename: output) that can successfully bypass

the PAYL model that you have found above (using your selected parameters in Task A and B).

● The new payload (output) is shellcode.bin + encrypted attack body + XOR table + padding. Please refer to the paper for full descriptions and definitions of shellcode, attack body, XOR table and padding.

● The shellcode is provided.

Substitution table We provide the skeleton for the code needed to generate a substitution table, based on the byte frequency of attack payload and artificial profile payload. For the purpose of implementation, the substitution table can be e.g. a python dictionary table. We ask that you complete the code for the substitution function. The substitution is one-to-many. Skeleton code prints the substitution table to the console. You will deliver your substitution table in substitution_table.txt file as in the following format.

NOTE: This is just an example to show the format of the table. Please ignore the frequency values. NOTE: The substitution table should have the frequencies as observed in the normal payload. Please do NOT normalize these values in substitution_table.txt. You can normalize the values later during substitution in substitution.py.

10

 

 

Padding Similarly, we have provided a skeleton for the padding function and we are asking you to complete

the rest.

Main tasks

Please complete the code for the substitution.py and padding.py and then run task1.py to

generate the new payload (output).

3.3.1: Deliverables

● You will deliver substitution.py, padding.py, your new payload (output) and substitution_table.txt for this task.

● You’re expected to write comments for your code. Otherwise, you will lose 5 points.

Test your output Test your new payload (output) against the PAYL model and verify that it is accepted. FP should be 100% indicating that the payload got accepted as legit, even though it is malicious. You should run as follows and observe the following output, and get the output message that says, “It fits the model”.

TIP: Check the relevant FAQs in section 5.

IMPORTANT: Please check section 5.6 to understand how you can verify your code.

11

 

 

Section 4: Final deliverables and Rubric

Tasks Deliverable Files

Project Quiz answers.txt

A & B parameters.txt

C substitution.py

padding.py

substitution_table.txt

output

Total: 6 files

Total points: 100

4.1: Project Quiz – 5 points

4.2: Task A – 30 points Please report (for each protocol) the parameters that you found in a file named parameters.txt. Please report a decimal with 2 digit accuracy for each parameter.

4.3: Task B – 5 points Please report your calculated distance (mDISTANCE in above figures) in parameters.txt for each protocol with the values of the attack payload after completing Task B.

parameters.txt format:

|Protocol:HTTP| |Threshold:1111.00| |SmoothingFactor:0.01| |TruePositiveRate:50.00| |Distance:2000.00| |Protocol:DNS| |Threshold:2222.00| |SmoothingFactor:0.00| |TruePositiveRate:50.00| |Distance:2000.00|

NOTE: You are given a sample parameters.txt with dummy values under PAYL directory. Please

update each value with your own answer. Those values should only come from the PAYL script’s

output to the console. (not from the values modified inside the script).

12

 

 

Description of fields in parameters.txt

|Protocol:HTTP| |Threshold:1111.00| // Part A |SmoothingFactor 0.01| // Part A |TruePositiveRate:50.00| // Part A |Distance:20020.00| // Part B, mDISTANCE this is the mDISTANCE value that you get from your unique pcap file (python wrapper.py <yourunique.pcap>) |Protocol:DNS| |Threshold:2222.00| // Part A |SmoothingFactor:0.00| // Part A |TruePositiveRate:50.00| // Part A |Distance:22000.00| // Part B, mDISTANCE this is the mDISTANCE value that you get from your unique pcap file (python wrapper.py <yourunique.pcap>)

NOTE: “0.3” should be entered as “0.30”. “2” should be entered as “2.00”.

4.4: Task C – 60 points Code: 40 points. Please submit your code files substitution.py (20 points) and padding.py (10 points), and your substitution_table.txt (10 points).

Output: 20 points. Please submit your output of Task C generated as a new file after running task1.py.

4.5: !! Important Notes (Please check before submission) !!

● Every file name with wrong name and/or extension will be penalized with 5 points.

● Do NOT ZIP your deliverable files. You will lose 5 points for zipped files.

● Follow the format for substitution_table.txt above (section 3.3), for wrong format you will lose 5 points.

● Follow the format for parameters.txt above, for the wrong format you will lose 5 points.

● Do not forget to update your parameters.txt If you submit sample parameters.txt with dummy values, you will get 0/35 for Task A and B. We won’t accept resubmission after the due date.

● You should complete Task A, B and C with the same set of parameters. If your output doesn’t pass the model with parameters in your parameters.txt you will get 0/20 for output.

13

 

 

● For Task B, in parameters.txt you will report calculated distance after you provide your own attack payload. (i.e.YOUR_GTUSERNAME.pcap)

● For Task C, You are allowed to import and use “random” or “numpy”. Do NOT import any other libraries.

● If you don’t implement the correct algorithm for Task C, even if your output passes the model you won’t get full credit. We will not accept the implementation of ONE-ONE mapping. (Check section 5.2)

● Don’t forget to put comments for your code. Otherwise, you will lose 5 points.

14

 

 

Section 5: FAQs

5.1: Task C clarifications

● As we saw in part A+B, your unique attack payload does not fit the model. In Task C we want to make our pcap fit.

● We care about our attack payload being turned into what a normal payload would look like. ● We’re simply performing substitution and padding to match the character frequency and

packet size. ● We want to modify the various python functions to perform this substitution and padding

for us. ● After the functions have been crafted, copy the file it generates (output) over to your PAYL

directory and test it (python3 wrapper.py output). You want it to fit the model.

5.2: How to implement Substitution Table & Substitute? First Refer to the “Polymorphic Blending Attacks” paper. In particular, section 4.2 that describes how to evade 1-gram and the model implementation. More specifically we are focusing on the case where m <= n and the substitution is ONE-TO-MANY.

NOTE: We will not accept the implementation of ONE-ONE mapping.

Refer to the example provided in the write-up (section 5.5).

After reading the paper and example, it should be obvious how to implement a substitution table. If you still have any specific questions you can post your questions on piazza.

Substitution Given an attack byte, find the mapping in your Substitution Table. You will have multiple choices because of how we constructed the table. Pick one based on the ratio of the bytes frequency to the sum of all frequencies. You have to normalize the frequencies to sum up to 1.

NOTE: You are allowed to import and use “random or numpy” for this task. Do NOT import any other libraries.

5.3: How to implement Padding? Find the byte with the largest byte frequency difference, say ‘a’, and append ‘a’ to the raw_payload (padding.py). Padding function is called repeatedly when

len(raw_payload) < len(artificial_payload) (as in task1.py).

So each time you only need to pad one byte when the padding function is called.

15

 

 

5.4: XOR and result Clarification in Task C

Both are lists of characters, where ‘result’ keeps the replacement chars and ‘xor’ keeps the XOR of replacement and corresponding attack value.

From the sample in the write-up. Assume ‘t’ is replaced by ‘Z’ then your result will include ‘Z’ and xor table will include XOR(‘t’,’Z’)=’.’

NOTE: Be careful while XORing the chars NOTE: You substitution_table.txt should have the format we mentioned in the writeup. NOTE: You need to verify your Task C and see your original packet content. (check section 5.6)

5.5: Simple example for substitution Please refer to the ‘Polymorphic Blending Attack’: Substitution part

Example # normal traffic (x) and attack traffic (y):

x = abbcccdddd, y = rrsss

# distinct characters in normal traffic (n) and attack body (m): n = 4, m = 2

# frequency of characters in normal traffic f(x) and attack body g(y): f(x) = [(‘d’, 0.4), (‘c’, 0.3), (‘b’, 0.2), (‘a’, 0.1)] , g(y) = [(‘s’, 0.6), (‘r’, 0.4)]

For the first m characters in (x), create a one-to-one mapping in both sets: Let : t^f(y_j) = f(x_i) Then:

S(s) = [(‘d’, 0.4)] S(r) = [(‘c’, 0.3)] t^f(s) = 0.4 t^f(r) = 0.3

For the (m+1)th char, first find the attack character with max ratio of g(y_j)/t^f(y_j): g(s)/(t^f(s)) = 0.6/0.4 = 1.5 g(r)/(t^f(r)) = 0.4/0.3 = 1.33

So, the next attack character is ‘s’. Then, your substitution table at this step is: S(s)= [(‘d’, 0.4), (‘b’,0.2)] S(r)= [(‘c’, 0.3)]

16

 

 

and update: t^f(s)=0.4+0.2=0.6

Repeat to find the next attack character and so on. g(s) / (t^f(s)) = 0.6/0.6 = 1 g(r) / (t^f(r)) = 0.4/0.3 = 1.33

Now, the next attack character is ‘r’. Then, your substitution table at this step is S(s)= [(‘d’, 0.4), (‘b’,0.2)] S(r)= [(‘c’, 0.3), (‘a’,0.1)]

and update: t^f(r) = 0.3 + 0.1 = 0.4

After you finish the substitution, you are done with t^f(y_j)’s and you will make a substitution with the frequency weight of each character in the table.

s is substituted with: d with a probability of 0.4/(0.4+0.2) b with a probability of 0.2/(0.4+0.2)

r is substituted with: c with a probability of 0.3/(0.3+0.1) a with a probability of 0.1/(0.3+0.1)

It is up to you how you implement a weighted random assignment, but it is a trivial step.

5.6 How to verify Task C? If you only have 64-bit compiler, you need to run following:

$ sudo apt-get install lib32gcc-4.9-dev

$ sudo apt-get install gcc-multilib

NOTE: You can also verify Task C using lib32gcc-9-dev.

If you’re on Ubuntu Xenial, the one listed in the instructions should work: lib32gcc-4.9-dev If you’re on Debian Buster or Ubuntu Bionic, try: lib32gcc-8-dev If you’re on Ubuntu Cosmic or Disco, try: lib32gcc-9-dev

The 32 bit compiler is already installed in the VM.

Next, you need to generate your payload. So, somewhere near the end of task1.py add the following to create your payload.bin:

17

 

 

payload_file:

payload_file.write(bytearray(“”.join(adjusted_attack_body + xor_table), “utf8”))

Now, run task1.py to generate payload.bin and once it’s generated, run the makefile with make and then run a.out:

$ make

$ ./a.out

If all is well, you should see your original packet contents. If not and you get a bunch of funny letters it didn’t work.

NOTE: It was only tested on Linux, you might need to make a few modifications according to your system configuration.

18

 

 

Section 6: Academic Integrity

● All submitted code must be written by you. ● Borrowing or adapting code from other students and websites like Stack Overflow, code

repositories, and other sources is strictly forbidden. ● You may not discuss specific solutions. Keep your discussions at a high level. ● Sharing code is strictly forbidden. ● Note that we will report you to the Office of Student Integrity if there is a violation. ● As a reminder, please review the Georgia Tech Honor Code and the course policies

outlined in the syllabus.

Good luck and have fun!!

19

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Phython

Case Study/.DS_Store

Case Study/breezypythongui.py

“”” File: breezypythongui.py Version: 1.1 Copyright 2012, 2013 by Ken Lambert Resources for easy Python GUIs. LICENSE: This is open-source software released under the terms of the GPL (http://www.gnu.org/licenses/gpl.html). Its capabilities mirror those of BreezyGUI and BreezySwing, open-source frameworks for writing GUIs in Java, written by Ken Lambert and Martin Osborne. PLATFORMS: The package is a wrapper around Tkinter (Python 3.X) and should run on any platform where Tkinter is available. INSTALLATION: Put this file where Python can see it. RELEASE NOTES: Version 1.1 now includes the class EasyPanel, for organizing subpanes in windows and dialogs (updated 12-19-2012). Version 1.1 now also runs on either Python 3.x.x or Python 2.x.x (updated 2-4-2013). “”” import sys versionNumber = sys.version_info.major if versionNumber == 3: import tkinter import tkinter.simpledialog Tkinter = tkinter tkSimpleDialog = tkinter.simpledialog else: import Tkinter import tkSimpleDialog N = Tkinter.N S = Tkinter.S E = Tkinter.E W = Tkinter.W CENTER = Tkinter.CENTER END = Tkinter.END NORMAL = Tkinter.NORMAL DISABLED = Tkinter.DISABLED NONE = Tkinter.NONE WORD = Tkinter.WORD VERTICAL = Tkinter.VERTICAL HORIZONTAL = Tkinter.HORIZONTAL RAISED = Tkinter.RAISED SINGLE = Tkinter.SINGLE ACTIVE = Tkinter.ACTIVE class EasyFrame(Tkinter.Frame): “””Represents an application window.””” def __init__(self, title = “”, width = None, height = None, background = “white”, resizable = True): “””Will shrink wrap the window around the widgets if width and height are not provided.””” Tkinter.Frame.__init__(self, borderwidth = 4, relief = “sunken”) if width and height: self.setSize(width, height) self.master.title(title) self.grid() # Expand the frame within the window self.master.rowconfigure(0, weight = 1) self.master.columnconfigure(0, weight = 1) self.grid(sticky = N+S+E+W) # Set the background color and resizability self.setBackground(background) self.setResizable(resizable) def setBackground(self, color): “””Resets the window’s background color to color.””” self[“background”] = color def setResizable(self, state): “””Resets the window’s resizable property to True or False.””” self.master.resizable(state, state) def setSize(self, width, height): “””Resets the window’s width and height in pixels.””” self.master.geometry(str(width)+ “x” + str(height)) def setTitle(self, title): “””Resets the window’s title to title.””” self.master.title(title) # Methods to add widgets to the window. The row and column in # the grid are required arguments. def addLabel(self, text, row, column, columnspan = 1, rowspan = 1, sticky = N+W, font = None, background = “white”, foreground = “black”): “””Creates and inserts a label at the row and column, and returns the label.””” label = Tkinter.Label(self, text = text, font = font, background = background, foreground = foreground) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) label.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return label def addButton(self, text, row, column, columnspan = 1, rowspan = 1, command = lambda: None, state = NORMAL): “””Creates and inserts a button at the row and column, and returns the button.””” button = Tkinter.Button(self, text = text, command = command, state = state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) button.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5) return button def addFloatField(self, value, row, column, columnspan = 1, rowspan = 1, width = 20, precision = None, sticky = N+E, state = NORMAL): “””Creates and inserts a float field at the row and column, and returns the float field.””” field = FloatField(self, value, width, precision, state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addIntegerField(self, value, row, column, columnspan = 1, rowspan = 1, width = 10, sticky = N+E, state = NORMAL): “””Creates and inserts an integer field at the row and column, and returns the integer field.””” field = IntegerField(self, value, width, state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addTextField(self, text, row, column, columnspan = 1, rowspan = 1, width = 20, sticky = N+E, state = NORMAL): “””Creates and inserts a text field at the row and column, and returns the text field.””” field = TextField(self, text, width, state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addTextArea(self, text, row, column, rowspan = 1, columnspan = 1, width = 80, height = 5, wrap = NONE): “””Creates and inserts a multiline text area at the row and column, and returns the text area. Vertical and horizontal scrollbars are provided.””” frame = Tkinter.Frame(self) frame.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) self.columnconfigure(column, weight = 1) self.rowconfigure(row, weight = 1) xScroll = Tkinter.Scrollbar(frame, orient = HORIZONTAL) xScroll.grid(row = 1, column = 0, sticky = E+W) yScroll = Tkinter.Scrollbar(frame, orient = VERTICAL) yScroll.grid(row = 0, column = 1, sticky = N+S) area = TextArea(frame, text, width, height, xScroll.set, yScroll.set, wrap) area.grid(row = 0, column = 0, padx = 5, pady = 5, sticky = N+S+E+W) frame.columnconfigure(0, weight = 1) frame.rowconfigure(0, weight = 1) xScroll[“command”] = area.xview yScroll[“command”] = area.yview return area def addListbox(self, row, column, rowspan = 1, columnspan = 1, width = 10, height = 5, listItemSelected = lambda index: index): “””Creates and inserts a scrolling list box at the row and column, with a width and height in lines and columns of text, and a default item selection method, and returns the list box.””” frame = Tkinter.Frame(self) frame.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) self.columnconfigure(column, weight = 1) self.rowconfigure(row, weight = 1) yScroll = Tkinter.Scrollbar(frame, orient = VERTICAL) yScroll.grid(row = 0, column = 1, sticky = N+S) listBox = EasyListbox(frame, width, height, yScroll.set, listItemSelected) listBox.grid(row = 0, column = 0, sticky = N+S+E+W) frame.columnconfigure(0, weight = 1) frame.rowconfigure(0, weight = 1) yScroll[“command”] = listBox.yview return listBox def addCanvas(self, canvas = None, row = 0, column = 0, rowspan = 1, columnspan = 1, width = 200, height = 100, background = “white”): “””Creates and inserts a canvas at the row and column, and returns the canvas.””” if not canvas: canvas = EasyCanvas(self, width = width, height = height, background = background) canvas.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = W+E+N+S) self.columnconfigure(column, weight = 10) self.rowconfigure(row, weight = 10) return canvas def addScale(self, row, column, rowspan = 1, columnspan = 1, command = lambda value: value, from_ = 0, to = 0, label = “”, length = 100, orient = HORIZONTAL, resolution = 1, tickinterval = 0): “””Creates and inserts a scale at the row and column, and returns the scale.””” scale = Tkinter.Scale(self, command = command, from_ = from_, to = to, label = label, length = length, orient = orient, resolution = resolution, tickinterval = tickinterval, relief = “sunken”, borderwidth = 4) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) scale.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) return scale def addMenuBar(self, row, column, rowspan = 1, columnspan = 1, orient = “horizontal”): “””Creates and inserts a menu bar at the row and column, and returns the menu bar.””” if not orient in (“horizontal”, “vertical”): raise ValueError(“orient must be horizontal or vertical”) menuBar = EasyMenuBar(self, orient) menuBar.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = N+W) return menuBar def addCheckbutton(self, text, row, column, rowspan = 1, columnspan = 1, sticky = N+S+E+W, command = lambda : 0): “””Creates and inserts check button at the row and column, and returns the check button.””” cb = EasyCheckbutton(self, text, command) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) cb.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return cb def addRadiobuttonGroup(self, row, column, rowspan = 1, columnspan = 1, orient = VERTICAL): “””Creates and returns a radio button group.””” return EasyRadiobuttonGroup(self, row, column, rowspan, columnspan, orient) # Added 12-18-2012 def addPanel(self, row, column, rowspan = 1, columnspan = 1, background = “white”): “””Creates and returns a panel.””” return EasyPanel(self, row, column, rowspan, columnspan, background) # Method to pop up a message box from this window. def messageBox(self, title = “”, message = “”, width = 25, height = 5): “””Creates and pops up a message box, with the given title, message, and width and height in rows and columns of text.””” dlg = MessageBox(self, title, message, width, height) return dlg.modified() # Method to pop up a prompter box from this window. def prompterBox(self, title = “”, promptString = “”, inputText = “”, fieldWidth = 20): “””Creates and pops up a prompter box, with the given title, prompt, input text, and field width in columns of text. Returns the text entered at the prompt.””” dlg = PrompterBox(self, title, promptString, inputText, fieldWidth) return dlg.getText() # Classes for easy widgets class AbstractField(Tkinter.Entry): “””Represents common features of float fields, integer fields, and text fields.””” def __init__(self, parent, value, width, state): self.var = Tkinter.StringVar() self.setValue(value) Tkinter.Entry.__init__(self, parent, textvariable = self.var, width = width, state = state) def setValue(self, value): self.var.set(value) def getValue(self): return self.var.get() class FloatField(AbstractField): “””Represents a single line box for I/O of floats.””” def __init__(self, parent, value, width, precision, state): self.setPrecision(precision) AbstractField.__init__(self, parent, value, width, state) def getNumber(self): “””Returns the float contained in the field. Raises: ValueError if number format is bad.””” return float(self.getValue()) def setNumber(self, number): “””Replaces the float contained in the field.””” self.setValue(self._precision % number) def setPrecision(self, precision): “””Resets the precision for the display of a float.””” if precision and precision >= 0: self._precision = “%0.” + str(precision) + “f” else: self._precision = “%f” class IntegerField(AbstractField): “””Represents a single line box for I/O of integers.””” def __init__(self, parent, value, width, state): AbstractField.__init__(self, parent, value, width, state) def getNumber(self): “””Returns the integer contained in the field. Raises: ValueError if number format is bad.””” return int(self.getValue()) def setNumber(self, number): “””Replaces the integer contained in the field.””” self.setValue(str(number)) class TextField(AbstractField): “””Represents a single line box for I/O of strings.””” def __init__(self, parent, value, width, state): AbstractField.__init__(self, parent, value, width, state) def getText(self): “””Returns the string contained in the field.””” return self.getValue() def setText(self, text): “””Replaces the string contained in the field.””” self.setValue(text) class TextArea(Tkinter.Text): “””Represents a box for I/O of multiline text.””” def __init__(self, parent, text, width, height, xscrollcommand, yscrollcommand, wrap): Tkinter.Text.__init__(self, parent, width = width, height = height, wrap = wrap, xscrollcommand = xscrollcommand, yscrollcommand = yscrollcommand) self.setText(text) def getText(self): “””Returns the string contained in the text area.””” return self.get(“1.0”, END) def setText(self, text): “””Replaces the string contained in the text area.””” self.delete(“1.0”, END) self.insert(“1.0”, text) def appendText(self, text): “””Inserts the text after the string contained in the text area.””” self.insert(END, text) class EasyListbox(Tkinter.Listbox): “””Represents a list box.””” def __init__(self, parent, width, height, yscrollcommand, listItemSelected): self._listItemSelected = listItemSelected Tkinter.Listbox.__init__(self, parent, width = width, height = height, yscrollcommand = yscrollcommand, selectmode = SINGLE) self.bind(“<<ListboxSelect>>”, self.triggerListItemSelected) def triggerListItemSelected(self, event): “””Strategy method to respond to an item selection in the list box. Runs the client’s listItemSelected method with the selected index if there is one.””” if self.size() == 0: return widget = event.widget index = widget.curselection()[0] self._listItemSelected(index) def getSelectedIndex(self): “””Returns the index of the selected item or -1 if no item is selected.””” tup = self.curselection() if len(tup) == 0: return -1 else: return int(tup[0]) def getSelectedItem(self): “””Returns the selected item or the empty string if no item is selected.””” index = self.getSelectedIndex() if index == -1: return “” else: return self.get(index) def setSelectedIndex(self, index): “””Selects the item at the index if it’s in the range.””” if index < 0 or index >= self.size(): return self.selection_set(index, index) def clear(self): “””Deletes all items from the list box.””” while self.size() > 0: self.delete(0) def getIndex(self, item): “””Returns the index of item if it’s in the list box, or -1 otherwise.””” tup = self.get(0, self.size() – 1) if item in tup: return tup.index(item) else: return -1 class EasyRadiobuttonGroup(Tkinter.Frame): “””Represents a group of radio buttons, only one of which is selected at any given time.””” def __init__(self, parent, row, column, rowspan, columnspan, orient): Tkinter.Frame.__init__(self, parent) self.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = N+S+E+W) self._commonVar = Tkinter.StringVar(“”) self._buttons = dict() self._orient = orient self._buttonRow = self._buttonColumn = 0 def addRadiobutton(self, text, command = lambda : 0): “””Creates a button with the given text and command, adds it to the group, and returns the button.””” if text in self._buttons: raise ValueError(“Button with this label already in the group”) button = Tkinter.Radiobutton(self, text = text, value = text, command = command, variable = self._commonVar) self._buttons[text] = button button.grid(row = self._buttonRow, column = self._buttonColumn, sticky = N+W) if self._orient == VERTICAL: self.rowconfigure(self._buttonRow, weight = 1) self._buttonRow += 1 else: self.columnconfigure(self._buttonColumn, weight = 1) self._buttonColumn += 1 return button def getSelectedButton(self): if not self._commonVar.get() in self._buttons: raise ValueError(“No button has been selected yet.”) return self._buttons[self._commonVar.get()] def setSelectedButton(self, button): self._commonVar.set(button[“value”]) class EasyCheckbutton(Tkinter.Checkbutton): “””Represents a check button.””” def __init__(self, parent, text, command): self._variable = Tkinter.IntVar() Tkinter.Checkbutton.__init__(self, parent, text = text, variable = self._variable, command = command) def isChecked(self): “””Returns True if the button is checked or False otherwise.””” return self._variable.get() != 0 class EasyMenuBar(Tkinter.Frame): “””Represents a menu bar.””” def __init__(self, parent, orient): self._orient = orient self._row = self._column = 0 Tkinter.Frame.__init__(self, parent, relief = RAISED, borderwidth = 1) def addMenu(self, text, state = NORMAL): “””Creates and inserts a menu into the menubar, and returns the menu.””” menu = EasyMenubutton(self, text, state = state) menu.grid(row = self._row, column = self._column) if self._orient == “horizontal”: self._column += 1 else: self._row += 1 return menu class EasyMenubutton(Tkinter.Menubutton): “””Represents a menu button.””” def __init__(self, menuBar, text, state): Tkinter.Menubutton.__init__(self, menuBar, text = text, state = state) self.menu = Tkinter.Menu(self) self[“menu”] = self.menu self._currentIndex = -1 def addMenuItem(self, text, command, state = NORMAL): “””Inserts a menu option in the given menu.””” self.menu.add_command(label = text, command = command, state = state) self._currentIndex += 1 return EasyMenuItem(self, self._currentIndex) class EasyMenuItem(object): “””Represents an option in a drop-down menu.””” def __init__(self, menu, index): self._menu = menu self._index = index def setState(self, state): “””Sets the state of the item to state.””” self._menu.menu.entryconfigure(self._index, state = state) class EasyCanvas(Tkinter.Canvas): “””Represents a rectangular area for interactive drawing of shapes. Supports simple commands for drawing lines, rectangles, and ovals, as well as methods for responding to mouse events in the canvas.””” def __init__(self, parent, width = None, height = None, background = “white”): Tkinter.Canvas.__init__(self, parent, width = width, height = height, background = background) self.bind(“<Double-Button-1>”, self.mouseDoubleClicked) self.bind(“<ButtonPress-1>”, self.mousePressed) self.bind(“<ButtonRelease-1>”, self.mouseReleased) self.bind(“<B1-Motion>”, self.mouseDragged) # Mouse event handling methods. One or more of these methods can # be overridden in the subclass to implement the required actions. # The event argument can be used to extract the current mouse # cursor coordinates (event.x and event.y). def mouseDoubleClicked(self, event): “””Triggered when the mouse is double-clicked in the area of this canvas.””” return def mousePressed(self, event): “””Triggered when the mouse is pressed in the area of this canvas.””” return def mouseReleased(self, event): “””Triggered when the mouse is released in the area of this canvas.””” return def mouseDragged(self, event): “””Triggered when the mouse is dragged in the area of this canvas.””” return def getWidth(self): “””Returns the width of the canvas.””” return self[“width”] def getHeight(self): “””Returns the height of the canvas.””” return self[“height”] def drawLine(self, x0, y0, x1, y1, fill = “black”, width = 1): item = self.create_line(x0, y0, x1, y1) self.itemconfig(item, fill = fill, width = width) return item def drawRectangle(self, x0, y0, x1, y1, outline = “black”, fill = None): “””Draws a rectangle with the given corner points, outline color, and fill color.””” item = self.create_rectangle(x0, y0, x1, y1) self.itemconfig(item, outline = outline, fill = fill) return item def drawOval(self, x0, y0, x1, y1, outline = “black”, fill = None): “””Draws an ovel within the given corner points, with the given outline color and fill color.””” item = self.create_oval(x0, y0, x1, y1) self.itemconfig(item, outline = outline, fill = fill) return item def drawText(self, text, x, y, fill = “black”): “””Draws the given text (a string) at the given coordinates with the given fill color. The string is centered vertically and horizontally at the given coordinates.””” item = self.create_text(x, y) self.itemconfig(item, text = text, fill = fill) return item def drawImage(self, image, x, y, anchor = CENTER): “””Draws the given image (a PhotoImage) at the given coordinates. The image is centered at the given coordinates by default.””” item = self.create_image(x, y, image = image, anchor = anchor) self.itemconfig(item, image = image, anchor = anchor) return item def deleteItem(self, item): “””Removes and erases the shape with the given item number from the canvas.””” self.delete(item) # Support classes for dialogs. class MessageBox(tkSimpleDialog.Dialog): “””Represents a message dialog with a scrollable text area.””” @classmethod def message(cls, title = “”, message = “”, width = 25, height = 5): MessageBox(Tkinter.Frame(), title, message, width, height) def __init__(self, parent, title, message, width, height): “””Set up the window and widgets.””” self._message = message self._width = width self._height = height self._modified = False tkSimpleDialog.Dialog.__init__(self, parent, title) def body(self, master): self.resizable(0, 0) yScroll = Tkinter.Scrollbar(master, orient = VERTICAL) yScroll.grid(row = 0, column = 1, sticky = N+S) output = Tkinter.Text(master, width = self._width, height = self._height, padx = 5, pady = 5, wrap = WORD, yscrollcommand = yScroll.set) output.grid(row = 0, column = 0, sticky = N+W+S+E) output.insert(“1.0”, self._message) output[“state”] = DISABLED yScroll[“command”] = output.yview return output def buttonbox(self): ”’add standard button box. override if you do not want the standard buttons”’ box = Tkinter.Frame(self) w = Tkinter.Button(box, text=”OK”, width = 10, command = self.ok, default = ACTIVE) w.pack() self.bind(“<Return>”, self.ok) box.pack() def apply(self): “””Quits the dialog.””” self._modified = True def modified(self): return self._modified class PrompterBox(tkSimpleDialog.Dialog): “””Represents an input dialog with a text field.””” @classmethod def prompt(cls, title = “”, promptString = “”, inputText = “”, fieldWidth = 20): “””Creates and pops up an input dialog.””” dlg = PrompterBox(Tkinter.Frame(), title, promptString, inputText, fieldWidth) return dlg.getText() def __init__(self, parent, title, promptString, inputText, fieldWidth): “””Set up the window and widgets.””” self._prompt = promptString self._text = inputText self._width = fieldWidth self._modified = False tkSimpleDialog.Dialog.__init__(self, parent, title) def body(self, master): self.resizable(0, 0) label = Tkinter.Label(master, text = self._prompt) label.grid(row = 0, column = 0, padx = 5, sticky = N+W+S+E) self._field = TextField(master, self._text, self._width, NORMAL) self._field.grid(row = 1, column = 0, padx = 5, sticky = N+W+S+E) return self._field def buttonbox(self): ”’add standard button box. override if you do not want the standard buttons”’ box = Tkinter.Frame(self) w = Tkinter.Button(box, text=”OK”, width = 10, command = self.ok, default = ACTIVE) w.pack() self.bind(“<Return>”, self.ok) box.pack() def apply(self): “””Quits the dialog.””” self._modified = True def modified(self): return self._modified def getText(self): “””Returns the text currently in the text field.””” return self._field.getText() class EasyDialog(tkSimpleDialog.Dialog): “””Represents a general-purpose dialog. Subclasses should include body and apply methods.””” def __init__(self, parent, title = “”): “””Set up the window and widgets.””” self._modified = False tkSimpleDialog.Dialog.__init__(self, parent, title) def modified(self): “””Returns the modified status of the dialog.””” return self._modified def setModified(self): self._modified = True def addLabel(self, master, text, row, column, columnspan = 1, rowspan = 1, sticky = N+W, font = None): “””Creates and inserts a label at the row and column, and returns the label.””” label = Tkinter.Label(master, text = text, font = font) master.rowconfigure(row, weight = 1) master.columnconfigure(column, weight = 1) label.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return label def addButton(self, master, text, row, column, columnspan = 1, rowspan = 1, command = lambda: None, state = NORMAL): “””Creates and inserts a button at the row and column, and returns the button.””” button = Tkinter.Button(master, text = text, command = command, state = state) master.rowconfigure(row, weight = 1) master.columnconfigure(column, weight = 1) button.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5) return button def addFloatField(self, master, value, row, column, columnspan = 1, rowspan = 1, width = 20, precision = None, sticky = N+E, state = NORMAL): “””Creates and inserts a float field at the row and column, and returns the float field.””” field = FloatField(master, value, width, precision, state) master.rowconfigure(row, weight = 1) master.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addIntegerField(self, master, value, row, column, columnspan = 1, rowspan = 1, width = 10, sticky = N+E, state = NORMAL): “””Creates and inserts an integer field at the row and column, and returns the integer field.””” field = IntegerField(master, value, width, state) master.rowconfigure(row, weight = 1) master.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addTextField(self, master, text, row, column, columnspan = 1, rowspan = 1, width = 20, sticky = N+E, state = NORMAL): “””Creates and inserts a text field at the row and column, and returns the text field.””” field = TextField(master, text, width, state) master.rowconfigure(row, weight = 1) master.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addCheckbutton(self, master, text, row, column, rowspan = 1, columnspan = 1, sticky = N+S+E+W, command = lambda : 0): “””Creates and inserts check button at the row and column, and returns the check button.””” cb = EasyCheckbutton(master, text, command) master.rowconfigure(row, weight = 1) master.columnconfigure(column, weight = 1) cb.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return cb def addRadiobuttonGroup(self, master, row, column, rowspan = 1, columnspan = 1, orient = VERTICAL): “””Creates and returns a radio button group.””” return EasyRadiobuttonGroup(master, row, column, rowspan, columnspan, orient) def addScale(self, master, row, column, rowspan = 1, columnspan = 1, command = lambda value: value, from_ = 0, to = 0, label = “”, length = 100, orient = HORIZONTAL, resolution = 1, tickinterval = 0): “””Creates and inserts a scale at the row and column, and returns the scale.””” scale = Tkinter.Scale(master, command = command, from_ = from_, to = to, label = label, length = length, orient = orient, resolution = resolution, tickinterval = tickinterval, relief = “sunken”, borderwidth = 4) master.rowconfigure(row, weight = 1) master.columnconfigure(column, weight = 1) scale.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) return scale def addTextArea(self, master, text, row, column, rowspan = 1, columnspan = 1, width = 80, height = 5, wrap = NONE): “””Creates and inserts a multiline text area at the row and column, and returns the text area. Vertical and horizontal scrollbars are provided.””” frame = Tkinter.Frame(master) frame.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) master.columnconfigure(column, weight = 1) master.rowconfigure(row, weight = 1) xScroll = Tkinter.Scrollbar(frame, orient = HORIZONTAL) xScroll.grid(row = 1, column = 0, sticky = E+W) yScroll = Tkinter.Scrollbar(frame, orient = VERTICAL) yScroll.grid(row = 0, column = 1, sticky = N+S) area = TextArea(frame, text, width, height, xScroll.set, yScroll.set, wrap) area.grid(row = 0, column = 0, padx = 5, pady = 5, sticky = N+S+E+W) frame.columnconfigure(0, weight = 1) frame.rowconfigure(0, weight = 1) xScroll[“command”] = area.xview yScroll[“command”] = area.yview return area def addListbox(self, master, row, column, rowspan = 1, columnspan = 1, width = 10, height = 5, listItemSelected = lambda index: index): “””Creates and inserts a scrolling list box at the row and column, with a width and height in lines and columns of text, and a default item selection method, and returns the list box.””” frame = Tkinter.Frame(master) frame.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) master.columnconfigure(column, weight = 1) master.rowconfigure(row, weight = 1) yScroll = Tkinter.Scrollbar(frame, orient = VERTICAL) yScroll.grid(row = 0, column = 1, sticky = N+S) listBox = EasyListbox(frame, width, height, yScroll.set, listItemSelected) listBox.grid(row = 0, column = 0, sticky = N+S+E+W) frame.columnconfigure(0, weight = 1) frame.rowconfigure(0, weight = 1) yScroll[“command”] = listBox.yview return listBox def addCanvas(self, master, canvas = None, row = 0, column = 0, rowspan = 1, columnspan = 1, width = 200, height = 100, background = “white”): “””Creates and inserts a canvas at the row and column, and returns the canvas.””” if not canvas: canvas = EasyCanvas(master, width = width, height = height, background = background) canvas.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = W+E+N+S) master.columnconfigure(column, weight = 10) master.rowconfigure(row, weight = 10) return canvas def addMenuBar(self, master, row, column, rowspan = 1, columnspan = 1, orient = “horizontal”): “””Creates and inserts a menu bar at the row and column, and returns the menu bar.””” if not orient in (“horizontal”, “vertical”): raise ValueError(“orient must be horizontal or vertical”) menuBar = EasyMenuBar(master, orient) menuBar.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = N+W) return menuBar def messageBox(self, title = “”, message = “”, width = 25, height = 5): “””Creates and pops up a message box, with the given title, message, and width and height in rows and columns of text.””” dlg = MessageBox(self, title, message, width, height) return dlg.modified() # Added 12-18-2012 def addPanel(self, master, row, column, rowspan = 1, columnspan = 1, background = “white”): “””Creates and returns a panel.””” return EasyPanel(master, row, column, rowspan, columnspan, background) # Added 12-18-2012 class EasyPanel(Tkinter.Frame): “””Organizes a group of widgets in a panel (nested frame).””” def __init__(self, parent, row, column, rowspan, columnspan, background): Tkinter.Frame.__init__(self, parent) parent.rowconfigure(row, weight = 1) parent.columnconfigure(column, weight = 1) self.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = N+S+E+W) self.setBackground(background) def setBackground(self, color): “””Resets the panel’s background color to color.””” self[“background”] = color def addButton(self, text, row, column, columnspan = 1, rowspan = 1, command = lambda: None, state = NORMAL): “””Creates and inserts a button at the row and column, and returns the button.””” button = Tkinter.Button(self, text = text, command = command, state = state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) button.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5) return button def addLabel(self, text, row, column, columnspan = 1, rowspan = 1, sticky = N+W, font = None, background = “white”, foreground = “black”): “””Creates and inserts a label at the row and column, and returns the label.””” label = Tkinter.Label(self, text = text, font = font, background = background, foreground = foreground) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) label.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return label def addFloatField(self, value, row, column, columnspan = 1, rowspan = 1, width = 20, precision = None, sticky = N+E, state = NORMAL): “””Creates and inserts a float field at the row and column, and returns the float field.””” field = FloatField(self, value, width, precision, state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addIntegerField(self, value, row, column, columnspan = 1, rowspan = 1, width = 10, sticky = N+E, state = NORMAL): “””Creates and inserts an integer field at the row and column, and returns the integer field.””” field = IntegerField(self, value, width, state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addTextField(self, text, row, column, columnspan = 1, rowspan = 1, width = 20, sticky = N+E, state = NORMAL): “””Creates and inserts a text field at the row and column, and returns the text field.””” field = TextField(self, text, width, state) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) field.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return field def addTextArea(self, text, row, column, rowspan = 1, columnspan = 1, width = 80, height = 5, wrap = NONE): “””Creates and inserts a multiline text area at the row and column, and returns the text area. Vertical and horizontal scrollbars are provided.””” frame = Tkinter.Frame(self) frame.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) self.columnconfigure(column, weight = 1) self.rowconfigure(row, weight = 1) xScroll = Tkinter.Scrollbar(frame, orient = HORIZONTAL) xScroll.grid(row = 1, column = 0, sticky = E+W) yScroll = Tkinter.Scrollbar(frame, orient = VERTICAL) yScroll.grid(row = 0, column = 1, sticky = N+S) area = TextArea(frame, text, width, height, xScroll.set, yScroll.set, wrap) area.grid(row = 0, column = 0, padx = 5, pady = 5, sticky = N+S+E+W) frame.columnconfigure(0, weight = 1) frame.rowconfigure(0, weight = 1) xScroll[“command”] = area.xview yScroll[“command”] = area.yview return area def addListbox(self, row, column, rowspan = 1, columnspan = 1, width = 10, height = 5, listItemSelected = lambda index: index): “””Creates and inserts a scrolling list box at the row and column, with a width and height in lines and columns of text, and a default item selection method, and returns the list box.””” frame = Tkinter.Frame(self) frame.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) self.columnconfigure(column, weight = 1) self.rowconfigure(row, weight = 1) yScroll = Tkinter.Scrollbar(frame, orient = VERTICAL) yScroll.grid(row = 0, column = 1, sticky = N+S) listBox = EasyListbox(frame, width, height, yScroll.set, listItemSelected) listBox.grid(row = 0, column = 0, sticky = N+S+E+W) frame.columnconfigure(0, weight = 1) frame.rowconfigure(0, weight = 1) yScroll[“command”] = listBox.yview return listBox def addCanvas(self, canvas = None, row = 0, column = 0, rowspan = 1, columnspan = 1, width = 200, height = 100, background = “white”): “””Creates and inserts a canvas at the row and column, and returns the canvas.””” if not canvas: canvas = EasyCanvas(self, width = width, height = height, background = background) canvas.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = W+E+N+S) self.columnconfigure(column, weight = 10) self.rowconfigure(row, weight = 10) return canvas def addScale(self, row, column, rowspan = 1, columnspan = 1, command = lambda value: value, from_ = 0, to = 0, label = “”, length = 100, orient = HORIZONTAL, resolution = 1, tickinterval = 0): “””Creates and inserts a scale at the row and column, and returns the scale.””” scale = Tkinter.Scale(self, command = command, from_ = from_, to = to, label = label, length = length, orient = orient, resolution = resolution, tickinterval = tickinterval, relief = “sunken”, borderwidth = 4) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) scale.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, sticky = N+S+E+W) return scale def addMenuBar(self, row, column, rowspan = 1, columnspan = 1, orient = “horizontal”): “””Creates and inserts a menu bar at the row and column, and returns the menu bar.””” if not orient in (“horizontal”, “vertical”): raise ValueError(“orient must be horizontal or vertical”) menuBar = EasyMenuBar(self, orient) menuBar.grid(row = row, column = column, rowspan = rowspan, columnspan = columnspan, sticky = N+W) return menuBar def addCheckbutton(self, text, row, column, rowspan = 1, columnspan = 1, sticky = N+S+E+W, command = lambda : 0): “””Creates and inserts check button at the row and column, and returns the check button.””” cb = EasyCheckbutton(self, text, command) self.rowconfigure(row, weight = 1) self.columnconfigure(column, weight = 1) cb.grid(row = row, column = column, columnspan = columnspan, rowspan = rowspan, padx = 5, pady = 5, sticky = sticky) return cb def addRadiobuttonGroup(self, row, column, rowspan = 1, columnspan = 1, orient = VERTICAL): “””Creates and returns a radio button group.””” return EasyRadiobuttonGroup(self, row, column, rowspan, columnspan, orient) def addPanel(self, row, column, rowspan = 1, columnspan = 1, background = “white”): “””Creates and returns a panel.””” return EasyPanel(self, row, column, rowspan, columnspan, background)

Case Study/doctor.py

import random class Doctor(): QUALIFIERS = [‘Why do you say that ‘, ‘You seem to think that ‘, ‘Did I just hear you say that ‘, ‘Why do you believe that ‘ ] REPLACEMENTS = {‘I’: ‘you’, ‘me’: ‘you’, ‘my’: ‘your’, ‘we’: ‘you’, ‘us’: ‘you’, ‘am’: ‘are’, ‘you’: ‘I’, ‘You’: ‘I’} HEDGES = [‘Go on.’, ‘I would like to hear more about that.’, ‘And what do you think about this?’, ‘Please continue.’] def __init__(self): self.history = [] def greeting(self): return ‘Good morning, how can I help you today?’ def farewell(self): return ‘Have a nice day!’ def reply(self, sentence): choice = random.randint (1, 10) if choice == 1: if len(self.history) > 3: answer = ‘Earlier you said that ‘ + \ self.change_person(random.choice(self.history)) else: answer = random.choice(Doctor.HEDGES) elif choice in (2,3,4,5): answer = random.choice(Doctor.QUALIFIERS) + \ self.change_person(sentence) else: answer = random.choice(Doctor.HEDGES) self.history.append(sentence) return answer def change_person(self, sentence): oldlist = sentence.split() newlist = [] for word in oldlist: if word in Doctor.REPLACEMENTS: newlist.append(Doctor.REPLACEMENTS[word]) else: newlist.append(word) return ” “.join(newlist)

Case Study/doctorclient.py

“”” File: doctorclient.py GUI-based view for client for non-directive psychotherapy. “”” from socket import * from codecs import decode from breezypythongui import EasyFrame HOST = “localhost” PORT = 5000 BUFSIZE = 1024 ADDRESS = (HOST, PORT) CODE = “ascii” class DoctorClient(EasyFrame): “””Represents the client’s window.””” COLOR = “#CCEEFF” # Light blue def __init__(self): “””Initialize the window and widgets.””” EasyFrame.__init__(self, title = “Doctor”, background = DoctorClient.COLOR) # Add the labels, fields, and button self.drLabel = self.addLabel(text = “Want to connect?”, row = 0, column = 0, columnspan = 2, background = DoctorClient.COLOR) self.ptField = self.addTextField(text = “”, row = 1, column = 0, columnspan = 2, width = 50) self.sendBtn = self.addButton(row = 2, column = 0, text = “Send reply”, command = self.sendReply, state = “disabled”) self.connectBtn = self.addButton(row = 2, column = 1, text = “Connect”, command = self.connect) # Support the return key in the input field self.ptField.bind(“<Return>”, lambda event: self.sendReply()) def sendReply(self): “””Sends patient input to doctor, and receives and outputs doctor’s reply.””” ptInput = self.ptField.getText() if ptInput != “”: self.server.send(bytes(ptInput, CODE)) drReply = decode(self.server.recv(BUFSIZE), CODE) if not drReply: self.messageBox(message = “Doctor diconnected”) self.disconnect() else: self.drLabel[“text”] = drReply self.ptField.setText(“”) def connect(self): “””Starts a new session with the doctor.””” self.server = socket(AF_INET, SOCK_STREAM) self.server.connect(ADDRESS) self.drLabel[“text”] = decode(self.server.recv(BUFSIZE), CODE) self.connectBtn[“text”] = “Disconnect” self.connectBtn[“command”] = self.disconnect self.sendBtn[“state”] = “normal” def disconnect(self): “””Ends the session with the doctor.””” self.server.close() self.ptField.setText(“”) self.drLabel[“text”] = “Want to connect?” self.connectBtn[“text”] = “Connect” self.connectBtn[“command”] = self.connect self.sendBtn[“state”] = “disabled” def main(): “””Instantiate and pop up the window.””” DoctorClient().mainloop() if __name__ == “__main__”: main()

Case Study/doctorclienthandler.py

“”” File: doctorclienthandler.py Client handler for providing non-directive psychotherapy. “”” from codecs import decode from threading import Thread from doctor import Doctor BUFSIZE = 1024 CODE = “ascii” class DoctorClientHandler(Thread): “””Handles a session between a doctor and a patient.””” def __init__(self, client): Thread.__init__(self) self.client = client self.dr = Doctor() def run(self): self.client.send(bytes(self.dr.greeting(), CODE)) while True: message = decode(self.client.recv(BUFSIZE), CODE) if not message: print(“Client disconnected”) self.client.close() break else: self.client.send(bytes(self.dr.reply(message), CODE))

Case Study/doctorserver.py

“”” File: doctorserver.py Server for providing non-directive psychotherapy. Uses client handlers to handle clients’ requests. “”” from socket import * from doctorclienthandler import DoctorClientHandler HOST = “localhost” PORT = 5000 ADDRESS = (HOST, PORT) server = socket(AF_INET, SOCK_STREAM) server.bind(ADDRESS) server.listen(5) # The server now just waits for connections from clients # and hands sockets off to client handlers while True: print(“Waiting for connection . . .”) client, address = server.accept() print(“… connected from: “, address) handler = DoctorClientHandler(client) handler.start()

Case Study/doctorgui.py

“”” File: doctorservergui.py Project 5 GUI-based view for non-directive psychotherapy. “”” from doctor import Doctor from breezypythongui import EasyFrame class DoctorGUI(EasyFrame): “””Represents the app’s window.””” COLOR = “#CCEEFF” def __init__(self): “””Initialize the frame and widgets.””” EasyFrame.__init__(self, title = “Doctor”, background = DoctorGUI.COLOR) # Instantiate the model self.doctor = Doctor() # Add the labels, fields, and button self.addLabel(text = “Doctor”, row = 0, column = 0, background = DoctorGUI.COLOR) self.drField = self.addTextField(self.doctor.greeting(), row = 0, column = 1, width = 50, state = “readonly”) self.addLabel(text = “Patient”, row = 1, column = 0, background = DoctorGUI.COLOR) self.ptField = self.addTextField(text = “”, row = 1, column = 1, width = 50) self.button = self.addButton(row = 2, column = 0, columnspan = 2, text = “Send reply”, command = self.sendReply) # Support the return key in the input field self.ptField.bind(“<Return>”, lambda event: self.sendReply()) def sendReply(self): “””Sends patient input to doctor, receives and outputs reply.””” ptInput = self.ptField.getText() if ptInput.upper() == “QUIT”: self.drField.setText(self.doctor.farewell()) self.button[“command”] = self.newSession self.button[“text”] = “New session” else: drReply = self.doctor.reply(ptInput) self.drField.setText(drReply) def newSession(self): “””Starts a new session with the doctor.””” self.doctor = Doctor() self.ptField.setText(“”) self.drField.setText(self.doctor.greeting()) self.button[“command”] = self.sendReply self.button[“text”] = “Send reply” def main(): “””Instantiate and pop up the window.””” DoctorGUI().mainloop() if __name__ == “__main__”: main()

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Python

“”” Test script for module a1 When run as a script, this module invokes several procedures that test the various functions in the module a1. Author: Anqi Bai/Hongyi Lu NetId:ab2897/hl2374 Date: 9/22/2019 “”” import introcs import a1 #Testing function before_space and after_space def testA(): “”” Test Procedure for Part A Testing function before_space and after_space “”” print(‘Testing function before_space’) #testing strings with one space result = a1.before_space(‘2 Bitcon’) introcs.assert_equals(‘2’,result) #testing strings with only space result = a1.before_space(‘ ‘) introcs.assert_equals(”,result) #testing strings with more than one spaces result = a1.before_space(‘6 Japanese Yen’) introcs.assert_equals(‘6’,result) #testing strings with more than one consective spaces result = a1.before_space(‘6 CubanPeso’) introcs.assert_equals(‘6’,result) print(‘Testing function after_space’) #testing strings with one space result = a1.after_space(‘2 Bitcon’) introcs.assert_equals(‘Bitcon’,result) #testing strings with only space result = a1.after_space(‘ ‘) introcs.assert_equals(”,result) #testing strings with more than one spaces result = a1.after_space(‘6 Japanese Yen’) introcs.assert_equals(‘Japanese Yen’,result) #testing strings with more than one consective spaces result = a1.after_space(‘6 CubanPeso’) introcs.assert_equals(‘ CubanPeso’,result) #Testing function first_inside_quotes, get_lhs, get_rhs and has_error def testB(): “”” Test procedure for Part B Testing function first_inside_quotes, get_lhs, get_rhs and has_error “”” print(‘Testing function first_inside_quotes’) #test strings with two quotes result = a1.first_inside_quotes(‘A “B C” D’) introcs.assert_equals(‘B C’,result) #test strings with nothing in quotes result = a1.first_inside_quotes(‘””‘) introcs.assert_equals(”,result) #test strings with all strings in two quotes result = a1.first_inside_quotes(‘”A B C D E F”‘) introcs.assert_equals(‘A B C D E F’,result) #test strings with more than two quotes result = a1.first_inside_quotes(‘A “B C” “D” “E” F’) introcs.assert_equals(‘B C’,result) print(‘Testing function get_lhs’) #Testing json with valid currency and amount result = a1.get_lhs(‘{ “ok”:true, “lhs”:”1 Bitcoin’+ ‘”, “rhs”:”9916.0137939344 Euros”, “err”:”” }’) introcs.assert_equals(‘1 Bitcoin’,result) #Testing json with invalid currency and amount result = a1.get_lhs(‘{ “ok”:false, “lhs”:””, “rhs”:””,’+ ‘ “err”:”Source currency code is invalid.” }’) introcs.assert_equals(”,result) print(‘Testing function get_rhs’) #Testing json with valid currency and amount result = a1.get_rhs(‘{ “ok”:true, “lhs”:”1 Bitcion”, ‘+ ‘”rhs”:”9916.0137 Euros”, “err”:”” }’) introcs.assert_equals(‘9916.0137 Euros’,result) #Testing json with valid currency and amount result = a1.get_rhs(‘{ “ok”:true, “lhs”:”1 Bitcion”,’+ ‘ “rhs”:”233 AED”, “err”:”” }’) introcs.assert_equals(‘233 AED’,result) #Testing json with invalid currency and amount result = a1.get_rhs(‘{ “ok”:false, “lhs”:””, “rhs”:””,’+ ‘ “err”:”Source currency code is invalid.” }’) introcs.assert_equals(”,result) print(‘Testing function has_error’) #Testing Json that is a response for invalid currency result = a1.has_error(‘{ “ok”:True, “lhs”:”1 Bitcoin”, ‘+ ‘”rhs”:”9916.0137 Euros”, “err”:”” }’) introcs.assert_equals(False,result) #Testing Json that is a response for valid currency result = a1.has_error(‘{ “ok”:false, “lhs”:””, “rhs”:””, ‘+ ‘”err”:”Source currency code is invalid.” }’) introcs.assert_equals(True,result) #Testing function currency_response def testC(): “”” Test procedure for Part C Testing function currency_response “”” print(‘Testing function currency_response’) #Testing with proper currency code and amount (same currency) result = a1.currency_response(‘USD’,’USD’,1.0) introcs.assert_equals(‘{ “ok”:true, “lhs”:”1 United States ‘+ ‘Dollar”, “rhs”:”1 United States Dollar”, “err”:”” }’,result) #Testing with proper currency code and amount result = a1.currency_response(‘AUD’,’USD’,2.0) introcs.assert_equals(‘{ “ok”:true, “lhs”:”2 Australian Dollars”, ‘+ ‘”rhs”:”1.4041334881625 United States Dollars”, “err”:”” }’,result) #Testing with improper currency code and amount with one invalid currency result = a1.currency_response(‘USD’,’ABC’,3.0) introcs.assert_equals(‘{ “ok”:false, “lhs”:””, “rhs”:””‘+ ‘, “err”:”Exchange currency code is invalid.” }’,result) #Testing with improper currency code and amount with two invalid currencies result = a1.currency_response(‘TYU’,’ABC’,3.0) introcs.assert_equals(‘{ “ok”:false, “lhs”:””, “rhs”:””, ‘+ ‘”err”:”Source currency code is invalid.” }’,result) #Testing function is_currency and exchange def testD(): “”” Test Procedure for Part D Testing function is_currency and exchange “”” print(‘Testing function is_currency’) #Testing with valid currency code result = a1.is_currency(‘USD’) introcs.assert_equals(True,result) #Testing with valid currency code result = a1.is_currency(‘CNY’) introcs.assert_equals(True,result) #Testing with invalid currency code result = a1.is_currency(‘ZZZ’) introcs.assert_equals(False,result) print(‘Testing function exchange’) #Testing with valid same currency and amount result = a1.exchange(‘USD’,’USD’,666.0) introcs.assert_floats_equal(666.0,result) #Testing with valid currency and amount with multiple decimals result = a1.exchange(‘USD’,’JPY’,666.0) introcs.assert_floats_equal(71871.39,result) testA() testB() testC() testD() print(‘Module a1 passed all tests.’)

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Help With Microsoft Excel 2013 Assignment!!!

Advertising Order Form

Jesse Jewelers
Advertising Order Form
Name A-1 Services
Number RS-1988
Order Date 16-Mar
Item Description Quantity Type Unit Price Order Amount
$ –
Total:

Advertising Rate Information

Jesse Jewelers
Advertising Rate List
Code Description Unit Price
D-TV Global News Newspaper, Travel Section $ 5,352
A-NW New York Travel Magazine, two-page ad $ 2,746
B-BB Houston Billboard $ 1,450
D-IN AvantClothes.com $ 1,713
A-MG New York Travel Magazine, one-page ad $ 1,528
D-R Travel Tours Magazine $ 2,751
D-PH Southwest Tourist Magazine $ 2,889
 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Implementing Access Controls With Windows Active Directory

1. Relate how Windows Server 2012 Active Directory and the configuration of

access controls achieve CIA for departmental LANs, departmental folders, and

data.

2. Is it a good practice to include the account or user name in the password? Why

or why not?

3. To enhance the strength of user passwords, what are some of the best

practices to implement for user password definitions to maximize

confidentiality?

4. Can a user who is defined in Active Directory access a shared drive on a

computer if the server with the shared drive is not part of the domain?

5. When granting access to network systems for guests (i.e., auditors,

consultants, third-party individuals, etc.), what security controls do you

recommend implementing to maximize CIA of production systems and data?

6. In the Access Controls Criteria table, what sharing changes were made to the

MGRfiles folder on the TargetWindows01 server?

7. In the Access Controls Criteria table, what sharing changes were made on the

TargetWindows01 server to allow ShopFloor users to read/write files in the

C:\LabDocuments\SFfiles folder?

8. In the Access Controls Criteria table, what sharing changes were made on the

TargetWindows01 server to allow HumanResources users to access files in

the C:\LabDocuments\HRfiles folder?

9. Explain how CIA can be achieved down to the folder and data file access level

for departments and users using Active Directory and Windows Server 2012

R2 access control configurations. Configuring unique access controls for

different user types is an example of which kind of access controls

complete all the 9questions in the pdf provided

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Artificial Intelligence Midterm Exam

Artificial Intelligence A Modern Approach

Third Edition

 

 

PRENTICE HALL SERIES IN ARTIFICIAL INTELLIGENCE Stuart Russell and Peter Norvig, Editors

FORSYTH & PONCE Computer Vision: A Modern Approach GRAHAM ANSI Common Lisp JURAFSKY & MARTIN Speech and Language Processing, 2nd ed. NEAPOLITAN Learning Bayesian Networks RUSSELL & NORVIG Artificial Intelligence: A Modern Approach, 3rd ed.

 

 

Artificial Intelligence A Modern Approach

Third Edition

Stuart J. Russell and Peter Norvig

Contributing writers: Ernest Davis

Douglas D. Edwards David Forsyth

Nicholas J. Hay Jitendra M. Malik

Vibhu Mittal Mehran Sahami Sebastian Thrun

Upper Saddle River Boston Columbus San Francisco New York Indianapolis London Toronto Sydney Singapore Tokyo Montreal

Dubai Madrid Hong Kong Mexico City Munich Paris Amsterdam Cape Town

 

 

Vice President and Editorial Director, ECS: Marcia J. Horton Editor-in-Chief: Michael Hirsch Executive Editor: Tracy Dunkelberger Assistant Editor: Melinda Haggerty Editorial Assistant: Allison Michael Vice President, Production: Vince O’Brien Senior Managing Editor: Scott Disanno Production Editor: Jane Bonnell Senior Operations Supervisor: Alan Fischer Operations Specialist: Lisa McDowell Marketing Manager: Erin Davis Marketing Assistant: Mack Patterson Cover Designers: Kirsten Sims and Geoffrey Cassar Cover Images: Stan Honda/Getty, Library of Congress, NASA, National Museum of Rome,

Peter Norvig, Ian Parker, Shutterstock, Time Life/Getty Interior Designers: Stuart Russell and Peter Norvig Copy Editor: Mary Lou Nohr Art Editor: Greg Dulles Media Editor: Daniel Sandin Media Project Manager: Danielle Leone

Copyright c© 2010, 2003, 1995 by Pearson Education, Inc., Upper Saddle River, New Jersey 07458. All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright and permissions should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use materials from this work, please submit a written request to Pearson Higher Education, Permissions Department, 1 Lake Street, Upper Saddle River, NJ 07458.

The author and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The author and publisher make no warranty of any kind, expressed or implied, with regard to these programs or the documentation contained in this book. The author and publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs.

Library of Congress Cataloging-in-Publication Data on File

10 9 8 7 6 5 4 3 2 1 ISBN-13: 978-0-13-604259-4 ISBN-10: 0-13-604259-7

 

 

For Loy, Gordon, Lucy, George, and Isaac — S.J.R.

For Kris, Isabella, and Juliet — P.N.

 

 

This page intentionally left blank

 

 

Preface Artificial Intelligence (AI) is a big field, and this is a big book. We have tried to explore the full breadth of the field, which encompasses logic, probability, and continuous mathematics; perception, reasoning, learning, and action; and everything from microelectronic devices to robotic planetary explorers. The book is also big because we go into some depth.

The subtitle of this book is “A Modern Approach.” The intended meaning of this rather empty phrase is that we have tried to synthesize what is now known into a common frame- work, rather than trying to explain each subfield of AI in its own historical context. We apologize to those whose subfields are, as a result, less recognizable.

New to this edition This edition captures the changes in AI that have taken place since the last edition in 2003. There have been important applications of AI technology, such as the widespread deploy- ment of practical speech recognition, machine translation, autonomous vehicles, and house- hold robotics. There have been algorithmic landmarks, such as the solution of the game of checkers. And there has been a great deal of theoretical progress, particularly in areas such as probabilistic reasoning, machine learning, and computer vision. Most important from our point of view is the continued evolution in how we think about the field, and thus how we organize the book. The major changes are as follows:

• We place more emphasis on partially observable and nondeterministic environments, especially in the nonprobabilistic settings of search and planning. The concepts of belief state (a set of possible worlds) and state estimation (maintaining the belief state) are introduced in these settings; later in the book, we add probabilities.

• In addition to discussing the types of environments and types of agents, we now cover in more depth the types of representations that an agent can use. We distinguish among atomic representations (in which each state of the world is treated as a black box), factored representations (in which a state is a set of attribute/value pairs), and structured representations (in which the world consists of objects and relations between them).

• Our coverage of planning goes into more depth on contingent planning in partially observable environments and includes a new approach to hierarchical planning.

• We have added new material on first-order probabilistic models, including open-universe models for cases where there is uncertainty as to what objects exist.

• We have completely rewritten the introductory machine-learning chapter, stressing a wider variety of more modern learning algorithms and placing them on a firmer theo- retical footing.

• We have expanded coverage of Web search and information extraction, and of tech- niques for learning from very large data sets.

• 20% of the citations in this edition are to works published after 2003.

• We estimate that about 20% of the material is brand new. The remaining 80% reflects older work but has been largely rewritten to present a more unified picture of the field.

vii

 

 

viii Preface

Overview of the book The main unifying theme is the idea of an intelligent agent. We define AI as the study of agents that receive percepts from the environment and perform actions. Each such agent im- plements a function that maps percept sequences to actions, and we cover different ways to represent these functions, such as reactive agents, real-time planners, and decision-theoretic systems. We explain the role of learning as extending the reach of the designer into unknown environments, and we show how that role constrains agent design, favoring explicit knowl- edge representation and reasoning. We treat robotics and vision not as independently defined problems, but as occurring in the service of achieving goals. We stress the importance of the task environment in determining the appropriate agent design.

Our primary aim is to convey the ideas that have emerged over the past fifty years of AI research and the past two millennia of related work. We have tried to avoid excessive formal- ity in the presentation of these ideas while retaining precision. We have included pseudocode algorithms to make the key ideas concrete; our pseudocode is described in Appendix B.

This book is primarily intended for use in an undergraduate course or course sequence. The book has 27 chapters, each requiring about a week’s worth of lectures, so working through the whole book requires a two-semester sequence. A one-semester course can use selected chapters to suit the interests of the instructor and students. The book can also be used in a graduate-level course (perhaps with the addition of some of the primary sources suggested in the bibliographical notes). Sample syllabi are available at the book’s Web site, aima.cs.berkeley.edu. The only prerequisite is familiarity with basic concepts of computer science (algorithms, data structures, complexity) at a sophomore level. Freshman calculus and linear algebra are useful for some of the topics; the required mathematical back- ground is supplied in Appendix A.

Exercises are given at the end of each chapter. Exercises requiring significant pro- gramming are marked with a keyboard icon. These exercises can best be solved by taking advantage of the code repository at aima.cs.berkeley.edu. Some of them are large enough to be considered term projects. A number of exercises require some investigation of the literature; these are marked with a book icon.

Throughout the book, important points are marked with a pointing icon. We have in- cluded an extensive index of around 6,000 items to make it easy to find things in the book. Wherever a new term is first defined, it is also marked in the margin.NEW TERM

About the Web site aima.cs.berkeley.edu, the Web site for the book, contains

• implementations of the algorithms in the book in several programming languages, • a list of over 1000 schools that have used the book, many with links to online course

materials and syllabi, • an annotated list of over 800 links to sites around the Web with useful AI content, • a chapter-by-chapter list of supplementary material and links, • instructions on how to join a discussion group for the book,

 

 

Preface ix

• instructions on how to contact the authors with questions or comments,

• instructions on how to report errors in the book, in the likely event that some exist, and

• slides and other materials for instructors.

About the cover The cover depicts the final position from the decisive game 6 of the 1997 match between chess champion Garry Kasparov and program DEEP BLUE. Kasparov, playing Black, was forced to resign, making this the first time a computer had beaten a world champion in a chess match. Kasparov is shown at the top. To his left is the Asimo humanoid robot and to his right is Thomas Bayes (1702–1761), whose ideas about probability as a measure of belief underlie much of modern AI technology. Below that we see a Mars Exploration Rover, a robot that landed on Mars in 2004 and has been exploring the planet ever since. To the right is Alan Turing (1912–1954), whose fundamental work defined the fields of computer science in general and artificial intelligence in particular. At the bottom is Shakey (1966– 1972), the first robot to combine perception, world-modeling, planning, and learning. With Shakey is project leader Charles Rosen (1917–2002). At the bottom right is Aristotle (384 B.C.–322 B.C.), who pioneered the study of logic; his work was state of the art until the 19th century (copy of a bust by Lysippos). At the bottom left, lightly screened behind the authors’ names, is a planning algorithm by Aristotle from De Motu Animalium in the original Greek. Behind the title is a portion of the CPSC Bayesian network for medical diagnosis (Pradhan et al., 1994). Behind the chess board is part of a Bayesian logic model for detecting nuclear explosions from seismic signals.

Credits: Stan Honda/Getty (Kasparaov), Library of Congress (Bayes), NASA (Mars rover), National Museum of Rome (Aristotle), Peter Norvig (book), Ian Parker (Berkeley skyline), Shutterstock (Asimo, Chess pieces), Time Life/Getty (Shakey, Turing).

Acknowledgments This book would not have been possible without the many contributors whose names did not make it to the cover. Jitendra Malik and David Forsyth wrote Chapter 24 (computer vision) and Sebastian Thrun wrote Chapter 25 (robotics). Vibhu Mittal wrote part of Chapter 22 (natural language). Nick Hay, Mehran Sahami, and Ernest Davis wrote some of the exercises. Zoran Duric (George Mason), Thomas C. Henderson (Utah), Leon Reznik (RIT), Michael Gourley (Central Oklahoma) and Ernest Davis (NYU) reviewed the manuscript and made helpful suggestions. We thank Ernie Davis in particular for his tireless ability to read multiple drafts and help improve the book. Nick Hay whipped the bibliography into shape and on deadline stayed up to 5:30 AM writing code to make the book better. Jon Barron formatted and improved the diagrams in this edition, while Tim Huang, Mark Paskin, and Cynthia Bruyns helped with diagrams and algorithms in previous editions. Ravi Mohan and Ciaran O’Reilly wrote and maintain the Java code examples on the Web site. John Canny wrote the robotics chapter for the first edition and Douglas Edwards researched the historical notes. Tracy Dunkelberger, Allison Michael, Scott Disanno, and Jane Bonnell at Pearson tried their best to keep us on schedule and made many helpful suggestions. Most helpful of all has

 

 

x Preface

been Julie Sussman, P.P.A., who read every chapter and provided extensive improvements. In previous editions we had proofreaders who would tell us when we left out a comma and said which when we meant that; Julie told us when we left out a minus sign and said xi when we meant xj . For every typo or confusing explanation that remains in the book, rest assured that Julie has fixed at least five. She persevered even when a power failure forced her to work by lantern light rather than LCD glow.

Stuart would like to thank his parents for their support and encouragement and his wife, Loy Sheflott, for her endless patience and boundless wisdom. He hopes that Gordon, Lucy, George, and Isaac will soon be reading this book after they have forgiven him for working so long on it. RUGS (Russell’s Unusual Group of Students) have been unusually helpful, as always.

Peter would like to thank his parents (Torsten and Gerda) for getting him started, and his wife (Kris), children (Bella and Juliet), colleagues, and friends for encouraging and tolerating him through the long hours of writing and longer hours of rewriting.

We both thank the librarians at Berkeley, Stanford, and NASA and the developers of CiteSeer, Wikipedia, and Google, who have revolutionized the way we do research. We can’t acknowledge all the people who have used the book and made suggestions, but we would like to note the especially helpful comments of Gagan Aggarwal, Eyal Amir, Ion Androutsopou- los, Krzysztof Apt, Warren Haley Armstrong, Ellery Aziel, Jeff Van Baalen, Darius Bacon, Brian Baker, Shumeet Baluja, Don Barker, Tony Barrett, James Newton Bass, Don Beal, Howard Beck, Wolfgang Bibel, John Binder, Larry Bookman, David R. Boxall, Ronen Braf- man, John Bresina, Gerhard Brewka, Selmer Bringsjord, Carla Brodley, Chris Brown, Emma Brunskill, Wilhelm Burger, Lauren Burka, Carlos Bustamante, Joao Cachopo, Murray Camp- bell, Norman Carver, Emmanuel Castro, Anil Chakravarthy, Dan Chisarick, Berthe Choueiry, Roberto Cipolla, David Cohen, James Coleman, Julie Ann Comparini, Corinna Cortes, Gary Cottrell, Ernest Davis, Tom Dean, Rina Dechter, Tom Dietterich, Peter Drake, Chuck Dyer, Doug Edwards, Robert Egginton, Asma’a El-Budrawy, Barbara Engelhardt, Kutluhan Erol, Oren Etzioni, Hana Filip, Douglas Fisher, Jeffrey Forbes, Ken Ford, Eric Fosler-Lussier, John Fosler, Jeremy Frank, Alex Franz, Bob Futrelle, Marek Galecki, Stefan Gerberding, Stuart Gill, Sabine Glesner, Seth Golub, Gosta Grahne, Russ Greiner, Eric Grimson, Bar- bara Grosz, Larry Hall, Steve Hanks, Othar Hansson, Ernst Heinz, Jim Hendler, Christoph Herrmann, Paul Hilfinger, Robert Holte, Vasant Honavar, Tim Huang, Seth Hutchinson, Joost Jacob, Mark Jelasity, Magnus Johansson, Istvan Jonyer, Dan Jurafsky, Leslie Kaelbling, Keiji Kanazawa, Surekha Kasibhatla, Simon Kasif, Henry Kautz, Gernot Kerschbaumer, Max Khesin, Richard Kirby, Dan Klein, Kevin Knight, Roland Koenig, Sven Koenig, Daphne Koller, Rich Korf, Benjamin Kuipers, James Kurien, John Lafferty, John Laird, Gus Lars- son, John Lazzaro, Jon LeBlanc, Jason Leatherman, Frank Lee, Jon Lehto, Edward Lim, Phil Long, Pierre Louveaux, Don Loveland, Sridhar Mahadevan, Tony Mancill, Jim Martin, Andy Mayer, John McCarthy, David McGrane, Jay Mendelsohn, Risto Miikkulanien, Brian Milch, Steve Minton, Vibhu Mittal, Mehryar Mohri, Leora Morgenstern, Stephen Muggleton, Kevin Murphy, Ron Musick, Sung Myaeng, Eric Nadeau, Lee Naish, Pandu Nayak, Bernhard Nebel, Stuart Nelson, XuanLong Nguyen, Nils Nilsson, Illah Nourbakhsh, Ali Nouri, Arthur Nunes-Harwitt, Steve Omohundro, David Page, David Palmer, David Parkes, Ron Parr, Mark

 

 

Preface xi

Paskin, Tony Passera, Amit Patel, Michael Pazzani, Fernando Pereira, Joseph Perla, Wim Pi- jls, Ira Pohl, Martha Pollack, David Poole, Bruce Porter, Malcolm Pradhan, Bill Pringle, Lor- raine Prior, Greg Provan, William Rapaport, Deepak Ravichandran, Ioannis Refanidis, Philip Resnik, Francesca Rossi, Sam Roweis, Richard Russell, Jonathan Schaeffer, Richard Scherl, Hinrich Schuetze, Lars Schuster, Bart Selman, Soheil Shams, Stuart Shapiro, Jude Shav- lik, Yoram Singer, Satinder Singh, Daniel Sleator, David Smith, Bryan So, Robert Sproull, Lynn Stein, Larry Stephens, Andreas Stolcke, Paul Stradling, Devika Subramanian, Marek Suchenek, Rich Sutton, Jonathan Tash, Austin Tate, Bas Terwijn, Olivier Teytaud, Michael Thielscher, William Thompson, Sebastian Thrun, Eric Tiedemann, Mark Torrance, Randall Upham, Paul Utgoff, Peter van Beek, Hal Varian, Paulina Varshavskaya, Sunil Vemuri, Vandi Verma, Ubbo Visser, Jim Waldo, Toby Walsh, Bonnie Webber, Dan Weld, Michael Wellman, Kamin Whitehouse, Michael Dean White, Brian Williams, David Wolfe, Jason Wolfe, Bill Woods, Alden Wright, Jay Yagnik, Mark Yasuda, Richard Yen, Eliezer Yudkowsky, Weixiong Zhang, Ming Zhao, Shlomo Zilberstein, and our esteemed colleague Anonymous Reviewer.

 

 

About the Authors Stuart Russell was born in 1962 in Portsmouth, England. He received his B.A. with first- class honours in physics from Oxford University in 1982, and his Ph.D. in computer science from Stanford in 1986. He then joined the faculty of the University of California at Berkeley, where he is a professor of computer science, director of the Center for Intelligent Systems, and holder of the Smith–Zadeh Chair in Engineering. In 1990, he received the Presidential Young Investigator Award of the National Science Foundation, and in 1995 he was cowinner of the Computers and Thought Award. He was a 1996 Miller Professor of the University of California and was appointed to a Chancellor’s Professorship in 2000. In 1998, he gave the Forsythe Memorial Lectures at Stanford University. He is a Fellow and former Executive Council member of the American Association for Artificial Intelligence. He has published over 100 papers on a wide range of topics in artificial intelligence. His other books include The Use of Knowledge in Analogy and Induction and (with Eric Wefald) Do the Right Thing: Studies in Limited Rationality.

Peter Norvig is currently Director of Research at Google, Inc., and was the director respon- sible for the core Web search algorithms from 2002 to 2005. He is a Fellow of the American Association for Artificial Intelligence and the Association for Computing Machinery. Previ- ously, he was head of the Computational Sciences Division at NASA Ames Research Center, where he oversaw NASA’s research and development in artificial intelligence and robotics, and chief scientist at Junglee, where he helped develop one of the first Internet information extraction services. He received a B.S. in applied mathematics from Brown University and a Ph.D. in computer science from the University of California at Berkeley. He received the Distinguished Alumni and Engineering Innovation awards from Berkeley and the Exceptional Achievement Medal from NASA. He has been a professor at the University of Southern Cal- ifornia and a research faculty member at Berkeley. His other books are Paradigms of AI Programming: Case Studies in Common Lisp and Verbmobil: A Translation System for Face- to-Face Dialog and Intelligent Help Systems for UNIX.

xii

 

 

Contents

I Artificial Intelligence

1 Introduction 1 1.1 What Is AI? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 The Foundations of Artificial Intelligence . . . . . . . . . . . . . . . . . . 5 1.3 The History of Artificial Intelligence . . . . . . . . . . . . . . . . . . . . 16 1.4 The State of the Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 1.5 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 29

2 Intelligent Agents 34 2.1 Agents and Environments . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.2 Good Behavior: The Concept of Rationality . . . . . . . . . . . . . . . . 36 2.3 The Nature of Environments . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.4 The Structure of Agents . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.5 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 59

II Problem-solving

3 Solving Problems by Searching 64 3.1 Problem-Solving Agents . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 3.2 Example Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.3 Searching for Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 3.4 Uninformed Search Strategies . . . . . . . . . . . . . . . . . . . . . . . . 81 3.5 Informed (Heuristic) Search Strategies . . . . . . . . . . . . . . . . . . . 92 3.6 Heuristic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.7 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 108

4 Beyond Classical Search 120 4.1 Local Search Algorithms and Optimization Problems . . . . . . . . . . . 120 4.2 Local Search in Continuous Spaces . . . . . . . . . . . . . . . . . . . . . 129 4.3 Searching with Nondeterministic Actions . . . . . . . . . . . . . . . . . . 133 4.4 Searching with Partial Observations . . . . . . . . . . . . . . . . . . . . . 138 4.5 Online Search Agents and Unknown Environments . . . . . . . . . . . . 147 4.6 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 153

5 Adversarial Search 161 5.1 Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 5.2 Optimal Decisions in Games . . . . . . . . . . . . . . . . . . . . . . . . 163 5.3 Alpha–Beta Pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 5.4 Imperfect Real-Time Decisions . . . . . . . . . . . . . . . . . . . . . . . 171 5.5 Stochastic Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

xiii

 

 

xiv Contents

5.6 Partially Observable Games . . . . . . . . . . . . . . . . . . . . . . . . . 180 5.7 State-of-the-Art Game Programs . . . . . . . . . . . . . . . . . . . . . . 185 5.8 Alternative Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 5.9 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 189

6 Constraint Satisfaction Problems 202 6.1 Defining Constraint Satisfaction Problems . . . . . . . . . . . . . . . . . 202 6.2 Constraint Propagation: Inference in CSPs . . . . . . . . . . . . . . . . . 208 6.3 Backtracking Search for CSPs . . . . . . . . . . . . . . . . . . . . . . . . 214 6.4 Local Search for CSPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 6.5 The Structure of Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 222 6.6 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 227

III Knowledge, reasoning, and planning

7 Logical Agents 234 7.1 Knowledge-Based Agents . . . . . . . . . . . . . . . . . . . . . . . . . . 235 7.2 The Wumpus World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 7.3 Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 7.4 Propositional Logic: A Very Simple Logic . . . . . . . . . . . . . . . . . 243 7.5 Propositional Theorem Proving . . . . . . . . . . . . . . . . . . . . . . . 249 7.6 Effective Propositional Model Checking . . . . . . . . . . . . . . . . . . 259 7.7 Agents Based on Propositional Logic . . . . . . . . . . . . . . . . . . . . 265 7.8 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 274

8 First-Order Logic 285 8.1 Representation Revisited . . . . . . . . . . . . . . . . . . . . . . . . . . 285 8.2 Syntax and Semantics of First-Order Logic . . . . . . . . . . . . . . . . . 290 8.3 Using First-Order Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 8.4 Knowledge Engineering in First-Order Logic . . . . . . . . . . . . . . . . 307 8.5 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 313

9 Inference in First-Order Logic 322 9.1 Propositional vs. First-Order Inference . . . . . . . . . . . . . . . . . . . 322 9.2 Unification and Lifting . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 9.3 Forward Chaining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 9.4 Backward Chaining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 9.5 Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 9.6 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 357

10 Classical Planning 366 10.1 Definition of Classical Planning . . . . . . . . . . . . . . . . . . . . . . . 366 10.2 Algorithms for Planning as State-Space Search . . . . . . . . . . . . . . . 373 10.3 Planning Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379

 

 

Contents xv

10.4 Other Classical Planning Approaches . . . . . . . . . . . . . . . . . . . . 387 10.5 Analysis of Planning Approaches . . . . . . . . . . . . . . . . . . . . . . 392 10.6 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 393

11 Planning and Acting in the Real World 401 11.1 Time, Schedules, and Resources . . . . . . . . . . . . . . . . . . . . . . . 401 11.2 Hierarchical Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 11.3 Planning and Acting in Nondeterministic Domains . . . . . . . . . . . . . 415 11.4 Multiagent Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 11.5 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 430

12 Knowledge Representation 437 12.1 Ontological Engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 12.2 Categories and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 12.3 Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 12.4 Mental Events and Mental Objects . . . . . . . . . . . . . . . . . . . . . 450 12.5 Reasoning Systems for Categories . . . . . . . . . . . . . . . . . . . . . 453 12.6 Reasoning with Default Information . . . . . . . . . . . . . . . . . . . . 458 12.7 The Internet Shopping World . . . . . . . . . . . . . . . . . . . . . . . . 462 12.8 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 467

IV Uncertain knowledge and reasoning

13 Quantifying Uncertainty 480 13.1 Acting under Uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . 480 13.2 Basic Probability Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 483 13.3 Inference Using Full Joint Distributions . . . . . . . . . . . . . . . . . . . 490 13.4 Independence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 13.5 Bayes’ Rule and Its Use . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 13.6 The Wumpus World Revisited . . . . . . . . . . . . . . . . . . . . . . . . 499 13.7 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 503

14 Probabilistic Reasoning 510 14.1 Representing Knowledge in an Uncertain Domain . . . . . . . . . . . . . 510 14.2 The Semantics of Bayesian Networks . . . . . . . . . . . . . . . . . . . . 513 14.3 Efficient Representation of Conditional Distributions . . . . . . . . . . . . 518 14.4 Exact Inference in Bayesian Networks . . . . . . . . . . . . . . . . . . . 522 14.5 Approximate Inference in Bayesian Networks . . . . . . . . . . . . . . . 530 14.6 Relational and First-Order Probability Models . . . . . . . . . . . . . . . 539 14.7 Other Approaches to Uncertain Reasoning . . . . . . . . . . . . . . . . . 546 14.8 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 551

15 Probabilistic Reasoning over Time 566 15.1 Time and Uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

 

 

xvi Contents

15.2 Inference in Temporal Models . . . . . . . . . . . . . . . . . . . . . . . . 570 15.3 Hidden Markov Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 15.4 Kalman Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 15.5 Dynamic Bayesian Networks . . . . . . . . . . . . . . . . . . . . . . . . 590 15.6 Keeping Track of Many Objects . . . . . . . . . . . . . . . . . . . . . . . 599 15.7 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 603

16 Making Simple Decisions 610 16.1 Combining Beliefs and Desires under Uncertainty . . . . . . . . . . . . . 610 16.2 The Basis of Utility Theory . . . . . . . . . . . . . . . . . . . . . . . . . 611 16.3 Utility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615 16.4 Multiattribute Utility Functions . . . . . . . . . . . . . . . . . . . . . . . 622 16.5 Decision Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 16.6 The Value of Information . . . . . . . . . . . . . . . . . . . . . . . . . . 628 16.7 Decision-Theoretic Expert Systems . . . . . . . . . . . . . . . . . . . . . 633 16.8 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 636

17 Making Complex Decisions 645 17.1 Sequential Decision Problems . . . . . . . . . . . . . . . . . . . . . . . . 645 17.2 Value Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652 17.3 Policy Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 17.4 Partially Observable MDPs . . . . . . . . . . . . . . . . . . . . . . . . . 658 17.5 Decisions with Multiple Agents: Game Theory . . . . . . . . . . . . . . . 666 17.6 Mechanism Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679 17.7 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 684

V Learning

18 Learning from Examples 693 18.1 Forms of Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 18.2 Supervised Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 18.3 Learning Decision Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 18.4 Evaluating and Choosing the Best Hypothesis . . . . . . . . . . . . . . . 708 18.5 The Theory of Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 18.6 Regression and Classification with Linear Models . . . . . . . . . . . . . 717 18.7 Artificial Neural Networks . . . . . . . . . . . . . . . . . . . . . . . . . 727 18.8 Nonparametric Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 18.9 Support Vector Machines . . . . . . . . . . . . . . . . . . . . . . . . . . 744 18.10 Ensemble Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 18.11 Practical Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . 753 18.12 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 757

19 Knowledge in Learning 768 19.1 A Logical Formulation of Learning . . . . . . . . . . . . . . . . . . . . . 768

 

 

Contents xvii

19.2 Knowledge in Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 19.3 Explanation-Based Learning . . . . . . . . . . . . . . . . . . . . . . . . 780 19.4 Learning Using Relevance Information . . . . . . . . . . . . . . . . . . . 784 19.5 Inductive Logic Programming . . . . . . . . . . . . . . . . . . . . . . . . 788 19.6 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 797

20 Learning Probabilistic Models 802 20.1 Statistical Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802 20.2 Learning with Complete Data . . . . . . . . . . . . . . . . . . . . . . . . 806 20.3 Learning with Hidden Variables: The EM Algorithm . . . . . . . . . . . . 816 20.4 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 825

21 Reinforcement Learning 830 21.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 830 21.2 Passive Reinforcement Learning . . . . . . . . . . . . . . . . . . . . . . 832 21.3 Active Reinforcement Learning . . . . . . . . . . . . . . . . . . . . . . . 839 21.4 Generalization in Reinforcement Learning . . . . . . . . . . . . . . . . . 845 21.5 Policy Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 848 21.6 Applications of Reinforcement Learning . . . . . . . . . . . . . . . . . . 850 21.7 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 853

VI Communicating, perceiving, and acting

22 Natural Language Processing 860 22.1 Language Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860 22.2 Text Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865 22.3 Information Retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867 22.4 Information Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873 22.5 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 882

23 Natural Language for Communication 888 23.1 Phrase Structure Grammars . . . . . . . . . . . . . . . . . . . . . . . . . 888 23.2 Syntactic Analysis (Parsing) . . . . . . . . . . . . . . . . . . . . . . . . . 892 23.3 Augmented Grammars and Semantic Interpretation . . . . . . . . . . . . 897 23.4 Machine Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907 23.5 Speech Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912 23.6 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 918

24 Perception 928 24.1 Image Formation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929 24.2 Early Image-Processing Operations . . . . . . . . . . . . . . . . . . . . . 935 24.3 Object Recognition by Appearance . . . . . . . . . . . . . . . . . . . . . 942 24.4 Reconstructing the 3D World . . . . . . . . . . . . . . . . . . . . . . . . 947 24.5 Object Recognition from Structural Information . . . . . . . . . . . . . . 957

 

 

xviii Contents

24.6 Using Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961 24.7 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 965

25 Robotics 971 25.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 971 25.2 Robot Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973 25.3 Robotic Perception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 978 25.4 Planning to Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 986 25.5 Planning Uncertain Movements . . . . . . . . . . . . . . . . . . . . . . . 993 25.6 Moving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 997 25.7 Robotic Software Architectures . . . . . . . . . . . . . . . . . . . . . . . 1003 25.8 Application Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006 25.9 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 1010

VII Conclusions

26 Philosophical Foundations 1020 26.1 Weak AI: Can Machines Act Intelligently? . . . . . . . . . . . . . . . . . 1020 26.2 Strong AI: Can Machines Really Think? . . . . . . . . . . . . . . . . . . 1026 26.3 The Ethics and Risks of Developing Artificial Intelligence . . . . . . . . . 1034 26.4 Summary, Bibliographical and Historical Notes, Exercises . . . . . . . . . 1040

27 AI: The Present and Future 1044 27.1 Agent Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1044 27.2 Agent Architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047 27.3 Are We Going in the Right Direction? . . . . . . . . . . . . . . . . . . . 1049 27.4 What If AI Does Succeed? . . . . . . . . . . . . . . . . . . . . . . . . . 1051

A Mathematical background 1053 A.1 Complexity Analysis and O() Notation . . . . . . . . . . . . . . . . . . . 1053 A.2 Vectors, Matrices, and Linear Algebra . . . . . . . . . . . . . . . . . . . 1055 A.3 Probability Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057

B Notes on Languages and Algorithms 1060 B.1 Defining Languages with Backus–Naur Form (BNF) . . . . . . . . . . . . 1060 B.2 Describing Algorithms with Pseudocode . . . . . . . . . . . . . . . . . . 1061 B.3 Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1062

Bibliography 1063

Index 1095

 

 

1 INTRODUCTION

In which we try to explain why we consider artificial intelligence to be a subject most worthy of study, and in which we try to decide what exactly it is, this being a good thing to decide before embarking.

We call ourselves Homo sapiens—man the wise—because our intelligence is so importantINTELLIGENCE to us. For thousands of years, we have tried to understand how we think; that is, how a mere handful of matter can perceive, understand, predict, and manipulate a world far larger and more complicated than itself. The field of artificial intelligence, or AI, goes further still: itARTIFICIALINTELLIGENCE attempts not just to understand but also to build intelligent entities.

AI is one of the newest fields in science and engineering. Work started in earnest soon after World War II, and the name itself was coined in 1956. Along with molecular biology, AI is regularly cited as the “field I would most like to be in” by scientists in other disciplines. A student in physics might reasonably feel that all the good ideas have already been taken by Galileo, Newton, Einstein, and the rest. AI, on the other hand, still has openings for several full-time Einsteins and Edisons.

AI currently encompasses a huge variety of subfields, ranging from the general (learning and perception) to the specific, such as playing chess, proving mathematical theorems, writing poetry, driving a car on a crowded street, and diagnosing diseases. AI is relevant to any intellectual task; it is truly a universal field.

1.1 WHAT IS AI?

We have claimed that AI is exciting, but we have not said what it is. In Figure 1.1 we see eight definitions of AI, laid out along two dimensions. The definitions on top are concerned with thought processes and reasoning, whereas the ones on the bottom address behavior. The definitions on the left measure success in terms of fidelity to human performance, whereas the ones on the right measure against an ideal performance measure, called rationality. ARATIONALITY system is rational if it does the “right thing,” given what it knows.

Historically, all four approaches to AI have been followed, each by different people with different methods. A human-centered approach must be in part an empirical science, in-

1

 

 

2 Chapter 1. Introduction

Thinking Humanly Thinking Rationally

“The exciting new effort to make comput- ers think . . . machines with minds, in the full and literal sense.” (Haugeland, 1985)

“The study of mental faculties through the use of computational models.” (Charniak and McDermott, 1985)

“[The automation of] activities that we associate with human thinking, activities such as decision-making, problem solv- ing, learning . . .” (Bellman, 1978)

“The study of the computations that make it possible to perceive, reason, and act.” (Winston, 1992)

Acting Humanly Acting Rationally

“The art of creating machines that per- form functions that require intelligence when performed by people.” (Kurzweil, 1990)

“Computational Intelligence is the study of the design of intelligent agents.” (Poole et al., 1998)

“The study of how to make computers do things at which, at the moment, people are better.” (Rich and Knight, 1991)

“AI . . . is concerned with intelligent be- havior in artifacts.” (Nilsson, 1998)

Figure 1.1 Some definitions of artificial intelligence, organized into four categories.

volving observations and hypotheses about human behavior. A rationalist1 approach involves a combination of mathematics and engineering. The various group have both disparaged and helped each other. Let us look at the four approaches in more detail.

1.1.1 Acting humanly: The Turing Test approach

The Turing Test, proposed by Alan Turing (1950), was designed to provide a satisfactoryTURING TEST operational definition of intelligence. A computer passes the test if a human interrogator, after posing some written questions, cannot tell whether the written responses come from a person or from a computer. Chapter 26 discusses the details of the test and whether a computer would really be intelligent if it passed. For now, we note that programming a computer to pass a rigorously applied test provides plenty to work on. The computer would need to possess the following capabilities:

• natural language processing to enable it to communicate successfully in English;NATURAL LANGUAGEPROCESSING • knowledge representation to store what it knows or hears;KNOWLEDGEREPRESENTATION • automated reasoning to use the stored information to answer questions and to drawAUTOMATEDREASONING

new conclusions;

• machine learning to adapt to new circumstances and to detect and extrapolate patterns.MACHINE LEARNING

1 By distinguishing between human and rational behavior, we are not suggesting that humans are necessarily “irrational” in the sense of “emotionally unstable” or “insane.” One merely need note that we are not perfect: not all chess players are grandmasters; and, unfortunately, not everyone gets an A on the exam. Some systematic errors in human reasoning are cataloged by Kahneman et al. (1982).

 

 

Section 1.1. What Is AI? 3

Turing’s test deliberately avoided direct physical interaction between the interrogator and the computer, because physical simulation of a person is unnecessary for intelligence. However, the so-called total Turing Test includes a video signal so that the interrogator can test theTOTAL TURING TEST subject’s perceptual abilities, as well as the opportunity for the interrogator to pass physical objects “through the hatch.” To pass the total Turing Test, the computer will need

• computer vision to perceive objects, andCOMPUTER VISION

• robotics to manipulate objects and move about.ROBOTICS

These six disciplines compose most of AI, and Turing deserves credit for designing a test that remains relevant 60 years later. Yet AI researchers have devoted little effort to passing the Turing Test, believing that it is more important to study the underlying principles of in- telligence than to duplicate an exemplar. The quest for “artificial flight” succeeded when the Wright brothers and others stopped imitating birds and started using wind tunnels and learn- ing about aerodynamics. Aeronautical engineering texts do not define the goal of their field as making “machines that fly so exactly like pigeons that they can fool even other pigeons.”

1.1.2 Thinking humanly: The cognitive modeling approach

If we are going to say that a given program thinks like a human, we must have some way of determining how humans think. We need to get inside the actual workings of human minds. There are three ways to do this: through introspection—trying to catch our own thoughts as they go by; through psychological experiments—observing a person in action; and through brain imaging—observing the brain in action. Once we have a sufficiently precise theory of the mind, it becomes possible to express the theory as a computer program. If the program’s input–output behavior matches corresponding human behavior, that is evidence that some of the program’s mechanisms could also be operating in humans. For example, Allen Newell and Herbert Simon, who developed GPS, the “General Problem Solver” (Newell and Simon, 1961), were not content merely to have their program solve problems correctly. They were more concerned with comparing the trace of its reasoning steps to traces of human subjects solving the same problems. The interdisciplinary field of cognitive science brings togetherCOGNITIVE SCIENCE computer models from AI and experimental techniques from psychology to construct precise and testable theories of the human mind.

Cognitive science is a fascinating field in itself, worthy of several textbooks and at least one encyclopedia (Wilson and Keil, 1999). We will occasionally comment on similarities or differences between AI techniques and human cognition. Real cognitive science, however, is necessarily based on experimental investigation of actual humans or animals. We will leave that for other books, as we assume the reader has only a computer for experimentation.

In the early days of AI there was often confusion between the approaches: an author would argue that an algorithm performs well on a task and that it is therefore a good model of human performance, or vice versa. Modern authors separate the two kinds of claims; this distinction has allowed both AI and cognitive science to develop more rapidly. The two fields continue to fertilize each other, most notably in computer vision, which incorporates neurophysiological evidence into computational models.

 

 

4 Chapter 1. Introduction

1.1.3 Thinking rationally: The “laws of thought” approach

The Greek philosopher Aristotle was one of the first to attempt to codify “right thinking,” that is, irrefutable reasoning processes. His syllogisms provided patterns for argument structuresSYLLOGISM that always yielded correct conclusions when given correct premises—for example, “Socrates is a man; all men are mortal; therefore, Socrates is mortal.” These laws of thought were supposed to govern the operation of the mind; their study initiated the field called logic.LOGIC

Logicians in the 19th century developed a precise notation for statements about all kinds of objects in the world and the relations among them. (Contrast this with ordinary arithmetic notation, which provides only for statements about numbers.) By 1965, programs existed that could, in principle, solve any solvable problem described in logical notation. (Although if no solution exists, the program might loop forever.) The so-called logicist tradition withinLOGICIST artificial intelligence hopes to build on such programs to create intelligent systems.

There are two main obstacles to this approach. First, it is not easy to take informal knowledge and state it in the formal terms required by logical notation, particularly when the knowledge is less than 100% certain. Second, there is a big difference between solving a problem “in principle” and solving it in practice. Even problems with just a few hundred facts can exhaust the computational resources of any computer unless it has some guidance as to which reasoning steps to try first. Although both of these obstacles apply to any attempt to build computational reasoning systems, they appeared first in the logicist tradition.

1.1.4 Acting rationally: The rational agent approach

An agent is just something that acts (agent comes from the Latin agere, to do). Of course,AGENT all computer programs do something, but computer agents are expected to do more: operate autonomously, perceive their environment, persist over a prolonged time period, adapt to change, and create and pursue goals. A rational agent is one that acts so as to achieve theRATIONAL AGENT best outcome or, when there is uncertainty, the best expected outcome.

In the “laws of thought” approach to AI, the emphasis was on correct inferences. Mak- ing correct inferences is sometimes part of being a rational agent, because one way to act rationally is to reason logically to the conclusion that a given action will achieve one’s goals and then to act on that conclusion. On the other hand, correct inference is not all of ration- ality; in some situations, there is no provably correct thing to do, but something must still be done. There are also ways of acting rationally that cannot be said to involve inference. For example, recoiling from a hot stove is a reflex action that is usually more successful than a slower action taken after careful deliberation.

All the skills needed for the Turing Test also allow an agent to act rationally. Knowledge representation and reasoning enable agents to reach good decisions. We need to be able to generate comprehensible sentences in natural language to get by in a complex society. We need learning not only for erudition, but also because it improves our ability to generate effective behavior.

The rational-agent approach has two advantages over the other approaches. First, it is more general than the “laws of thought” approach because correct inference is just one of several possible mechanisms for achieving rationality. Second, it is more amenable to

 

 

Section 1.2. The Foundations of Artificial Intelligence 5

scientific development than are approaches based on human behavior or human thought. The standard of rationality is mathematically well defined and completely general, and can be “unpacked” to generate agent designs that provably achieve it. Human behavior, on the other hand, is well adapted for one specific environment and is defined by, well, the sum total of all the things that humans do. This book therefore concentrates on general principles of rational agents and on components for constructing them. We will see that despite the apparent simplicity with which the problem can be stated, an enormous variety of issues come up when we try to solve it. Chapter 2 outlines some of these issues in more detail.

One important point to keep in mind: We will see before too long that achieving perfect rationality—always doing the right thing—is not feasible in complicated environments. The computational demands are just too high. For most of the book, however, we will adopt the working hypothesis that perfect rationality is a good starting point for analysis. It simplifies the problem and provides the appropriate setting for most of the foundational material in the field. Chapters 5 and 17 deal explicitly with the issue of limited rationality—actingLIMITEDRATIONALITY appropriately when there is not enough time to do all the computations one might like.

1.2 THE FOUNDATIONS OF ARTIFICIAL INTELLIGENCE

In this section, we provide a brief history of the disciplines that contributed ideas, viewpoints, and techniques to AI. Like any history, this one is forced to concentrate on a small number of people, events, and ideas and to ignore others that also were important. We organize the history around a series of questions. We certainly would not wish to give the impression that these questions are the only ones the disciplines address or that the disciplines have all been working toward AI as their ultimate fruition.

1.2.1 Philosophy

• Can formal rules be used to draw valid conclusions? • How does the mind arise from a physical brain? • Where does knowledge come from? • How does knowledge lead to action?

Aristotle (384–322 B.C.), whose bust appears on the front cover of this book, was the first to formulate a precise set of laws governing the rational part of the mind. He developed an informal system of syllogisms for proper reasoning, which in principle allowed one to gener- ate conclusions mechanically, given initial premises. Much later, Ramon Lull (d. 1315) had the idea that useful reasoning could actually be carried out by a mechanical artifact. Thomas Hobbes (1588–1679) proposed that reasoning was like numerical computation, that “we add and subtract in our silent thoughts.” The automation of computation itself was already well under way. Around 1500, Leonardo da Vinci (1452–1519) designed but did not build a me- chanical calculator; recent reconstructions have shown the design to be functional. The first known calculating machine was constructed around 1623 by the German scientist Wilhelm Schickard (1592–1635), although the Pascaline, built in 1642 by Blaise Pascal (1623–1662),

 

 

6 Chapter 1. Introduction

is more famous. Pascal wrote that “the arithmetical machine produces effects which appear nearer to thought than all the actions of animals.” Gottfried Wilhelm Leibniz (1646–1716) built a mechanical device intended to carry out operations on concepts rather than numbers, but its scope was rather limited. Leibniz did surpass Pascal by building a calculator that could add, subtract, multiply, and take roots, whereas the Pascaline could only add and sub- tract. Some speculated that machines might not just do calculations but actually be able to think and act on their own. In his 1651 book Leviathan, Thomas Hobbes suggested the idea of an “artificial animal,” arguing “For what is the heart but a spring; and the nerves, but so many strings; and the joints, but so many wheels.”

It’s one thing to say that the mind operates, at least in part, according to logical rules, and to build physical systems that emulate some of those rules; it’s another to say that the mind itself is such a physical system. René Descartes (1596–1650) gave the first clear discussion of the distinction between mind and matter and of the problems that arise. One problem with a purely physical conception of the mind is that it seems to leave little room for free will: if the mind is governed entirely by physical laws, then it has no more free will than a rock “deciding” to fall toward the center of the earth. Descartes was a strong advocate of the power of reasoning in understanding the world, a philosophy now called rationalism, and one thatRATIONALISM counts Aristotle and Leibnitz as members. But Descartes was also a proponent of dualism.DUALISM He held that there is a part of the human mind (or soul or spirit) that is outside of nature, exempt from physical laws. Animals, on the other hand, did not possess this dual quality; they could be treated as machines. An alternative to dualism is materialism, which holdsMATERIALISM that the brain’s operation according to the laws of physics constitutes the mind. Free will is simply the way that the perception of available choices appears to the choosing entity.

Given a physical mind that manipulates knowledge, the next problem is to establish the source of knowledge. The empiricism movement, starting with Francis Bacon’s (1561–EMPIRICISM 1626) Novum Organum,2 is characterized by a dictum of John Locke (1632–1704): “Nothing is in the understanding, which was not first in the senses.” David Hume’s (1711–1776) A Treatise of Human Nature (Hume, 1739) proposed what is now known as the principle of induction: that general rules are acquired by exposure to repeated associations between theirINDUCTION elements. Building on the work of Ludwig Wittgenstein (1889–1951) and Bertrand Russell (1872–1970), the famous Vienna Circle, led by Rudolf Carnap (1891–1970), developed the doctrine of logical positivism. This doctrine holds that all knowledge can be characterized byLOGICAL POSITIVISM logical theories connected, ultimately, to observation sentences that correspond to sensoryOBSERVATIONSENTENCES inputs; thus logical positivism combines rationalism and empiricism.3 The confirmation the- ory of Carnap and Carl Hempel (1905–1997) attempted to analyze the acquisition of knowl-CONFIRMATIONTHEORY edge from experience. Carnap’s book The Logical Structure of the World (1928) defined an explicit computational procedure for extracting knowledge from elementary experiences. It was probably the first theory of mind as a computational process.

2 The Novum Organum is an update of Aristotle’s Organon, or instrument of thought. Thus Aristotle can be seen as both an empiricist and a rationalist. 3 In this picture, all meaningful statements can be verified or falsified either by experimentation or by analysis of the meaning of the words. Because this rules out most of metaphysics, as was the intention, logical positivism was unpopular in some circles.

 

 

Section 1.2. The Foundations of Artificial Intelligence 7

The final element in the philosophical picture of the mind is the connection between knowledge and action. This question is vital to AI because intelligence requires action as well as reasoning. Moreover, only by understanding how actions are justified can we understand how to build an agent whose actions are justifiable (or rational). Aristotle argued (in De Motu Animalium) that actions are justified by a logical connection between goals and knowledge of the action’s outcome (the last part of this extract also appears on the front cover of this book, in the original Greek):

But how does it happen that thinking is sometimes accompanied by action and sometimes not, sometimes by motion, and sometimes not? It looks as if almost the same thing happens as in the case of reasoning and making inferences about unchanging objects. But in that case the end is a speculative proposition . . . whereas here the conclusion which results from the two premises is an action. . . . I need covering; a cloak is a covering. I need a cloak. What I need, I have to make; I need a cloak. I have to make a cloak. And the conclusion, the “I have to make a cloak,” is an action.

In the Nicomachean Ethics (Book III. 3, 1112b), Aristotle further elaborates on this topic, suggesting an algorithm:

We deliberate not about ends, but about means. For a doctor does not deliberate whether he shall heal, nor an orator whether he shall persuade, . . . They assume the end and consider how and by what means it is attained, and if it seems easily and best produced thereby; while if it is achieved by one means only they consider how it will be achieved by this and by what means this will be achieved, till they come to the first cause, . . . and what is last in the order of analysis seems to be first in the order of becoming. And if we come on an impossibility, we give up the search, e.g., if we need money and this cannot be got; but if a thing appears possible we try to do it.

Aristotle’s algorithm was implemented 2300 years later by Newell and Simon in their GPS program. We would now call it a regression planning system (see Chapter 10).

Goal-based analysis is useful, but does not say what to do when several actions will achieve the goal or when no action will achieve it completely. Antoine Arnauld (1612–1694) correctly described a quantitative formula for deciding what action to take in cases like this (see Chapter 16). John Stuart Mill’s (1806–1873) book Utilitarianism (Mill, 1863) promoted the idea of rational decision criteria in all spheres of human activity. The more formal theory of decisions is discussed in the following section.

1.2.2 Mathematics

• What are the formal rules to draw valid conclusions?

• What can be computed?

• How do we reason with uncertain information?

Philosophers staked out some of the fundamental ideas of AI, but the leap to a formal science required a level of mathematical formalization in three fundamental areas: logic, computa- tion, and probability.

The idea of formal logic can be traced back to the philosophers of ancient Greece, but its mathematical development really began with the work of George Boole (1815–1864), who

 

 

8 Chapter 1. Introduction

worked out the details of propositional, or Boolean, logic (Boole, 1847). In 1879, Gottlob Frege (1848–1925) extended Boole’s logic to include objects and relations, creating the first- order logic that is used today.4 Alfred Tarski (1902–1983) introduced a theory of reference that shows how to relate the objects in a logic to objects in the real world.

The next step was to determine the limits of what could be done with logic and com- putation. The first nontrivial algorithm is thought to be Euclid’s algorithm for computingALGORITHM greatest common divisors. The word algorithm (and the idea of studying them) comes from al-Khowarazmi, a Persian mathematician of the 9th century, whose writings also introduced Arabic numerals and algebra to Europe. Boole and others discussed algorithms for logical deduction, and, by the late 19th century, efforts were under way to formalize general mathe- matical reasoning as logical deduction. In 1930, Kurt Gödel (1906–1978) showed that there exists an effective procedure to prove any true statement in the first-order logic of Frege and Russell, but that first-order logic could not capture the principle of mathematical induction needed to characterize the natural numbers. In 1931, Gödel showed that limits on deduc- tion do exist. His incompleteness theorem showed that in any formal theory as strong asINCOMPLETENESSTHEOREM Peano arithmetic (the elementary theory of natural numbers), there are true statements that are undecidable in the sense that they have no proof within the theory.

This fundamental result can also be interpreted as showing that some functions on the integers cannot be represented by an algorithm—that is, they cannot be computed. This motivated Alan Turing (1912–1954) to try to characterize exactly which functions are com- putable—capable of being computed. This notion is actually slightly problematic becauseCOMPUTABLE the notion of a computation or effective procedure really cannot be given a formal definition. However, the Church–Turing thesis, which states that the Turing machine (Turing, 1936) is capable of computing any computable function, is generally accepted as providing a sufficient definition. Turing also showed that there were some functions that no Turing machine can compute. For example, no machine can tell in general whether a given program will return an answer on a given input or run forever.

Although decidability and computability are important to an understanding of computa- tion, the notion of tractability has had an even greater impact. Roughly speaking, a problemTRACTABILITY is called intractable if the time required to solve instances of the problem grows exponentially with the size of the instances. The distinction between polynomial and exponential growth in complexity was first emphasized in the mid-1960s (Cobham, 1964; Edmonds, 1965). It is important because exponential growth means that even moderately large instances cannot be solved in any reasonable time. Therefore, one should strive to divide the overall problem of generating intelligent behavior into tractable subproblems rather than intractable ones.

How can one recognize an intractable problem? The theory of NP-completeness, pio-NP-COMPLETENESS neered by Steven Cook (1971) and Richard Karp (1972), provides a method. Cook and Karp showed the existence of large classes of canonical combinatorial search and reasoning prob- lems that are NP-complete. Any problem class to which the class of NP-complete problems can be reduced is likely to be intractable. (Although it has not been proved that NP-complete

4 Frege’s proposed notation for first-order logic—an arcane combination of textual and geometric features— never became popular.

 

 

Section 1.2. The Foundations of Artificial Intelligence 9

problems are necessarily intractable, most theoreticians believe it.) These results contrast with the optimism with which the popular press greeted the first computers—“Electronic Super-Brains” that were “Faster than Einstein!” Despite the increasing speed of computers, careful use of resources will characterize intelligent systems. Put crudely, the world is an extremely large problem instance! Work in AI has helped explain why some instances of NP-complete problems are hard, yet others are easy (Cheeseman et al., 1991).

Besides logic and computation, the third great contribution of mathematics to AI is the theory of probability. The Italian Gerolamo Cardano (1501–1576) first framed the idea ofPROBABILITY probability, describing it in terms of the possible outcomes of gambling events. In 1654, Blaise Pascal (1623–1662), in a letter to Pierre Fermat (1601–1665), showed how to pre- dict the future of an unfinished gambling game and assign average payoffs to the gamblers. Probability quickly became an invaluable part of all the quantitative sciences, helping to deal with uncertain measurements and incomplete theories. James Bernoulli (1654–1705), Pierre Laplace (1749–1827), and others advanced the theory and introduced new statistical meth- ods. Thomas Bayes (1702–1761), who appears on the front cover of this book, proposed a rule for updating probabilities in the light of new evidence. Bayes’ rule underlies most modern approaches to uncertain reasoning in AI systems.

1.2.3 Economics

• How should we make decisions so as to maximize payoff?

• How should we do this when others may not go along?

• How should we do this when the payoff may be far in the future?

The science of economics got its start in 1776, when Scottish philosopher Adam Smith (1723–1790) published An Inquiry into the Nature and Causes of the Wealth of Nations. While the ancient Greeks and others had made contributions to economic thought, Smith was the first to treat it as a science, using the idea that economies can be thought of as consist- ing of individual agents maximizing their own economic well-being. Most people think of economics as being about money, but economists will say that they are really studying how people make choices that lead to preferred outcomes. When McDonald’s offers a hamburger for a dollar, they are asserting that they would prefer the dollar and hoping that customers will prefer the hamburger. The mathematical treatment of “preferred outcomes” or utility wasUTILITY first formalized by Léon Walras (pronounced “Valrasse”) (1834-1910) and was improved by Frank Ramsey (1931) and later by John von Neumann and Oskar Morgenstern in their book The Theory of Games and Economic Behavior (1944).

Decision theory, which combines probability theory with utility theory, provides a for-DECISION THEORY mal and complete framework for decisions (economic or otherwise) made under uncertainty— that is, in cases where probabilistic descriptions appropriately capture the decision maker’s environment. This is suitable for “large” economies where each agent need pay no attention to the actions of other agents as individuals. For “small” economies, the situation is much more like a game: the actions of one player can significantly affect the utility of another (either positively or negatively). Von Neumann and Morgenstern’s development of game theory (see also Luce and Raiffa, 1957) included the surprising result that, for some games,GAME THEORY

 

 

10 Chapter 1. Introduction

a rational agent should adopt policies that are (or least appear to be) randomized. Unlike de- cision theory, game theory does not offer an unambiguous prescription for selecting actions.

For the most part, economists did not address the third question listed above, namely, how to make rational decisions when payoffs from actions are not immediate but instead re- sult from several actions taken in sequence. This topic was pursued in the field of operations research, which emerged in World War II from efforts in Britain to optimize radar installa-OPERATIONSRESEARCH tions, and later found civilian applications in complex management decisions. The work of Richard Bellman (1957) formalized a class of sequential decision problems called Markov decision processes, which we study in Chapters 17 and 21.

Work in economics and operations research has contributed much to our notion of ra- tional agents, yet for many years AI research developed along entirely separate paths. One reason was the apparent complexity of making rational decisions. The pioneering AI re- searcher Herbert Simon (1916–2001) won the Nobel Prize in economics in 1978 for his early work showing that models based on satisficing—making decisions that are “good enough,”SATISFICING rather than laboriously calculating an optimal decision—gave a better description of actual human behavior (Simon, 1947). Since the 1990s, there has been a resurgence of interest in decision-theoretic techniques for agent systems (Wellman, 1995).

1.2.4 Neuroscience

• How do brains process information?

Neuroscience is the study of the nervous system, particularly the brain. Although the exactNEUROSCIENCE way in which the brain enables thought is one of the great mysteries of science, the fact that it does enable thought has been appreciated for thousands of years because of the evidence that strong blows to the head can lead to mental incapacitation. It has also long been known that human brains are somehow different; in about 335 B.C. Aristotle wrote, “Of all the animals, man has the largest brain in proportion to his size.”5 Still, it was not until the middle of the 18th century that the brain was widely recognized as the seat of consciousness. Before then, candidate locations included the heart and the spleen.

Paul Broca’s (1824–1880) study of aphasia (speech deficit) in brain-damaged patients in 1861 demonstrated the existence of localized areas of the brain responsible for specific cognitive functions. In particular, he showed that speech production was localized to the portion of the left hemisphere now called Broca’s area.6 By that time, it was known that the brain consisted of nerve cells, or neurons, but it was not until 1873 that Camillo GolgiNEURON (1843–1926) developed a staining technique allowing the observation of individual neurons in the brain (see Figure 1.2). This technique was used by Santiago Ramon y Cajal (1852– 1934) in his pioneering studies of the brain’s neuronal structures.7 Nicolas Rashevsky (1936, 1938) was the first to apply mathematical models to the study of the nervous sytem.

5 Since then, it has been discovered that the tree shrew (Scandentia) has a higher ratio of brain to body mass. 6 Many cite Alexander Hood (1824) as a possible prior source. 7 Golgi persisted in his belief that the brain’s functions were carried out primarily in a continuous medium in which neurons were embedded, whereas Cajal propounded the “neuronal doctrine.” The two shared the Nobel prize in 1906 but gave mutually antagonistic acceptance speeches.

 

 

Section 1.2. The Foundations of Artificial Intelligence 11

Axon

Cell body or Soma

Nucleus

Dendrite

Synapses

Axonal arborization

Axon from another cell

Synapse

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Exp19_Excel_Ch05_Cap_Apartments

Exp19_Excel_Ch05_Cap_Apartments

Project Description:

You manage several apartment complexes in Phoenix, Arizona. You created a dataset that lists details for each apartment complex, such as apartment number, including number of bedrooms, whether the unit is rented or vacant, the last remodel date, rent, and deposits. You will use the datasets to aggregate data to analyze the apartments at the complexes.

Steps to Perform:

 

Step

Instructions

Points    Possible

 

1

Start   Excel. Download and open the file named Exp19_Excel_Ch05_Cap_Apartments.xlsx.   Grader has automatically added your last name to the beginning of the   filename.

02Before subtotalling the data, you need to sort the   data.
Select the Summary sheet. Sort the data by Apartment Complex in alphabetical   order and further sort it by # Bed (the number of bedrooms) from smallest to   largest.

3You   want to use the Subtotal feature to display the average total deposit by   number of bedrooms for each apartment complex.
Use the Subtotal feature to insert subtotal rows by Apartment Complex to   calculate the average Total Deposit. Add a second subtotal (without removing   the first subtotal) by # Bed to calculate the average Total Deposit by the   number of bedrooms.

5

 

4

Use the outline symbols to display only the   subtotal rows. Create an automatic outline and collapse the outline above   Total Deposit.

2

 

5

You   want to create a PivotTable to determine the total monthly rental revenue for   occupied apartments.
Display the Rentals sheet and create a blank PivotTable on a new worksheet to   the left of the Rentals sheet. Change the name of the worksheet to Rental   Revenue. Name   the PivotTable Rental Revenue.

7

 

6

Display the Apartment Complex and # Bed fields in   Rows and the Rental Price field as Values.

6

 

7

Format   the Sum of Rental Price for Accounting Number Format with zero decimal places   and enter the custom name Total Rent Collected.

3

 

8

Select the Occupied field for the filter and set   the filter to Yes to display data for occupied apartments.

3

 

9

You   want to calculate the total monthly rental revenue if the rates increase by   5% for the occupied apartments.
Insert a calculated field to multiply the Rental Price by 1.05. Change the name to New Rental   Revenue. Apply   Accounting Number Format with zero decimal places.

15

 

10

Select the range B3:C3 and apply these formats:   wrap text, Align Right horizontal alignment, and 30 row height. Select column B and set 9.29 column width. Select column C   and set 14.43 column   width.

5

 

11

Apply   Light Orange, Pivot Style Medium 10 to the PivotTable and display banded   rows.

5

 

12

Insert a slicer for # Bed so that you can filter   the dataset by number of bedrooms. Change the slicer caption to # of Bedrooms.

5

 

13

Change   the slicer height to 1.4 inches and width to 1.75 inches. Apply Light Orange, Slicer Style Light 2. Cut the slicer   and paste it in cell E2.

6

 

14

Insert a timeline for the Last Remodel field.   Change the time period to YEARS. Apply Light Orange, Timeline Style Light 2.   Change the timeline height to 1.4 inches and with to 3.75 inches.

5

 

15

The   Databases sheet contains two tables. You will create a relationship between   those tables.
Display the Databases sheet. Create a relationship between the APARTMENTS   table using the Code field and the COMPLEX table using the Code field.

5

 

16You want to create a PivotTable from the related   tables.
Create a PivotTable using the data model on a new sheet. Change the sheet   name to Bedrooms.   Name the PivotTable BedroomData.

5

 

17

Select   the Apartment Name field from the COMPLEX table for Rows, the # Bed field for   Columns, and the # Bed field as Values. This will display the number of   apartments with the specified number of bedrooms per apartment complex.   Display the values as a percentage of row totals.

5

 

18

Create a Clustered Column PivotChart. Cut the chart   and paste it in cell A13.

5

 

19

Select   the 3-bedroom data series and apply the Black, Text 1, Lighter 50% solid fill   color. Apply Black, Text 1 font color to the vertical axis and category axis.   Change the chart height to 3 inches and the width to 5 inches, if necessary. Hide the field   buttons in the PivotChart.

5

 

20

Create a footer on all worksheets with your name in   the left, the sheet name code in the center, and the file name code in the   right.

5

 

21

Save   and close Exp19_Excel_Ch05_Cap_Apartments.xlsx.   Exit Excel. Submit the file as directed.

0

 

Total   Points

100

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!