Detailed Description
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 "scip/struct_set.h"
#include "scip/set.h"
Go to the source code of this file.
Function Documentation
◆ SCIPbanditCreate()
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
- Parameters
-
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 42 of file bandit.c.
References BMSallocBlockMemory, SCIP_Bandit::data, SCIP_Bandit::nactions, NULL, SCIP_Bandit::rng, SCIP_ALLOC, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPbanditReset(), SCIPerrorMessage, SCIPrandomCreate(), and SCIP_Bandit::vtable.
Referenced by SCIPbanditCreateEpsgreedy(), SCIPbanditCreateExp3(), SCIPbanditCreateExp3IX(), and SCIPbanditCreateUcb().
◆ SCIPbanditFree()
SCIP_RETCODE SCIPbanditFree | ( | BMS_BLKMEM * | blkmem, |
SCIP_BANDIT ** | bandit | ||
) |
calls destructor and frees memory of bandit algorithm
- Parameters
-
blkmem block memory bandit pointer to bandit algorithm data structure
Definition at line 80 of file bandit.c.
References BMSfreeBlockMemory, NULL, SCIP_Bandit::rng, SCIP_CALL, SCIP_OKAY, SCIPrandomFree(), and SCIP_Bandit::vtable.
Referenced by SCIPfreeBandit().
◆ SCIPbanditReset()
SCIP_RETCODE SCIPbanditReset | ( | BMS_BUFMEM * | bufmem, |
SCIP_BANDIT * | bandit, | ||
SCIP_Real * | priorities, | ||
unsigned int | seed | ||
) |
reset the bandit algorithm
- Parameters
-
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 109 of file bandit.c.
References NULL, SCIP_Bandit::rng, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPbanditGetNActions(), SCIPerrorMessage, SCIPrandomSetSeed(), and SCIP_Bandit::vtable.
Referenced by SCIPbanditCreate(), and SCIPresetBandit().
◆ SCIPbanditGetData()
SCIP_BANDITDATA* SCIPbanditGetData | ( | SCIP_BANDIT * | bandit | ) |
get data of this bandit algorithm
- Parameters
-
bandit bandit algorithm data structure
Definition at line 190 of file bandit.c.
References SCIP_Bandit::data, and NULL.
Referenced by SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITRESET(), SCIP_DECL_BANDITSELECT(), SCIP_DECL_BANDITUPDATE(), SCIPgetConfidenceBoundUcb(), SCIPgetProbabilityExp3(), SCIPgetProbabilityExp3IX(), SCIPgetStartPermutationUcb(), SCIPgetWeightsEpsgreedy(), SCIPsetBetaExp3(), SCIPsetEpsilonEpsgreedy(), and SCIPsetGammaExp3().
◆ SCIPbanditSetData()
void SCIPbanditSetData | ( | SCIP_BANDIT * | bandit, |
SCIP_BANDITDATA * | banditdata | ||
) |
set the data of this bandit algorithm
- Parameters
-
bandit bandit algorithm data structure banditdata bandit algorihm specific data, or NULL
Definition at line 200 of file bandit.c.
References SCIP_Bandit::data, and NULL.
Referenced by SCIP_DECL_BANDITFREE().
◆ doBanditvtableCreate()
|
static |
internal method to create a bandit VTable
- Parameters
-
banditvtable pointer to virtual table for bandit algorithm name a name for the algorithm represented by this vtable
Definition at line 212 of file bandit.c.
References BMSallocMemory, BMSclearMemory, BMSduplicateMemoryArray, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by SCIPbanditvtableCreate().
◆ SCIPbanditvtableCreate()
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
- Parameters
-
banditvtable pointer to virtual table for bandit algorithm name a name for the algorithm represented by this vtable
Definition at line 245 of file bandit.c.
References doBanditvtableCreate(), NULL, SCIP_CALL_FINALLY, SCIP_OKAY, and SCIPbanditvtableFree().
Referenced by SCIPincludeBanditvtable().
◆ SCIPbanditvtableFree()
void SCIPbanditvtableFree | ( | SCIP_BANDITVTABLE ** | banditvtable | ) |
free a bandit virtual table for bandit algorithm callback functions
- Parameters
-
banditvtable pointer to virtual table for bandit algorithm
Definition at line 269 of file bandit.c.
References BMSfreeMemory, BMSfreeMemoryArrayNull, and NULL.
Referenced by SCIPbanditvtableCreate().