Implemented translation of PDDL domain constants.
This commit is contained in:
parent
458dbd723c
commit
0513b3aa0c
@ -35,11 +35,12 @@ void TranslatorASP::translateDomain(std::ostream &ostream) const
|
||||
ostream
|
||||
<< "%---------------------------------------" << std::endl
|
||||
<< "% domain" << std::endl
|
||||
<< "%---------------------------------------" << std::endl << std::endl;
|
||||
<< "%---------------------------------------" << std::endl;
|
||||
|
||||
const auto &domain = m_description.domain();
|
||||
|
||||
// Types
|
||||
ostream << std::endl;
|
||||
ostream << "% types";
|
||||
|
||||
const auto &types = domain.types();
|
||||
@ -59,6 +60,27 @@ void TranslatorASP::translateDomain(std::ostream &ostream) const
|
||||
ostream << "inherits(type(" << type->name() << "), type(" << parentType->name() << "))." << std::endl;
|
||||
});
|
||||
});
|
||||
|
||||
// Constants
|
||||
ostream << std::endl;
|
||||
ostream << "% constants";
|
||||
|
||||
const auto &constants = domain.constants();
|
||||
|
||||
std::for_each(constants.cbegin(), constants.cend(),
|
||||
[&](const auto &constant)
|
||||
{
|
||||
ostream << std::endl;
|
||||
|
||||
ostream << "constant(" << constant->name() << ")." << std::endl;
|
||||
|
||||
const auto *type = constant->type();
|
||||
|
||||
if (type == nullptr)
|
||||
return;
|
||||
|
||||
ostream << "hasType(constant(" << constant->name() << "), type(" << type->name() << "))." << std::endl;
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -68,7 +90,7 @@ void TranslatorASP::translateProblem(std::ostream &ostream) const
|
||||
ostream << std::endl
|
||||
<< "%---------------------------------------" << std::endl
|
||||
<< "% problem" << std::endl
|
||||
<< "%---------------------------------------" << std::endl << std::endl;
|
||||
<< "%---------------------------------------" << std::endl;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user