AIToolbox
A library that offers tools for AI problem solving.
ReusingIterativeLocalSearch.hpp
Go to the documentation of this file.
1 #ifndef AI_TOOLBOX_FACTORED_BANDIT_REUSING_ITERATIVE_LOCAL_SEARCH_HEADER_FILE
2 #define AI_TOOLBOX_FACTORED_BANDIT_REUSING_ITERATIVE_LOCAL_SEARCH_HEADER_FILE
3 
8 
26  public:
27  using Result = std::tuple<Action, double>;
29 
45  ReusingIterativeLocalSearch(double resetActionProbability = 0.3, double randomizeFactorProbability = 0.1, unsigned trialNum = 10, bool forceResetAction = true);
46 
62  Result operator()(const Action & A, const Graph & graph);
63 
67  double getResetActionProbability() const;
68 
72  void setResetActionProbability(double resetActionProbability);
73 
77  double getRandomizeFactorProbability() const;
78 
82  void setRandomizeFactorProbability(double randomizeFactorProbability);
83 
87  unsigned getTrialNum() const;
88 
92  void setTrialNum(unsigned trialNum);
93 
99  bool getForceResetAction() const;
100 
104  void setForceResetAction(bool forceResetAction);
105 
106  private:
107  // Parameters
108  double resetActionProbability_;
109  double randomizeFactorProbability_;
110  unsigned trialNum_;
111  bool forceResetAction_;
112 
113  // Caches
114  Action action_, newAction_;
115 
116  // Nested local search
117  LocalSearch ls_;
118 
119  RandomEngine rnd_;
120  };
121 };
122 
123 #endif
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setForceResetAction
void setForceResetAction(bool forceResetAction)
This function sets whether we always restart from a random action at each optimization.
LocalSearch.hpp
Types.hpp
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::Result
std::tuple< Action, double > Result
Definition: ReusingIterativeLocalSearch.hpp:27
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::getTrialNum
unsigned getTrialNum() const
This function returns the currently set number of trials to perform.
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::getResetActionProbability
double getResetActionProbability() const
This function returns the currently set probability for testing a random action.
AIToolbox::Factored::FactorGraph
This class offers a minimal interface to manager a factor graph.
Definition: FactorGraph.hpp:31
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::operator()
Result operator()(const Action &A, const Graph &graph)
This function approximately finds the best Action-value pair for the provided Graph.
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::getForceResetAction
bool getForceResetAction() const
This function returns whether we always restart from a random action at each optimization.
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::ReusingIterativeLocalSearch
ReusingIterativeLocalSearch(double resetActionProbability=0.3, double randomizeFactorProbability=0.1, unsigned trialNum=10, bool forceResetAction=true)
Basic constructor.
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setRandomizeFactorProbability
void setRandomizeFactorProbability(double randomizeFactorProbability)
This function sets the probability of randomizing each factor.
Core.hpp
AIToolbox::RandomEngine
std::mt19937 RandomEngine
Definition: Types.hpp:14
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch
This class approximately finds the best joint action with Reusing Iterative Local Search.
Definition: ReusingIterativeLocalSearch.hpp:25
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setResetActionProbability
void setResetActionProbability(double resetActionProbability)
This function sets the probability for testing a random action.
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::ReusingIterativeLocalSearch::getRandomizeFactorProbability
double getRandomizeFactorProbability() const
This function returns the currently set probability of randomizing each factor.
AIToolbox::Factored::Bandit::LocalSearch::Graph
FactorGraph< Vector > Graph
Definition: LocalSearch.hpp:27
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setTrialNum
void setTrialNum(unsigned trialNum)
This function sets the number of trials to perform.
AIToolbox::Factored::Bandit
Definition: GraphUtils.hpp:12