Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Minor modifications in planning_angelic_search.ipynb and knowledge_FOIL.ipynb notebooks #949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Here is a table of algorithms, the figure, name of the algorithm in the book and
| 19.2 | Current-Best-Learning | `current_best_learning` | [`knowledge.py`](knowledge.py) | Done | Included |
| 19.3 | Version-Space-Learning | `version_space_learning` | [`knowledge.py`](knowledge.py) | Done | Included |
| 19.8 | Minimal-Consistent-Det | `minimal_consistent_det` | [`knowledge.py`](knowledge.py) | Done | Included |
| 19.12 | FOIL | `FOIL_container` | [`knowledge.py`](knowledge.py) | Done | |
| 19.12 | FOIL | `FOIL_container` | [`knowledge.py`](knowledge.py) | Done | Included |
| 21.2 | Passive-ADP-Agent | `PassiveADPAgent` | [`rl.py`][rl] | Done | Included |
| 21.4 | Passive-TD-Agent | `PassiveTDAgent` | [`rl.py`][rl] | Done | Included |
| 21.8 | Q-Learning-Agent | `QLearningAgent` | [`rl.py`][rl] | Done | Included |
Expand Down
4 changes: 2 additions & 2 deletions knowledge_FOIL.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The algorithm produced almost the recursive rule: \n",
"The algorithm produced something close to the recursive rule: \n",
" $$ Reach(x,y) \\Leftrightarrow [Conn(x,y)] \\: \\lor \\: [\\exists \\: z \\: \\: Reach(x,z) \\, \\land \\, Reach(z,y)]$$\n",
" \n",
"This is because the size of the example is small. "
"This happened because the size of the example is small. "
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ def simple_blocks_world_graphplan():
return GraphPlan(simple_blocks_world()).execute()



class HLA(Action):
"""
Define Actions for the real-world (that may be refined further), and satisfy resource
Expand Down Expand Up @@ -1363,9 +1364,8 @@ def angelic_search(problem, hierarchy, initialPlan):
guaranteed = problem.intersects_goal(pes_reachable_set)
if guaranteed and Problem.making_progress(plan, initialPlan):
final_state = guaranteed[0] # any element of guaranteed
#print('decompose')
return Problem.decompose(hierarchy, problem, plan, final_state, pes_reachable_set)
(hla, index) = Problem.find_hla(plan, hierarchy) # there should be at least one HLA/Angelic_HLA, otherwise plan would be primitive.
hla, index = Problem.find_hla(plan, hierarchy) # there should be at least one HLA/Angelic_HLA, otherwise plan would be primitive.
Copy link
Contributor

Choose a reason for hiding this comment

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

Good.

prefix = plan.action[:index]
suffix = plan.action[index+1:]
outcome = Problem(Problem.result(problem.init, prefix), problem.goals , problem.actions )
Expand Down Expand Up @@ -1442,8 +1442,8 @@ def find_hla(plan, hierarchy):
hla = plan.action[i]
index = i
break
return (hla, index)
return hla, index

def making_progress(plan, initialPlan):
"""
Prevents from infinite regression of refinements
Expand Down
3 changes: 1 addition & 2 deletions planning_angelic_search.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"- problem is of type Problem \n",
"- hierarchy is a dictionary consisting of all the actions. \n",
"- initialPlan is an approximate description(optimistic and pessimistic) of the agents choices for the implementation. <br>\n",
" It is a nested list, containing sequence a of actions with their optimistic and pessimistic\n",
" description "
" initialPlan contains a sequence of HLA's with angelic semantics"
]
},
{
Expand Down