AIToolbox
A library that offers tools for AI problem solving.
LocalSearch.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_FACTORED_BANDIT_LOCAL_SEARCH_HEADER_FILE
2 #define AI_TOOLBOX_FACTORED_BANDIT_LOCAL_SEARCH_HEADER_FILE
3 
7 
24  class LocalSearch {
25  public:
26  using Result = std::tuple<Action, double>;
28 
32  LocalSearch();
33 
46  Result operator()(const Action & A, const Graph & graph);
47 
67  Result operator()(const Action & A, const Graph & graph, Action startAction);
68 
78  static double evaluateGraph(const Action & A, const Graph & graph, const Action & jointAction);
79 
94  static double evaluateFactors(const Action & A, const Graph::FactorItList & factors, const Action & jointAction);
95 
105  static double evaluateFactor(const Action & A, const Graph::FactorNode & factor, const Action & jointAction);
106 
107  private:
108  // Storage for agent ordering (which is shuffled).
109  std::vector<size_t> agents_;
110 
111  mutable RandomEngine rnd_;
112  };
113 }
114 
115 #endif
Types.hpp
AIToolbox::Factored::FactorGraph::FactorNode
Definition: FactorGraph.hpp:35
AIToolbox::Factored::Bandit::LocalSearch::operator()
Result operator()(const Action &A, const Graph &graph)
This function performs the actual local search process.
AIToolbox::Factored::FactorGraph::FactorItList
std::vector< FactorIt > FactorItList
Definition: FactorGraph.hpp:50
AIToolbox::Factored::Bandit::LocalSearch::LocalSearch
LocalSearch()
Basic constructor.
AIToolbox::Factored::FactorGraph
This class offers a minimal interface to manager a factor graph.
Definition: FactorGraph.hpp:31
Core.hpp
AIToolbox::Factored::Bandit::LocalSearch::evaluateFactor
static double evaluateFactor(const Action &A, const Graph::FactorNode &factor, const Action &jointAction)
This function evaluates the score for a single factor in a Graph.
AIToolbox::RandomEngine
std::mt19937 RandomEngine
Definition: Types.hpp:14
AIToolbox::Factored::Bandit::LocalSearch::Result
std::tuple< Action, double > Result
Definition: LocalSearch.hpp:26
AIToolbox::Factored::Bandit::LocalSearch
This class approximately finds the best joint action using Local Search.
Definition: LocalSearch.hpp:24
FactorGraph.hpp
AIToolbox::Factored::Action
Factors Action
Definition: Types.hpp:69
AIToolbox::Factored::Bandit::LocalSearch::evaluateFactors
static double evaluateFactors(const Action &A, const Graph::FactorItList &factors, const Action &jointAction)
This function evaluates the score for a subset of factors in a Graph.
AIToolbox::Factored::Bandit::LocalSearch::evaluateGraph
static double evaluateGraph(const Action &A, const Graph &graph, const Action &jointAction)
This function evaluates the full score of a given joint action.
AIToolbox::Factored::Bandit
Definition: GraphUtils.hpp:12