Skip to content

Commit ef0e219

Browse files
committed
merge main
2 parents 6f29a46 + b0a6f71 commit ef0e219

2 files changed

Lines changed: 48 additions & 7 deletions

File tree

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
A Python wrapper using JuliaPy for the PDDL.jl parser package and implementing its own planners.
1414

15-
# Features
15+
## Features
1616

1717
- Easy to use API for exploring new states
1818
- Depth First Search
@@ -23,7 +23,11 @@ A Python wrapper using JuliaPy for the PDDL.jl parser package and implementing i
2323
- Delete Relaxation Heuristics (Hmax, Hadd)
2424
- Critical Path Heuristic
2525

26-
# Dependencies
26+
## Docker
27+
28+
You can also use the project in a docker container using [docker-pythonpddl](https://github.com/APLA-Toolbox/docker-pythonpddl)
29+
30+
## Dependencies
2731

2832
- Install Python (3.7.5 is the tested version)
2933

@@ -68,7 +72,7 @@ $ python ipc.py "path_to_domain.pddl" "path_to_problem.pddl" "path_to_desired_ou
6872
6973
The output file will show the path with a list of state, the path with a list of action and the metrics proposed by IPC2018.
7074
71-
# Library Usage
75+
## Library Usage
7276
7377
If using the jupyddl pip package:
7478
@@ -85,7 +89,7 @@ $ git submodule update --init
8589
8690
You should have a `pddl-examples` folder containing PDDL instances.
8791
88-
## [AutomatedPlanner]
92+
### [AutomatedPlanner]
8993
9094
```python
9195
from jupyddl import AutomatedPlanner # takes some time because it has to instantiate the Julia interface
@@ -115,7 +119,7 @@ print(apl.get_actions_from_path(path))
115119
[<PyCall.jlwrap flip_row(r1)>, <PyCall.jlwrap flip_row(r3)>, <PyCall.jlwrap flip_column(c2)>]
116120
```
117121
118-
## [Data Analyst]
122+
### [Data Analyst]
119123
120124
Make sure you have a pddl-examples folder where you run your environment that contains independent folders with "domain.pddl" and "problem.pddl" files, with those standard names. ( if you didn't generate with git submodule update )
121125
@@ -142,11 +146,11 @@ da.comparative_data_plot(collect_new_data=False) # uses data.json to plot the da
142146
da.comparative_astar_heuristic_plot() # compare results of astar with all available heuristics
143147
```
144148
145-
# Contribute
149+
## Contribute
146150
147151
Open an issue to state clearly the contribution you want to make. Upon aproval send in a PR with the Issue referenced. (Implement Issue #No / Fix Issue #No).
148152
149-
# Maintainers
153+
## Maintainers
150154
151155
- Erwin Lejeune
152156
- Sampreet Sarkar

jupyddl/heuristics.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ def __facts_eq(self, facts_dict, facts_set):
127127
return False
128128
return True
129129

130+
<<<<<<< HEAD
131+
=======
132+
133+
>>>>>>> b0a6f7114bd56e8d05402ea32199a4ae7bd498bd
130134
class CriticalPathHeuristic:
131135
def __init__(self, automated_planner, critical_path_level=1):
132136
class CPCache:
@@ -170,6 +174,7 @@ def compute(self, state):
170174
if str(g) in fact_costs_str:
171175
costs.append(fact_costs_str[str(g)])
172176
if self.critical_path_level == 2:
177+
<<<<<<< HEAD
173178
pairs_of_goals = [(g1, g2) for g1 in goals for g2 in goals if g1 != g2]
174179
for gs in pairs_of_goals:
175180
if str(gs[0]) in fact_costs_str and str(gs[1]) in fact_costs_str:
@@ -179,6 +184,38 @@ def compute(self, state):
179184
for gs in triplets_of_goals:
180185
if str(gs[0]) in fact_costs_str and str(gs[1]) in fact_costs_str and str(gs[2]) in fact_costs_str:
181186
costs.append(fact_costs_str[str(gs[0])] + fact_costs_str[str(gs[1])] + fact_costs_str[str(gs[2])])
187+
=======
188+
pairs_of_goals = [
189+
(g1, g2) for g1 in goals for g2 in goals if g1 != g2
190+
]
191+
for gs in pairs_of_goals:
192+
if (
193+
str(gs[0]) in fact_costs_str
194+
and str(gs[1]) in fact_costs_str
195+
):
196+
costs.append(
197+
fact_costs_str[str(gs[0])] + fact_costs_str[str(gs[1])]
198+
)
199+
if self.critical_path_level == 3:
200+
triplets_of_goals = [
201+
(g1, g2, g3)
202+
for g1 in goals
203+
for g2 in goals
204+
for g3 in goals
205+
if g1 != g2 and g1 != g3 and g2 != g3
206+
]
207+
for gs in triplets_of_goals:
208+
if (
209+
str(gs[0]) in fact_costs_str
210+
and str(gs[1]) in fact_costs_str
211+
and str(gs[2]) in fact_costs_str
212+
):
213+
costs.append(
214+
fact_costs_str[str(gs[0])]
215+
+ fact_costs_str[str(gs[1])]
216+
+ fact_costs_str[str(gs[2])]
217+
)
218+
>>>>>>> b0a6f7114bd56e8d05402ea32199a4ae7bd498bd
182219
costs.insert(0, 0)
183220
return max(costs)
184221

0 commit comments

Comments
 (0)