/** * Return the estimated distance to the goal to reach the specified state. If the return value is * <code>Integer.MAX_VALUE</code>, it means that the goal is unreachable from the specified * state. * * @param state the state from which the distance to the goal must be estimated. * @param goal the goal expression. * @return the distance to the goal state from the specified state. * @throws NullPointerException if <code>state == null && goal == null</code>. */ @Override public int estimate(final BitState state, final BitExp goal) { return (int) estimateCost(new Node(state), goal); }
if (node == null) { BitState init = new BitState(problem.getInit()); root = new Node(init, null, 0, 0, heuristic.estimate(init, problem.getGoal())); root.setHeuristic(heuristic.estimate(root, problem.getGoal())); openList.add(root);
Node root = new Node(init, null, 0, 0, heuristic.estimate(init, codedProblem.getGoal())); openList.add(root);
Node root = new Node(init, null, 0, 0, heuristic.estimate(init, codedProblem.getGoal())); openList.add(root);
Node root = new Node(init, null, 0, 0, heuristic.estimate(init, problem.getGoal())); root.setHeuristic(heuristic.estimate(root, problem.getGoal())); restartList.add(root); this.getSolutionNodes().add(new Node(returnedSolution, returnedSolution.getParent(), 0, returnedSolution.getCost(), returnedSolution.getDepth(), returnedSolution.getHeuristic())); bound = returnedSolution.getCost();
nextState.andNot(op.getCondEffects().get(0).getEffects().getNegative()); final Node successor = new Node(nextState); successor.setCost(current.getCost() + op.getCost()); successor.setParent(current);
Node root = new Node(init, null, 0, 0, heuristic.estimate(init, problem.getGoal())); root.setDepth(0); openSet.add(root); this.getSolutionNodes().add(new Node(current, current.getParent(), 0, current.getCost(), current.getDepth(), current.getHeuristic())); solution = current; final Node successor = new Node(nextState); this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(current.getCost() + op.getCost());
final Node root = new Node(init, null, -1, 0.0, 0, heuristic.estimate(init, problem.getGoal())); this.getSolutionNodes().add(new Node(current, current.getParent(), 0, current.getCost(), current.getDepth(), current.getHeuristic())); solution = current; Node state = new Node(current); this.setCreatedNodes(this.getCreatedNodes() + 1);
final Node successor = new Node(nextState); this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(parent.getCost() + op.getCost());
/** * Get the successors from a node. * * @param parent the parent node. * @param problem the coded problem to solve. * @param heuristic the heuristic used. * @return the list of successors from the parent node. */ private LinkedList<Node> getSuccessors(Node parent, CodedProblem problem, Heuristic heuristic) { final LinkedList<Node> successors = new LinkedList<>(); int index = 0; for (BitOp op : problem.getOperators()) { if (op.isApplicable(parent)) { final BitState nextState = new BitState(parent); nextState.or(op.getCondEffects().get(0).getEffects().getPositive()); nextState.andNot(op.getCondEffects().get(0).getEffects().getNegative()); // Apply the effect of the applicable operator final Node successor = new Node(nextState); this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(parent.getCost() + op.getCost()); successor.setHeuristic(heuristic.estimate(successor, problem.getGoal())); successor.setParent(parent); successor.setOperator(index); successor.setDepth(parent.getDepth() + 1); successors.add(successor); } index++; } return successors; }
final Node successor = new Node(nextState); this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(parent.getCost() + op.getCost());