AIToolbox
A library that offers tools for AI problem solving.
MultiObjectiveVariableElimination.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_FACTORED_BANDIT_MULTI_OBJECTIVE_VARIABLE_ELIMINATION_HEADER_FILE
2 #define AI_TOOLBOX_FACTORED_BANDIT_MULTI_OBJECTIVE_VARIABLE_ELIMINATION_HEADER_FILE
3 
6 
43  public:
44  struct Entry {
47  };
48  using Factor = std::vector<Entry>;
49 
51  using Results = Factor;
52 
61  template <typename Iterable>
62  Results operator()(const Action & A, const Iterable & inputRules) {
63  GVE::Graph graph(A.size());
64 
65  for (const auto & rule : inputRules) {
66  auto & factorNode = graph.getFactor(rule.action.first)->getData();
67  const auto id = toIndexPartial(A, rule.action);
68 
69  const auto it = std::lower_bound(
70  std::begin(factorNode),
71  std::end(factorNode),
72  id,
73  [](const auto & rule, size_t rhs) {return rule.first < rhs;}
74  );
75 
76  if (it != std::end(factorNode) && it->first == id)
77  it->second[0].vals += rule.values;
78  else
79  factorNode.emplace(it, id, Factor{{rule.values, PartialAction()}});
80  }
81 
82  return (*this)(A, graph);
83  }
84 
106  Results operator()(const Action & A, GVE::Graph & graph);
107  };
108 }
109 
110 #endif
GenericVariableElimination.hpp
Types.hpp
AIToolbox::Factored::Rewards
Vector Rewards
Definition: Types.hpp:71
AIToolbox::Factored::Bandit::MultiObjectiveVariableElimination::Entry::vals
Rewards vals
Definition: MultiObjectiveVariableElimination.hpp:45
AIToolbox::Factored::Bandit::MultiObjectiveVariableElimination
This class represents the Multi Objective Variable Elimination process.
Definition: MultiObjectiveVariableElimination.hpp:42
AIToolbox::Factored::toIndexPartial
size_t toIndexPartial(const PartialKeys &ids, const Factors &space, const Factors &f)
This function converts the input factor in the input space to an unique index.
AIToolbox::Factored::Bandit::MultiObjectiveVariableElimination::Entry
Definition: MultiObjectiveVariableElimination.hpp:44
AIToolbox::Factored::Bandit::MultiObjectiveVariableElimination::Results
Factor Results
Definition: MultiObjectiveVariableElimination.hpp:51
AIToolbox::Factored::FactorGraph
This class offers a minimal interface to manager a factor graph.
Definition: FactorGraph.hpp:31
AIToolbox::Factored::PartialAction
PartialFactors PartialAction
Definition: Types.hpp:70
AIToolbox::Factored::GenericVariableElimination
This class represents the Variable Elimination algorithm.
Definition: GenericVariableElimination.hpp:72
AIToolbox::Factored::FactorGraph::getFactor
FactorIt getFactor(const Variables &variables)
This function returns an iterator to a factor adjacent to the given variables.
Definition: FactorGraph.hpp:355
AIToolbox::Factored::Bandit::MultiObjectiveVariableElimination::Factor
std::vector< Entry > Factor
Definition: MultiObjectiveVariableElimination.hpp:48
AIToolbox::Factored::GenericVariableElimination::Graph
FactorGraph< Rules > Graph
Definition: GenericVariableElimination.hpp:76
AIToolbox::Factored::Bandit::MultiObjectiveVariableElimination::Entry::tag
PartialAction tag
Definition: MultiObjectiveVariableElimination.hpp:46
AIToolbox::Factored::Action
Factors Action
Definition: Types.hpp:69
AIToolbox::Factored::Bandit::MultiObjectiveVariableElimination::operator()
Results operator()(const Action &A, const Iterable &inputRules)
This function finds the best Action-value pair for the provided MOQFunctionRules.
Definition: MultiObjectiveVariableElimination.hpp:62
AIToolbox::Factored::Bandit
Definition: GraphUtils.hpp:12