Skip to content

Commit

Permalink
add r_til_c generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Timisorean authored and drexlerd committed Jul 30, 2024
1 parent c95a832 commit 1d60a5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
41 changes: 11 additions & 30 deletions src/generator/rules/roles/til_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,18 @@

namespace dlplan::generator::rules {
void TilCRole::generate_impl(const core::States& states, int target_complexity, GeneratorData& data, core::DenotationsCaches& caches) {
return;
//TODO
if (target_complexity == 3)
{
if (target_complexity == 3) {
core::SyntacticElementFactory& factory = data.m_factory;
for (int i = 1; i < target_complexity - 1; ++i)
{
int j = target_complexity - i - 1;
for (const auto& r1 : data.m_roles_by_iteration[i])
{
auto r1_primitive_role = std::dynamic_pointer_cast<const core::PrimitiveRole>(r1);
if (r1_primitive_role)
{
std::string r1_predicate_name = r1_primitive_role->get_predicate().get_name();
for (const auto& r2 : data.m_roles_by_iteration[j])
{
auto r2_primitive_role = std::dynamic_pointer_cast<const core::PrimitiveRole>(r2);
if (r2_primitive_role)
{
std::string r2_predicate_name = r2_primitive_role->get_predicate().get_name();
if ((r1_predicate_name) == r2_predicate_name + "_g") {
auto element = factory.make_and_role(r1, r2);
auto denotations = element->evaluate(states, caches);
if (data.m_role_hash_table.insert(denotations).second)
{
std::get<3>(data.m_generated_features).push_back(element);
data.m_roles_by_iteration[target_complexity].push_back(std::move(element));
increment_generated();
}
}
}
for (int i = 1; i < target_complexity - 1; ++i) {
int j = target_complexity - i - 1 ;
for (const auto& r : data.m_roles_by_iteration[i]) {
for (const auto& c : data.m_concepts_by_iteration[j]) {
auto element = factory.make_til_c_role(r, c);
auto denotations = element->evaluate(states, caches);
if (data.m_role_hash_table.insert(denotations).second) {
std::get<3>(data.m_generated_features).push_back(element);
data.m_roles_by_iteration[target_complexity].push_back(std::move(element));
increment_generated();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/generator/delivery/delivery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ TEST(DLPTests, GeneratorDeliveryTest) {
feature_generator.set_generate_not_role(false);
feature_generator.set_generate_or_role(false);
feature_generator.set_generate_top_role(false);
feature_generator.set_generate_til_c_role(false);
feature_generator.set_generate_transitive_reflexive_closure_role(false);
SyntacticElementFactory syntactic_element_factory(vocabulary_info);
States states;
Expand Down

0 comments on commit 1d60a5a

Please sign in to comment.