BamBirds 2021
de.uniba.sme.bambirds.level_selection.Action Class Reference
Collaboration diagram for de.uniba.sme.bambirds.level_selection.Action:

Classes

enum  Strategy
 

Public Member Functions

 Action (double epsilon, Strategy strategy, long timeLimit, int numberOfLevels)
 
 Action (double epsilon, Strategy strategy, long timeLimit, int numberOfLevels, long seed)
 
int nextLevel (Map< Integer, Double > probabilities, long timeLeft)
 
long getTimeLimit ()
 
void setTimeLimit (long timeLimit)
 

Private Member Functions

int oldSelection ()
 
int greedySelection (Map< Integer, Double > probabilities)
 
int epsilonGreedySelection (Map< Integer, Double > probabilities)
 
int epsilonAdaptiveSelection (Map< Integer, Double > probabilities, long timeLeft)
 
int randomSelection (Map< Integer, Double > probabilities)
 

Private Attributes

double epsilonInit
 
Strategy strategy
 
Random random
 
long timeLimit
 
int numberOfLevels
 
int currentLevel
 
int numberOfTimesPlayedTheMost = -1
 
int numberOfTimesPlayedMinimum = 1000
 
boolean allLostLevelsPlayedTwice = false
 
int lastLostLevel = -1
 

Static Private Attributes

static final Logger log = LogManager.getLogger(Action.class)
 

Detailed Description

Class for selecting a Level using a specific Strategy and the probability distribution calculated by Decision

Constructor & Destructor Documentation

◆ Action() [1/2]

de.uniba.sme.bambirds.level_selection.Action.Action ( double  epsilon,
Strategy  strategy,
long  timeLimit,
int  numberOfLevels 
)

Create a new Action Object

Parameters
epsiloninitial value for epsilon algorithms
strategyType of strategy used to select next level
timeLimitMaximum time in the Competition
numberOfLevelsThe number of Levels the agent is playing

◆ Action() [2/2]

de.uniba.sme.bambirds.level_selection.Action.Action ( double  epsilon,
Strategy  strategy,
long  timeLimit,
int  numberOfLevels,
long  seed 
)

Create a new Action Object

Parameters
epsiloninitial value for epsilon algorithms
strategyType of strategy used to select next level
timeLimitMaximum time in the Competition
numberOfLevelsThe number of Levels the agent is playing
seedThe seed for the random number generator

Member Function Documentation

◆ epsilonAdaptiveSelection()

int de.uniba.sme.bambirds.level_selection.Action.epsilonAdaptiveSelection ( Map< Integer, Double >  probabilities,
long  timeLeft 
)
private

Select the level with the highest probability depending on how much time is left and how good the score and win predictions are.
Otherwise randomSelection

Parameters
probabilitiesfor each possible level
timeLeftremaining time
Returns
the next level to play

◆ epsilonGreedySelection()

int de.uniba.sme.bambirds.level_selection.Action.epsilonGreedySelection ( Map< Integer, Double >  probabilities)
private

Select the level with the highest probability with probability 1 - epsilon.

Otherwise randomSelection

Parameters
probabilitiesfor each possible level
Returns
the next level to play

◆ greedySelection()

int de.uniba.sme.bambirds.level_selection.Action.greedySelection ( Map< Integer, Double >  probabilities)
private

Select the level with the highest probability

Parameters
probabilitiesfor each possible level
Returns
the next level to play

◆ nextLevel()

int de.uniba.sme.bambirds.level_selection.Action.nextLevel ( Map< Integer, Double >  probabilities,
long  timeLeft 
)

Calculate the next Level to be played depending on the strategy.

Parameters
probabilitiesfor each possible level
timeLeftremaining time
Returns
the next level to play

◆ oldSelection()

int de.uniba.sme.bambirds.level_selection.Action.oldSelection ( )
private

The old Level Selection, where first all not won levels will be attempted 3 times. Then if less than 15 percent have been lost, the Level with the highest possible improvement based on the maximum possible points will be selected

Returns
the next level to play

◆ randomSelection()

int de.uniba.sme.bambirds.level_selection.Action.randomSelection ( Map< Integer, Double >  probabilities)
private

Randomly select a level depending on its probability

Parameters
probabilitiesfor each possible level
Returns
the next level to play

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