| @@ 488-522 (lines=35) @@ | ||
| 485 | * |
|
| 486 | * @param goal |
|
| 487 | */ |
|
| 488 | private void doComputeUnificationSolutions(Goal goal) { |
|
| 489 | ||
| 490 | // get goal component |
|
| 491 | DomainComponent gComp = goal.getComponent(); |
|
| 492 | // list of goal unifications found |
|
| 493 | List<GoalUnification> unifications = new ArrayList<>(); |
|
| 494 | ||
| 495 | // search active decisions that can be unified with the goal |
|
| 496 | for (Decision unif : gComp.getActiveDecisions()) { |
|
| 497 | ||
| 498 | // check predicate and temporal unification |
|
| 499 | if (this.isPredicateUnificationFeasible(goal.getDecision(), unif) && |
|
| 500 | this.isTemporalUnificationFeasible(goal.getDecision(), unif)) { |
|
| 501 | ||
| 502 | // possible unification found |
|
| 503 | GoalUnification unification = new GoalUnification(goal, unif, this.unificationCost); |
|
| 504 | // add unifications |
|
| 505 | unifications.add(unification); |
|
| 506 | info("Feasible unification found:\n" |
|
| 507 | + "- planning goal: " + goal + "\n" |
|
| 508 | + "- unification decision: " + unification + "\n"); |
|
| 509 | } |
|
| 510 | else { |
|
| 511 | ||
| 512 | // unification not feasible |
|
| 513 | debug("No feasible unification:\n" |
|
| 514 | + "- planning goal: " + goal + "\n" |
|
| 515 | + "- decision : \"" + unif + "\"\n"); |
|
| 516 | } |
|
| 517 | } |
|
| 518 | ||
| 519 | // add unifications as goal solutions |
|
| 520 | Collections.shuffle(unifications); |
|
| 521 | for (GoalUnification unif : unifications) { |
|
| 522 | goal.addSolution(unif); |
|
| 523 | } |
|
| 524 | } |
|
| 525 | ||
| @@ 483-517 (lines=35) @@ | ||
| 480 | * |
|
| 481 | * @param goal |
|
| 482 | */ |
|
| 483 | private void doComputeUnificationSolutions(Goal goal) { |
|
| 484 | ||
| 485 | // get goal component |
|
| 486 | DomainComponent gComp = goal.getComponent(); |
|
| 487 | // list of goal unifications found |
|
| 488 | List<GoalUnification> unifications = new ArrayList<>(); |
|
| 489 | ||
| 490 | // search active decisions that can be unified with the goal |
|
| 491 | for (Decision unif : gComp.getActiveDecisions()) { |
|
| 492 | ||
| 493 | // check predicate and temporal unification |
|
| 494 | if (this.isPredicateUnificationFeasible(goal.getDecision(), unif) && |
|
| 495 | this.isTemporalUnificationFeasible(goal.getDecision(), unif)) { |
|
| 496 | ||
| 497 | // possible unification found |
|
| 498 | GoalUnification unification = new GoalUnification(goal, unif, this.unificationCost); |
|
| 499 | // add unifications |
|
| 500 | unifications.add(unification); |
|
| 501 | info("Feasible unification found:\n" |
|
| 502 | + "- planning goal: " + goal + "\n" |
|
| 503 | + "- unification decision: " + unification + "\n"); |
|
| 504 | } |
|
| 505 | else { |
|
| 506 | ||
| 507 | // unification not feasible |
|
| 508 | debug("No feasible unification:\n" |
|
| 509 | + "- planning goal: " + goal + "\n" |
|
| 510 | + "- decision : \"" + unif + "\"\n"); |
|
| 511 | } |
|
| 512 | } |
|
| 513 | ||
| 514 | // add unifications as goal solutions |
|
| 515 | Collections.shuffle(unifications); |
|
| 516 | for (GoalUnification unif : unifications) { |
|
| 517 | goal.addSolution(unif); |
|
| 518 | } |
|
| 519 | } |
|
| 520 | ||