internal API of bandit algorithms and bandit virtual function tables
Definition in file bandit.c.
#include <assert.h>
#include <string.h>
#include "scip/bandit.h"
#include "scip/pub_bandit.h"
#include "scip/struct_bandit.h"
#include "struct_set.h"
#include "scip/set.h"
Go to the source code of this file.
SCIP_RETCODE SCIPbanditCreate | ( | SCIP_BANDIT ** | bandit, |
SCIP_BANDITVTABLE * | banditvtable, | ||
BMS_BLKMEM * | blkmem, | ||
BMS_BUFMEM * | bufmem, | ||
SCIP_Real * | priorities, | ||
int | nactions, | ||
unsigned int | initseed, | ||
SCIP_BANDITDATA * | banditdata | ||
) |
creates and resets bandit algorithm
bandit | pointer to bandit algorithm data structure |
banditvtable | virtual table for this bandit algorithm |
blkmem | block memory for parameter settings |
bufmem | buffer memory |
priorities | nonnegative priorities for each action, or NULL if not needed |
nactions | the positive number of actions for this bandit |
initseed | initial seed for random number generation |
banditdata | algorithm specific bandit data |
Definition at line 32 of file bandit.c.
References BMSallocBlockMemory, SCIP_Bandit::data, SCIP_Bandit::nactions, SCIP_Bandit::rng, SCIP_ALLOC, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPbanditReset(), SCIPerrorMessage, SCIPrandomCreate(), and SCIP_Bandit::vtable.
Referenced by SCIPbanditCreateEpsgreedy(), SCIPbanditCreateExp3(), and SCIPbanditCreateUcb().
SCIP_RETCODE SCIPbanditFree | ( | BMS_BLKMEM * | blkmem, |
SCIP_BANDIT ** | bandit | ||
) |
calls destructor and frees memory of bandit algorithm
blkmem | block memory |
bandit | pointer to bandit algorithm data structure |
Definition at line 70 of file bandit.c.
References BMSfreeBlockMemory, SCIP_Bandit::rng, SCIP_CALL, SCIP_OKAY, SCIPrandomFree(), and SCIP_Bandit::vtable.
Referenced by SCIPfreeBandit().
SCIP_RETCODE SCIPbanditReset | ( | BMS_BUFMEM * | bufmem, |
SCIP_BANDIT * | bandit, | ||
SCIP_Real * | priorities, | ||
unsigned int | seed | ||
) |
reset the bandit algorithm
bufmem | buffer memory |
bandit | pointer to bandit algorithm data structure |
priorities | nonnegative priorities for each action, or NULL if not needed |
seed | initial seed for random number generation |
Definition at line 99 of file bandit.c.
References SCIP_Bandit::rng, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPbanditGetNActions(), SCIPerrorMessage, SCIPrandomSetSeed(), and SCIP_Bandit::vtable.
Referenced by SCIPbanditCreate(), and SCIPresetBandit().
SCIP_BANDITDATA* SCIPbanditGetData | ( | SCIP_BANDIT * | bandit | ) |
get data of this bandit algorithm
bandit | bandit algorithm data structure |
Definition at line 180 of file bandit.c.
References SCIP_Bandit::data.
Referenced by SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITRESET(), SCIP_DECL_BANDITSELECT(), SCIP_DECL_BANDITUPDATE(), SCIPgetConfidenceBoundUcb(), SCIPgetProbabilityExp3(), SCIPgetStartPermutationUcb(), SCIPgetWeightsEpsgreedy(), SCIPsetBetaExp3(), SCIPsetEpsilonEpsgreedy(), and SCIPsetGammaExp3().
void SCIPbanditSetData | ( | SCIP_BANDIT * | bandit, |
SCIP_BANDITDATA * | banditdata | ||
) |
set the data of this bandit algorithm
bandit | bandit algorithm data structure |
banditdata | bandit algorihm specific data, or NULL |
Definition at line 190 of file bandit.c.
References SCIP_Bandit::data.
Referenced by SCIP_DECL_BANDITFREE().
SCIP_RETCODE SCIPbanditvtableCreate | ( | SCIP_BANDITVTABLE ** | banditvtable, |
const char * | name, | ||
SCIP_DECL_BANDITFREE((*banditfree)) | , | ||
SCIP_DECL_BANDITSELECT((*banditselect)) | , | ||
SCIP_DECL_BANDITUPDATE((*banditupdate)) | , | ||
SCIP_DECL_BANDITRESET((*banditreset)) | |||
) |
create a bandit VTable for bandit algorithm callback functions
banditvtable | pointer to virtual table for bandit algorithm |
name | a name for the algorithm represented by this vtable |
Definition at line 201 of file bandit.c.
References BMSallocMemory, BMSduplicateMemoryArray, SCIP_ALLOC, and SCIP_OKAY.
Referenced by SCIPincludeBanditvtable().
void SCIPbanditvtableFree | ( | SCIP_BANDITVTABLE ** | banditvtable | ) |
free a bandit virtual table for bandit algorithm callback functions
banditvtable | pointer to virtual table for bandit algorithm |
Definition at line 232 of file bandit.c.
References BMSfreeMemory, and BMSfreeMemoryArray.
Referenced by SCIPsetFree().