0% found this document useful (0 votes)
10 views10 pages

Assignment 1 python networking pytorch

The document outlines a series of homework assignments focused on artificial intelligence, covering topics such as AI contests, perception, motor skills, and the state of the art in AI. It includes specific tasks related to programming in Python, analyzing agent functions, and understanding the limitations of AI. The assignments require group collaboration and engagement with relevant literature, emphasizing practical applications and theoretical discussions in AI.

Uploaded by

Daniel Estrada
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views10 pages

Assignment 1 python networking pytorch

The document outlines a series of homework assignments focused on artificial intelligence, covering topics such as AI contests, perception, motor skills, and the state of the art in AI. It includes specific tasks related to programming in Python, analyzing agent functions, and understanding the limitations of AI. The assignments require group collaboration and engagement with relevant literature, emphasizing practical applications and theoretical discussions in AI.

Uploaded by

Daniel Estrada
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Daniel Estrada 6094435

Roberto Vera Marrero

Homework Assignments

Overview

Homework will consist of written, programming, and practical assignments. There will be
five (5) homework assignments throughout the semester, some of which will involve
significant programming. We will use Python 3 as our programming language. Homework
will be completed in groups of 2. You are expected to read the corresponding sections of
the book and be able to actively participate in class discussions.

This homework covers Chapters 1 and 2 of Russell and Norvig’s Book.

Assignments

1. [5 points] AI Contests
Different subfields of AI (Robotics, Computer Vision, NLP, Machine Learning, etc.)
have been holding contests by defining a standard task and challenging researchers
to do their best. Some examples include the International Planning Competition,
the DARPA Urban Challenge for Robotic Cars, the Robocup Robotic Soccer League,
the TREC (Text Retrieval Conference), the PASCAL Visual Object Classes
challenge, and contests in speech recognition and machine translation. Investigate
three of these contests and briefly describe the progress made over the years. To
what extent have the contests advanced the state of the art in AI?
You can find other examples of competitions here.

The DARPA Urban Challenge for Robotic Cars was centered around developing
fully autonomous vehicles capable of navigating complex urban environments.
Early participants improved vehicle perception, navigation, and decision-making
algorithms. However, after Stanford’s “Junior” won the competition by completing
the course autonomously in just under six hours, the challenge spurred a massive
leap in autonomous driving technology, leading directly to the development of
self-driving car companies like Google’s Waymo. The DARPA Urban Challenge
drove forward real-world applications of autonomous driving, with progress seen
in commercial autonomous vehicles today.

The RoboCup Robotic Soccer League involves teams of autonomous robots playing
soccer. The long-term goal is to have a team of fully autonomous humanoid robots
defeat the human World Cup champions by 2050. Early competitions featured
robots with limited mobility, simple decision-making abilities, and basic teamwork
strategies. However, over the years, RoboCup has advanced robot coordination,
multi-agent systems, and real-time decision-making.

The PASCAL Visual Object Classes (VOC) Challenge focused on object


classification, detection, and segmentation in images. Researchers were tasked
with building models to identify and localize a predefined set of objects across
various categories in natural scenes. The challenge played a critical role in driving
advances in computer vision and has had a lasting influence on fields like
autonomous driving, medical image analysis, and facial recognition. It helped define
the importance of large-scale datasets and benchmarks and showed how AI models
can learn from visual data in complex environments.

2. [5 points] Perception and Motor Skills


Some authors have claimed that perception and motor skills are the most
important part of intelligence, and that “higher-level” capacities are necessarily
parasitic—simple add-ons to these underlying faculties. Evolution and a large part
of the brain are devoted to perception and motor skills, while AI has found tasks
such as game playing and logical inference easier than perceiving and acting in the
real world.
Do you think AI’s traditional focus on higher-level cognitive abilities is misplaced?

I think that the current focus on higher level cognitive functions is well placed and
should be prioritized in the development of Artificial Intelligence over motor skills.
In order to act and physically interface with an environment, an intelligent agent
first strategizes and logically thinks of its current state and possible actions and
then executes those actions in the environment. Any action that requires
movement uses robotics which first represents the real world and movement in
software and passes down a course of action to its hardware. The planification of
actions supersedes the actions themselves.

3. [10 points] AI State of the Art


Examine the state of the art in AI and briefly discuss whether computers can
currently solve the following tasks:
○ Performing a complex surgical operation
○ Creating an art piece
○ Playing a competitive game of bridge
○ Playing a decent game of table tennis (Ping-Pong)
The state of the art in AI has made significant progress in various fields, but
the complexity of certain tasks, especially those requiring physical dexterity,
creativity, or social reasoning, remains challenging.

a. Performing a complex surgical operation:

No, not entirely. AI can assist with specific aspects of surgery, but fully
autonomous, complex surgical operations remain beyond AI's current
capabilities. For example, robotic systems like the Da Vinci Surgical System
are used to perform minimally invasive surgeries, with the surgeon
controlling robotic arms for precision. However, issues like handling
unexpected complications, adapting to changing conditions, and making
ethical decisions require human oversight.

b. Creating an art piece

Yes, to some extent. AI can create art pieces, but its creativity is largely
driven by patterns and data from previous works. While AI can produce
impressive results, it lacks the emotional, cultural, and subjective nuances
that human artists bring to the creative process.

c. Playing a competitive game of bridge

Not fully. AI can play bridge at a reasonable level, but its performance is not
yet on par with the best human players. The game’s complexity and reliance
on non-verbal communication and long-term strategic planning make it a
difficult challenge for AI.

d. Playing a decent game of table tennis (Ping-Pong)

No, not yet at a "decent" human level. While AI-powered robots can play
basic games of table tennis, they still struggle with the quick reflexes,
adaptability, and fine motor skills that human players exhibit. AI's
performance in this task is improving, but it’s not on par with decent human
players.

4. [5 points] Reflex Agent Analysis


Imagine a basic thermostat that activates a furnace when the temperature drops 4
degrees below the set point and deactivates it when it rises 4 degrees above.
Would this thermostat be considered a simple reflex agent, a model-based reflex
agent, or a goal-based agent?

The thermostat is a Reflex agent as it does not have any information about the past
or future, it simply reacts to the state of an environment.

5. [5 points] AI Limits
There are specific well-known categories of problems that are extremely difficult
or undecidable for computers to solve. Does this imply that creating AI is
impossible?

The existence of undecidable or NP-hard problems does not imply that creating AI
is impossible. While certain theoretical problems cannot be solved by computers,
many real-world tasks that AI is designed to handle do not fall into those
categories. AI systems are highly effective at solving practical problems using
heuristics, approximations, and learning from data. Although achieving
human-level Artificial General Intelligence presents more fundamental challenges,
narrow AI has already proven extremely successful across many domains despite
the limits of computability.

6. [10 points] PEAS Descriptions


For each of the following activities, provide a PEAS (Performance measure,
Environment, Actuators, Sensors) description of the task environment and
characterize its properties:
○ Automated taxi

Performance measure: Effectiveness of passenger dropoff, which could be


measured using total trip time, distance traveled, and how effectively the
vehicle abided by the traffic rules.

Environment: Cities, and places represented by street names, gps


coordinates or an xyz grid that represents the real world

Actuators: Wheels, lights, exhaust, honk

Sensors: LiDAR camera, gps, video cameras, gyroscopes

○ Exploring the subsurface oceans of Titan


Performance measure: Total area covered, amount of water sample
retrieved, fuel efficiency,

Environment: Ocean subsurface, unknown environment

Actuators: lights, motors, propeller

Sensors: LiDAR camera, gps, video cameras

○ Shopping for used AI books online

Performance measure: Customer satisfaction, amount of books sold

Environment: Online marketplace, user’s account, website’s home page

Actuators: recommend books, add them to the shopping cart, customer help

Sensors: User Input, search history, user data, shopping statistics

○ Bidding on an item at an auction

Performance measure: maximizing value, winning the auction, response


speed

Environment: online bidding, bidding auction

Actuators: place bids, respond to bids, selecting what to bid on

Sensors: User input, budget preferences, history of purchased items

○ Playing soccer

Performance measure: winning the match, maximizing attendance and


online engagement

Environment: soccer field, online simulator

Actuators: kick the ball, pass the ball, defend and attack, communicate with
players

Sensors: computer vision cameras, robotic platform to engage in play,


pressure sensitive sensors
7. [10 points] Rationality of Vacuum-Cleaner Agents
Analyze the rationality of various vacuum-cleaner agent functions.
○ Show that the simple vacuum-cleaner agent function described in Figure 2.3
is rational under the assumptions in section 2.2.2.

Under the assumptions in section 2.2.2, the agent function described in


Figure 2.3 is rational since:

■ It achieves the goal of keeping both squares clean by sucking if the


current square is dirty.
■ It explores both squares by moving after cleaning one square to
ensure it doesn't miss a dirty square.
■ Since the environment is fully observable, static, and deterministic,
the agent doesn't need to maintain any memory (internal state), and
simply reacting to percepts leads to optimal behavior.
■ The performance measure (cleaning both squares with minimal
movement) is maximized since the agent will only move when
necessary and suck when a square is dirty.
○ Describe a rational agent function for the case where each movement costs
one point. Does the corresponding agent program require an internal state?

A rational agent function for the case where each movement costs one point
could be:

■ If the current square is dirty, suck.


■ If the current square is clean and the other square is dirty, move to
the other square.
■ If both squares are clean, do nothing.

This agent program would require an internal state to remember whether


the other square is clean. Since the agent only perceives its current square
and does not have global knowledge of the environment, it must store the
information it gathers as it moves between squares. This memory allows the
agent to avoid unnecessary movements if it knows both squares are clean.

○ Discuss agent designs for cases where clean squares can become dirty again
and the geography of the environment is unknown.

Agent designs for cases where clean squares can become dirty again and the
geography of the environment is unknown might include the following
instructions:
● The agent should still suck when it perceives dirt on the current
square.
● Since the geography is unknown, the agent must explore the
environment systematically. This could involve methods like random
exploration or structured exploration strategies (e.g., depth-first
search, spiral movement).
● As it moves, the agent should create an internal map of the
environment. This allows it to keep track of which areas have been
cleaned and which areas remain unexplored or could have become
dirty again.
● The agent must periodically revisit squares, even after cleaning them,
since squares can become dirty again. A probabilistic model could
help the agent decide when to revisit a square based on the likelihood
of it becoming dirty.

Additionally, the agent would need an internal state to store the layout of
the environment as it discovers new squares, the cleanliness state of each square
(or the last known cleanliness state if it can’t see all squares at once), and the
frequency with which squares become dirty again, which could guide the agent's
revisiting strategy.

8. [10 points] Stochastic Vacuum-Cleaner Agent Programs


Consider agent programs for stochastic environments:
○ Actuator errors: 10% of the time, the action "Suck" fails to clean a dirty
floor and instead puts dirt on a clean floor. How does this affect your agent
program?

Developers should implement a checking mechanism to verify the suck was


successful. This brings up the consideration of the cost of multiple sucks.

○ Sensor errors: The dirt sensor gives the wrong answer 25% of the time. How
does this affect your agent program?

The agents should keep a history of states to compare current sensor data
with as a security measure.

○ Pets in the house: At each time step, each clean square has a 15% chance of
becoming dirty. Can you design a rational agent for this scenario?
Since squares can re-dirty due to pets, the agent should periodically recheck
squares that were recently cleaned.

9. [20 points] Programming Assignment


Create a Python program that includes a function to convert miles to kilometers.
The program should prompt the user to enter the number of miles driven and use a
function to perform the conversion. Ensure all input is validated, using try/except
blocks to handle errors. The program should display both the total miles and
corresponding kilometers. The program should continue to request inputs and
perform calculations until a negative number is entered. Include comprehensive
instructions for executing your program.

CODE:

def miles_to_kilometers(miles):

"Converts miles to kilometers."

return miles * 1.60934

def main():

print("Welcome to the Miles to Kilometers Converter!")

print("Enter the number of miles driven, and I'll convert it to kilometers.")

print("To stop, enter a negative number.\n")

while True:

try:

# Get input from user

miles = float(input("Enter the number of miles: "))

# If the user enters a negative number, break the loop


if miles < 0:

print("Ending the program. Thank you!")

break

# Converts miles to kilometers

kilometers = miles_to_kilometers(miles)

# Displays the result

print(f"{miles} miles is equivalent to {kilometers:.2f} kilometers.\n")

except ValueError:

print("Invalid input. Please enter a valid number.\n")

# Run the program

main()

10. [20 points] Running AI code:


○ Install the Python library from the GitHub aimacode aima-python website
Links to an external site.
○ Make sure you follow the instructions.
○ Run the file agents.py in interactive mode. I run it in my computer with
Ubuntu as python3 -i agents.py but it may vary depending on the operating
system.
○ Run the following lines of code in the interactive command line:

>>> a = ReflexVacuumAgent()

>>> a.program((loc_A, ’Clean’))

>>> a.program((loc_B, ’Clean’))


>>> a.program((loc_A, ’Dirty’))

>>> a.program((loc_A, ’Dirty’))

○ Take a snapshot of this. What does the output mean? [10 points]

When the agent perceives a clean location, it moves to the other location (left or right).
When the agent perceives a dirty location, it chooses to clean it by performing the 'Suck'
action. If the location remains dirty, the agent continues to suck.

○ Run the following lines:

>>>e = TrivialVacuumEnvironment()

>>>e.status

>>>e.add_thing(ModelBasedVacuumAgent())

>>>e.run(5)

>>>e.status

○ Take a snapshot of the output and explain it. [10 points]

The code sets up a trivial environment where both locations are initialized to clean.
The code adds a model-based vacuum agent and runs the environment for 5 steps.
The output of e.status before and after running shows that the environment remains
clean.

You might also like