forked from KCL-Planning/L-RPG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplan_flaws.cpp
51 lines (40 loc) · 1.2 KB
/
plan_flaws.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "plan_flaws.h"
#include "plan.h"
#include "formula.h"
#include "planner.h"
namespace MyPOP {
OpenCondition::OpenCondition(StepPtr step, const Atom& condition)
: step_(step), condition_(&condition)
{
// if (step_->getStepId() > 100)
// {
// assert(false);
// }
}
void OpenCondition::handleFlaw(std::vector<const Plan*>& refinements, Planner& planner, const Plan& plan) const
{
planner.handleOpenCondition(refinements, plan, *this);
}
Unsafe::Unsafe(StepPtr clobberer, const Atom& effect, LinkPtr link)
: clobberer_(clobberer), effect_(&effect), link_(link)
{
}
void Unsafe::handleFlaw(std::vector<const Plan*>& refinements, Planner& planner, const Plan& plan) const
{
planner.handleUnsafe(refinements, plan, *this);
}
std::ostream& operator<<(std::ostream& os, const Unsafe& other)
{
os << "# " << *other.clobberer_ << "{";
os << "} -> {" << (*other.link_) << "}";
return os;
}
Mutex::Mutex(StepPtr step1, const Atom& effect1, StepPtr step2, const Atom& effect2)
: step1_(step1), effect1_(&effect1), step2_(step2), effect2_(&effect2)
{
}
void Mutex::handleFlaw(std::vector<const Plan*>& refinements, Planner& planner, const Plan& plan) const
{
planner.handleMutex(refinements, plan, *this);
}
};