FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fixed grabbing behaviour in agent by omar-3 · Pull Request #1148 · aimacode/aima-python · GitHub

fixed grabbing behaviour in agent - #1148

Merged
antmarakis merged 5 commits into
aimacode:masterfrom
omar-3:fix-grab-agent
Mar 18, 2020
Merged

antmarakis merged 5 commits into
aimacode:masterfrom
omar-3:fix-grab-agent

Conversation

omar-3 commented Jan 7, 2020

Copy link
Copy Markdown
Contributor

When a thing is grabbed, it would be hidden from the environment. When released or the agent is removed it would be added to environment again at the same location of the agent. For the issue of grabbed thing movement, it is already implemented. No test has failed.

Have I missed something?

tirthasheshpatel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks! I have suggested a couple of improvements. Can you please review them?

Comment thread agents.py Outdated
elif action == 'Grab':
things = [thing for thing in self.list_things_at(agent.location)]
if agent.can_grab(things[0]):
if things:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This line if things should be on the top otherwise things[0] (accessed in the line above) would raise an exception!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

yes that is true

Comment thread agents.py Outdated
# for obj in thing.holding:
# super().delete_thing(obj)
# for obs in self.observers:
# obs.thing_deleted(obj)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't see a reason to comment these lines out. Even though the second line is redundant, the observers of the environment still need to be informed about each thing being deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if we delete all of the agent holdings with del thing.holding, and thanks to python memory management. All instants of the agent's holding would vanish from memory even in the observer list. Tell me what you think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The observers of the environment need to be updated about all the things getting deleted along with the agent. I have not seen observers used anywhere, so it depends upon the maintainers of the project to keep or exclude it!

Copy link
Copy Markdown
Contributor

I think this will also need some tests to be added

omar-3 commented Jan 7, 2020

Copy link
Copy Markdown
Contributor Author

I think this will also need some tests to be added

Ahh I realized that after making the pull request, the tests would be easy I guess.

omar-3 commented Jan 7, 2020 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

could anyone help me understand why the checks have failed? It fails for python3.4 only

Copy link
Copy Markdown
Contributor

could anyone help me understand why the checks have failed? It fails for python3.4 only

It has nothing to do with the pr. Just close and reopen and the tests will hopefully pass...

omar-3 closed this Jan 7, 2020
omar-3 reopened this Jan 7, 2020
omar-3 closed this Jan 7, 2020
omar-3 reopened this Jan 7, 2020

tirthasheshpatel commented Jan 7, 2020 •
edited
Loading

Copy link
Copy Markdown
Contributor

Turns out pyyaml has removed support for python 3.4. This is a issue for keras. We don't need to worry about it.

Copy link
Copy Markdown
Contributor

Here's the upstream issue on keras. gh-13674

omar-3 commented Jan 7, 2020

Copy link
Copy Markdown
Contributor Author

I guess it is better if I open an issue.

Copy link
Copy Markdown
Contributor

@Okhaledzaki I don't think this is our issue but I will leave it upto the maintainers to decide!

This was referenced Jan 8, 2020
omar-3 requested a review from antmarakis February 7, 2020 07:03
Comment thread agents.py Outdated
@@ -967,21 +967,16 @@ def execute_action(self, agent, action):

agent.bump = False
if action == 'TurnRight':

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think the if statement could be streamlined if we rewrote it as:

if action in ['TurnRight', 'TurnLeft', 'Forward']:
            super().execute_action(agent,action)
            agent.performance -= 1
elif action == 'Grab':
            super().execute_action(agent,action)

I think the above looks a bit better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I had that in mind, but I thought to myself that being more articulate and reasonably redundant in code would help the student retaining the information that is my case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

But actually seeing it, it really didn't help much.

omar-3 requested a review from antmarakis February 18, 2020 20:30

antmarakis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Some minor typos.

Comment thread agents.py Outdated
super().execute_action(agent,action)
agent.performance -= 1
elif action == 'Grab':
if action in ['TurnRight', 'TurnLeft', 'Forward','Grab']:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A space is needed after the last comma.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

done

omar-3 requested a review from antmarakis February 20, 2020 20:28
antmarakis closed this Feb 21, 2020
antmarakis reopened this Feb 21, 2020

omar-3 commented Feb 21, 2020 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

something has broken in the deeplearning module @antmarakis :"D

antmarakis closed this Feb 23, 2020
antmarakis reopened this Feb 23, 2020
omar-3 closed this Feb 24, 2020
omar-3 reopened this Feb 24, 2020
omar-3 closed this Feb 24, 2020
omar-3 reopened this Feb 24, 2020

omar-3 commented Feb 27, 2020

Copy link
Copy Markdown
Contributor Author

@antmarakis The tests have all passed finally phew

Comment thread agents.py Outdated
if len(things):
agent.holding.append(things[0])
if action in ['TurnRight', 'TurnLeft', 'Forward', 'Grab']:
super().execute_action(agent,action)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You need a space after the comma, to comply with the overall project style.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

done

omar-3 requested a review from antmarakis March 6, 2020 17:52
antmarakis merged commit f502be9 into aimacode:master Mar 18, 2020
omar-3 deleted the fix-grab-agent branch April 21, 2020 18:44
dj5x5 pushed a commit to dj5x5/aima-python that referenced this pull request Jul 17, 2025
* fixed grabbing behaviour in agent

* fixed the grabbing issues and itegrated into wumpus environment

* cleaned the code a bit

* fixing the code space formatting

* fixing format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL