-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
135852b
commit f6e1dc1
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
src/main/java/org/rairlab/planner/heuristics/DeletePrecondRelax.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.rairlab.planner.heuristics; | ||
|
||
import org.rairlab.planner.State; | ||
import org.rairlab.planner.Action; | ||
import org.rairlab.planner.State; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
/* | ||
* IN PROGRESS | ||
* Heuristic that returns the number of actions | ||
* needed to perform to satisfy a goal where | ||
* preconditions and deletes of actions are not | ||
* taken into account. | ||
* | ||
* The difficult part here is how do we deal with effect computation? | ||
* Since normally free variables are instantiated. | ||
* I think in this case, we keep it as free variables. | ||
* (Gotta make sure it's fresh and distinct wrt to the other formulae) | ||
* | ||
* Then for the goal condition check we see if the two | ||
* formulas "unify" with each other... | ||
*/ | ||
public class DeletePrecondRelax { | ||
|
||
private List<Action> actions; | ||
private State goal; | ||
private Map<State, Integer> cache; | ||
private Optional<Integer> bound = Optional.empty(); | ||
|
||
public DeletePrecondRelax(List<Action> actions, State goal) { | ||
this.actions = actions; | ||
this.goal = goal; | ||
this.cache = new HashMap<State, Integer>(); | ||
} | ||
|
||
public int h(State s) { | ||
if (cache.containsKey(s)) { | ||
return cache.get(s); | ||
} | ||
int ch = compute_h(s); | ||
this.cache.put(s, ch); | ||
return ch; | ||
} | ||
|
||
// TODO: Fill in... | ||
public int compute_h(State s) { | ||
return 0; | ||
} | ||
|
||
public Optional<Integer> getBound() { | ||
return bound; | ||
} | ||
|
||
public void setBound(int b) { | ||
bound = Optional.of(b); | ||
} | ||
|
||
public void clearBound() { | ||
bound = Optional.empty(); | ||
} | ||
} |