From 709bed99f5092f76a7ff98a8edc89d739314d3ef Mon Sep 17 00:00:00 2001 From: Marianna Date: Sun, 12 Aug 2018 15:05:45 +0300 Subject: [PATCH 1/2] Minor modifications in planning_angelic_search.ipynb and knowledge_FOIL.ipynb notebooks --- README.md | 2 +- knowledge_FOIL.ipynb | 4 ++-- planning.py | 8 ++++---- planning_angelic_search.ipynb | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e6aa572b6..378d24b2d 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/knowledge_FOIL.ipynb b/knowledge_FOIL.ipynb index 3755f33f5..e06f5abf1 100644 --- a/knowledge_FOIL.ipynb +++ b/knowledge_FOIL.ipynb @@ -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. " ] } ], diff --git a/planning.py b/planning.py index cb2f53307..dfd1a1139 100644 --- a/planning.py +++ b/planning.py @@ -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 @@ -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. prefix = plan.action[:index] suffix = plan.action[index+1:] outcome = Problem(Problem.result(problem.init, prefix), problem.goals , problem.actions ) @@ -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 diff --git a/planning_angelic_search.ipynb b/planning_angelic_search.ipynb index 7d42fbae3..71408e1d9 100644 --- a/planning_angelic_search.ipynb +++ b/planning_angelic_search.ipynb @@ -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.
\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" ] }, { From b46685676cac7619121f648101c0eaabb149e7c1 Mon Sep 17 00:00:00 2001 From: Marianna Date: Sun, 12 Aug 2018 19:36:50 +0300 Subject: [PATCH 2/2] Syntac correction in planning.py --- planning.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planning.py b/planning.py index dfd1a1139..0eda86d3b 100644 --- a/planning.py +++ b/planning.py @@ -1144,7 +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