AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch Class Reference

This class approximately finds the best joint action with Reusing Iterative Local Search. More...

#include <AIToolbox/Factored/Bandit/Algorithms/Utils/ReusingIterativeLocalSearch.hpp>

Public Types

using Result = std::tuple< Action, double >
 
using Graph = LocalSearch::Graph
 

Public Member Functions

 ReusingIterativeLocalSearch (double resetActionProbability=0.3, double randomizeFactorProbability=0.1, unsigned trialNum=10, bool forceResetAction=true)
 Basic constructor. More...
 
Result operator() (const Action &A, const Graph &graph)
 This function approximately finds the best Action-value pair for the provided Graph. More...
 
double getResetActionProbability () const
 This function returns the currently set probability for testing a random action. More...
 
void setResetActionProbability (double resetActionProbability)
 This function sets the probability for testing a random action. More...
 
double getRandomizeFactorProbability () const
 This function returns the currently set probability of randomizing each factor. More...
 
void setRandomizeFactorProbability (double randomizeFactorProbability)
 This function sets the probability of randomizing each factor. More...
 
unsigned getTrialNum () const
 This function returns the currently set number of trials to perform. More...
 
void setTrialNum (unsigned trialNum)
 This function sets the number of trials to perform. More...
 
bool getForceResetAction () const
 This function returns whether we always restart from a random action at each optimization. More...
 
void setForceResetAction (bool forceResetAction)
 This function sets whether we always restart from a random action at each optimization. More...
 

Detailed Description

This class approximately finds the best joint action with Reusing Iterative Local Search.

This class is mostly a wrapper around LocalSearch. The idea is to avoid local optima by adding noise to the solution found by LocalSearch, or alternatively restart from random points to see whether we can find a better solution.

In addition, we cache the best action found, so that we can re-use it as a starting point if needed. The idea is that if the graph to solve has changed in a relatively minor way, it is likely that the optimal solution will be close to the one found previously. Note that this caching is optional in case it is known that the graph changed substantially (or we want to solve a different graph).

Member Typedef Documentation

◆ Graph

◆ Result

Constructor & Destructor Documentation

◆ ReusingIterativeLocalSearch()

AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::ReusingIterativeLocalSearch ( double  resetActionProbability = 0.3,
double  randomizeFactorProbability = 0.1,
unsigned  trialNum = 10,
bool  forceResetAction = true 
)

Basic constructor.

The default parameters are provided mostly so that it's possible to initialize RILS in classes internally without knowing the explicit parameters.

It's quite likely they won't work for your problem, so remember to pass something that makes sense!

Parameters
resetActionProbabilityFor each trial, the probability of testing a random action.
randomizeFactorProbabilityFor each trial, the probability for each factor of being randomized from the current best.
trialNumThe number of trials to perform before returning.
forceResetActionWhether force restarting from a random action rather than using the last returned best action.

Member Function Documentation

◆ getForceResetAction()

bool AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::getForceResetAction ( ) const

This function returns whether we always restart from a random action at each optimization.

If this is false, we always start from the lastly returned best action.

◆ getRandomizeFactorProbability()

double AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::getRandomizeFactorProbability ( ) const

This function returns the currently set probability of randomizing each factor.

◆ getResetActionProbability()

double AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::getResetActionProbability ( ) const

This function returns the currently set probability for testing a random action.

◆ getTrialNum()

unsigned AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::getTrialNum ( ) const

This function returns the currently set number of trials to perform.

◆ operator()()

Result AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::operator() ( const Action A,
const Graph graph 
)

This function approximately finds the best Action-value pair for the provided Graph.

On first call, this function optimizes over a single randomly sampled initial action. Subsequently it will optimize using the last best action as a starting point, unless it is explicitly reset.

See also
operator()(const Action &, Graph &, bool)
Parameters
AThe action space of the agents.
graphThe graph to perform RILS on.
Returns
A tuple containing the best Action and its value over the input rules.

◆ setForceResetAction()

void AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setForceResetAction ( bool  forceResetAction)

This function sets whether we always restart from a random action at each optimization.

◆ setRandomizeFactorProbability()

void AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setRandomizeFactorProbability ( double  randomizeFactorProbability)

This function sets the probability of randomizing each factor.

◆ setResetActionProbability()

void AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setResetActionProbability ( double  resetActionProbability)

This function sets the probability for testing a random action.

◆ setTrialNum()

void AIToolbox::Factored::Bandit::ReusingIterativeLocalSearch::setTrialNum ( unsigned  trialNum)

This function sets the number of trials to perform.


The documentation for this class was generated from the following file: