Skip to content

Commit

Permalink
update bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Nov 13, 2024
1 parent 405380b commit 1b3328f
Show file tree
Hide file tree
Showing 25 changed files with 132 additions and 195 deletions.
42 changes: 7 additions & 35 deletions include/mimir/search/action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ struct StripsActionPrecondition
FlatBitset m_positive_derived_atoms = FlatBitset();
FlatBitset m_negative_derived_atoms = FlatBitset();

auto cista_members()
{
return std::tie(m_positive_static_atoms,
m_negative_static_atoms,
m_positive_fluent_atoms,
m_negative_fluent_atoms,
m_positive_derived_atoms,
m_negative_derived_atoms);
}

template<PredicateCategory P>
FlatBitset& get_positive_precondition();

Expand Down Expand Up @@ -82,8 +72,6 @@ struct StripsActionEffect
FlatBitset m_positive_effects = FlatBitset();
FlatBitset m_negative_effects = FlatBitset();

auto cista_members() { return std::tie(m_positive_effects, m_negative_effects); }

FlatBitset& get_positive_effects();

const FlatBitset& get_positive_effects() const;
Expand All @@ -93,9 +81,9 @@ struct StripsActionEffect
const FlatBitset& get_negative_effects() const;
};

/// @brief `SimpleEffect` encapsulates the effect on a single grounded atom.
/// @brief `SimpleFluentEffect` encapsulates the effect on a single grounded atom.
/// We cannot consistently use cista::tuple since nested tuples will automatically be flattened.
struct SimpleEffect
struct SimpleFluentEffect
{
bool is_negated = false;
Index atom_index = Index(0);
Expand All @@ -109,18 +97,7 @@ struct ConditionalEffect
FlatIndexList m_negative_fluent_atoms = FlatIndexList();
FlatIndexList m_positive_derived_atoms = FlatIndexList();
FlatIndexList m_negative_derived_atoms = FlatIndexList();
SimpleEffect m_effect = SimpleEffect();

auto cista_members()
{
return std::tie(m_positive_static_atoms,
m_negative_static_atoms,
m_positive_fluent_atoms,
m_negative_fluent_atoms,
m_positive_derived_atoms,
m_negative_derived_atoms,
m_effect);
}
SimpleFluentEffect m_effect = SimpleFluentEffect();

/* Precondition */

Expand All @@ -137,9 +114,9 @@ struct ConditionalEffect
const FlatIndexList& get_negative_precondition() const;

/* Simple effects */
SimpleEffect& get_simple_effect();
SimpleFluentEffect& get_simple_effect();

const SimpleEffect& get_simple_effect() const;
const SimpleFluentEffect& get_simple_effect() const;

template<DynamicPredicateCategory P>
bool is_applicable(State state) const;
Expand Down Expand Up @@ -168,8 +145,6 @@ struct GroundActionImpl
StripsActionEffect m_strips_effect = StripsActionEffect();
ConditionalEffects m_conditional_effects = ConditionalEffects();

auto cista_members() { return std::tie(m_index, m_action_index, m_cost, m_objects, m_strips_precondition, m_strips_effect, m_conditional_effects); }

Index& get_index();
Index& get_action_index();
ContinuousCost& get_cost();
Expand Down Expand Up @@ -219,17 +194,14 @@ namespace mimir
* Mimir types
*/

using FlatActionSet = cista::storage::UnorderedSet<GroundActionImpl>;

using GroundActionList = std::vector<GroundAction>;
using GroundActionSet = std::unordered_set<GroundAction>;
using GroundActionImplSet = cista::storage::UnorderedSet<GroundActionImpl>;

/**
* Pretty printing
*/

template<>
std::ostream& operator<<(std::ostream& os, const std::tuple<SimpleEffect, const PDDLFactories&>& data);
std::ostream& operator<<(std::ostream& os, const std::tuple<SimpleFluentEffect, const PDDLFactories&>& data);

template<>
std::ostream& operator<<(std::ostream& os, const std::tuple<StripsActionPrecondition, const PDDLFactories&>& data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "mimir/search/applicable_action_generators/grounded/match_tree.hpp"
#include "mimir/search/applicable_action_generators/interface.hpp"
#include "mimir/search/applicable_action_generators/lifted.hpp"
#include "mimir/search/declarations.hpp"

#include <variant>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#define MIMIR_SEARCH_APPLICABLE_ACTION_GENERATORS_INTERFACE_HPP_

#include "mimir/formalism/declarations.hpp"
#include "mimir/search/action.hpp"
#include "mimir/search/axiom.hpp"
#include "mimir/search/state.hpp"
#include "mimir/search/declarations.hpp"

namespace mimir
{
Expand Down
9 changes: 4 additions & 5 deletions include/mimir/search/applicable_action_generators/lifted.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
#ifndef MIMIR_SEARCH_APPLICABLE_ACTION_GENERATORS_LIFTED_HPP_
#define MIMIR_SEARCH_APPLICABLE_ACTION_GENERATORS_LIFTED_HPP_

#include "mimir/formalism/action.hpp"
#include "mimir/search/action.hpp"
#include "mimir/formalism/declarations.hpp"
#include "mimir/formalism/grounding_table.hpp"
#include "mimir/search/applicable_action_generators/interface.hpp"
#include "mimir/search/applicable_action_generators/lifted/axiom_evaluator.hpp"
#include "mimir/search/applicable_action_generators/lifted/consistency_graph.hpp"
#include "mimir/search/applicable_action_generators/lifted/event_handlers.hpp"
#include "mimir/search/axiom.hpp"
#include "mimir/search/condition_grounders.hpp"
#include "mimir/search/state.hpp"
#include "mimir/search/declarations.hpp"

#include <unordered_map>
#include <vector>
Expand All @@ -52,7 +51,7 @@ class LiftedApplicableActionGenerator : public IApplicableActionGenerator
std::unordered_map<Action, ConditionGrounder> m_action_precondition_grounders;
std::unordered_map<Action, std::vector<consistency_graph::StaticConsistencyGraph>> m_action_complex_effects;

FlatActionSet m_flat_actions;
GroundActionImplSet m_flat_actions;
GroundActionList m_actions_by_index;
GroundActionImpl m_action_builder;
std::unordered_map<Action, GroundingTable<GroundAction>> m_action_groundings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
#include "mimir/common/printers.hpp"
#include "mimir/common/types_cista.hpp"
#include "mimir/formalism/declarations.hpp"
#include "mimir/formalism/grounding_table.hpp"
#include "mimir/formalism/predicate_category.hpp"
#include "mimir/formalism/problem.hpp"
#include "mimir/search/applicable_action_generators/lifted/assignment_set.hpp"
#include "mimir/search/applicable_action_generators/lifted/axiom_stratification.hpp"
#include "mimir/search/applicable_action_generators/lifted/consistency_graph.hpp"
#include "mimir/search/applicable_action_generators/lifted/event_handlers.hpp"
#include "mimir/search/axiom.hpp"
#include "mimir/search/condition_grounders.hpp"
#include "mimir/search/state.hpp"
#include "mimir/search/declarations.hpp"

#include <stdexcept>
#include <unordered_map>
Expand All @@ -47,7 +46,7 @@ class AxiomEvaluator

std::vector<AxiomPartition> m_partitioning;

FlatAxiomSet m_flat_axioms;
GroundAxiomImplSet m_flat_axioms;
GroundAxiomList m_axioms_by_index;
GroundAxiomImpl m_axiom_builder;
std::unordered_map<Axiom, GroundingTable<GroundAxiom>> m_axiom_groundings;
Expand Down
9 changes: 2 additions & 7 deletions include/mimir/search/axiom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ struct GroundAxiomImpl
StripsActionPrecondition m_strips_precondition = StripsActionPrecondition();
SimpleDerivedEffect m_effect = SimpleDerivedEffect();

auto cista_members() { return std::tie(m_index, m_axiom_index, m_objects, m_strips_precondition, m_effect); }

Index& get_index();
Index get_index() const;

Expand All @@ -67,7 +65,7 @@ struct GroundAxiomImpl
SimpleDerivedEffect& get_derived_effect();
const SimpleDerivedEffect& get_derived_effect() const;

// TODO: pass state instead of separated fluent and derived atoms
// TODO: pass state instead of separated fluent and derived atoms?
bool is_applicable(const FlatBitset& state_fluent_atoms, const FlatBitset& state_derived_atoms, const FlatBitset& static_positive_atoms) const;

bool is_statically_applicable(const FlatBitset& static_positive_bitset) const;
Expand Down Expand Up @@ -96,10 +94,7 @@ namespace mimir
* Mimir types
*/

using FlatAxiomSet = cista::storage::UnorderedSet<GroundAxiomImpl>;

using GroundAxiomList = std::vector<GroundAxiom>;
using GroundAxiomSet = std::unordered_set<GroundAxiom>;
using GroundAxiomImplSet = cista::storage::UnorderedSet<GroundAxiomImpl>;

/**
* Pretty printing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "mimir/search/condition_grounders.hpp"
#include "mimir/search/declarations.hpp"
#include "mimir/search/state.hpp"

#include <memory>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#ifndef MIMIR_SEARCH_CONDITION_GROUNDERS_EVENT_HANDLERS_DEFAULT_HPP_
#define MIMIR_SEARCH_CONDITION_GROUNDERS_EVENT_HANDLERS_DEFAULT_HPP_

#include "mimir/formalism/factories.hpp"
#include "mimir/formalism/object.hpp"
#include "mimir/formalism/declarations.hpp"
#include "mimir/search/condition_grounders/event_handlers/interface.hpp"

namespace mimir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#ifndef MIMIR_SEARCH_CONDITION_GROUNDERS_EVENT_HANDLERS_INTERFACE_HPP_
#define MIMIR_SEARCH_CONDITION_GROUNDERS_EVENT_HANDLERS_INTERFACE_HPP_

#include "mimir/formalism/factories.hpp"
#include "mimir/formalism/object.hpp"
#include "mimir/formalism/declarations.hpp"

namespace mimir
{
Expand Down
8 changes: 8 additions & 0 deletions include/mimir/search/declarations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,22 @@ class StateRepository;
// GroundACtion
struct GroundActionImpl;
using GroundAction = const GroundActionImpl*;
using GroundActionList = std::vector<GroundAction>;
using GroundActionSet = std::unordered_set<GroundAction>;

// Axiom
struct GroundAxiomImpl;
using GroundAxiom = const GroundAxiomImpl*;
using GroundAxiomList = std::vector<GroundAxiom>;
using GroundAxiomSet = std::unordered_set<GroundAxiom>;

// State
struct StateImpl;
using State = const StateImpl*;
using StateList = std::vector<State>;
using StateSet = std::unordered_set<State>;
template<typename T>
using StateMap = std::unordered_map<State, T>;

/* ApplicableActionGenerators */
class IApplicableActionGenerator;
Expand Down
1 change: 1 addition & 0 deletions include/mimir/search/heuristics/blind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifndef MIMIR_SEARCH_HEURISTICS_BLIND_HPP_
#define MIMIR_SEARCH_HEURISTICS_BLIND_HPP_

#include "mimir/search/declarations.hpp"
#include "mimir/search/heuristics/interface.hpp"

namespace mimir
Expand Down
1 change: 1 addition & 0 deletions include/mimir/search/heuristics/hstar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifndef MIMIR_SEARCH_HEURISTICS_HSTAR_HPP_
#define MIMIR_SEARCH_HEURISTICS_HSTAR_HPP_

#include "mimir/formalism/declarations.hpp"
#include "mimir/search/declarations.hpp"
#include "mimir/search/heuristics/interface.hpp"

Expand Down
2 changes: 1 addition & 1 deletion include/mimir/search/heuristics/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef MIMIR_SEARCH_HEURISTICS_INTERFACE_HPP_
#define MIMIR_SEARCH_HEURISTICS_INTERFACE_HPP_

#include "mimir/search/state.hpp"
#include "mimir/search/declarations.hpp"

namespace mimir
{
Expand Down
3 changes: 2 additions & 1 deletion include/mimir/search/plan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#ifndef MIMIR_SEARCH_PLAN_HPP_
#define MIMIR_SEARCH_PLAN_HPP_

#include "mimir/search/action.hpp"
#include "mimir/formalism/declarations.hpp"
#include "mimir/search/declarations.hpp"

#include <cstdint>
#include <ostream>
Expand Down
6 changes: 0 additions & 6 deletions include/mimir/search/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ namespace mimir

using StateImplSet = cista::storage::UnorderedSet<StateImpl>;

using StateList = std::vector<State>;

template<typename T>
using StateMap = std::unordered_map<State, T>;
using StateSet = std::unordered_set<State>;

/**
* Pretty printing
*/
Expand Down
1 change: 0 additions & 1 deletion include/mimir/search/state_repository.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "mimir/common/types_cista.hpp"
#include "mimir/formalism/declarations.hpp"
#include "mimir/search/action.hpp"
#include "mimir/search/applicable_action_generators/interface.hpp"
#include "mimir/search/declarations.hpp"
#include "mimir/search/state.hpp"
Expand Down
2 changes: 1 addition & 1 deletion python/src/pymimir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
DefaultIWAlgorithmEventHandler,
DefaultLiftedApplicableActionGeneratorEventHandler,
DefaultSIWAlgorithmEventHandler,
FlatSimpleEffect,
SimpleFluentEffect,
GroundAction,
GroundActionList,
GroundActionSpan,
Expand Down
Loading

0 comments on commit 1b3328f

Please sign in to comment.