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); } else {
root.setHeuristic(heuristic.estimate(root, problem.getGoal())); restartList.add(root); Node solution = null;
this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(current.getCost() + op.getCost()); successor.setHeuristic(0); successor.setParent(current); successor.setOperator(index);
this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(current.getCost() + op.getCost()); successor.setHeuristic(0); successor.setParent(current); successor.setOperator(index);
state.setParent(current); state.setOperator(index); state.setHeuristic(heuristic.estimate(state, codedProblem.getGoal())); state.setDepth(current.getDepth() + 1); open.add(state);
this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(current.getCost() + op.getCost()); successor.setHeuristic(heuristic.estimate(nextState, codedProblem.getGoal())); successor.setParent(current); successor.setOperator(index);
this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(parent.getCost() + op.getCost()); successor.setHeuristic(heuristic.estimate(nextState, problem.getGoal())); successor.setParent(parent); successor.setOperator(index);
this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(parent.getCost() + op.getCost()); successor.setHeuristic(heuristic.estimate(nextState, problem.getGoal())); successor.setParent(parent); successor.setOperator(index);
/** * 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; }
state.setParent(current); state.setOperator(index); state.setHeuristic(heuristic.estimate(state, problem.getGoal())); state.setDepth(current.getDepth() + 1); if (state.getCost() < boundCost && state.getDepth() <= boundDepth) {
this.setCreatedNodes(this.getCreatedNodes() + 1); successor.setCost(current.getCost() + op.getCost()); successor.setHeuristic(heuristic.estimate(nextState, problem.getGoal())); successor.setParent(current); successor.setOperator(index);