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.
| 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 42 of file bandit.c.
References assert(), BMSallocBlockMemory, SCIP_Bandit::data, SCIP_Bandit::nactions, NULL, SCIP_Bandit::rng, SCIP_ALLOC, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPbanditReset(), SCIPerrorMessage, SCIPrandomCreate(), and SCIP_Bandit::vtable.
Referenced by SCIPbanditCreateEpsgreedy(), SCIPbanditCreateExp3(), SCIPbanditCreateExp3IX(), 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 80 of file bandit.c.
References assert(), BMSfreeBlockMemory, NULL, 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 109 of file bandit.c.
References assert(), i, NULL, SCIP_Bandit::rng, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, 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 190 of file bandit.c.
References assert(), SCIP_Bandit::data, and NULL.
Referenced by SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITRESET(), SCIP_DECL_BANDITRESET(), SCIP_DECL_BANDITRESET(), SCIP_DECL_BANDITRESET(), SCIP_DECL_BANDITSELECT(), SCIP_DECL_BANDITSELECT(), SCIP_DECL_BANDITSELECT(), SCIP_DECL_BANDITSELECT(), SCIP_DECL_BANDITUPDATE(), SCIP_DECL_BANDITUPDATE(), SCIP_DECL_BANDITUPDATE(), SCIP_DECL_BANDITUPDATE(), SCIPgetConfidenceBoundUcb(), SCIPgetProbabilityExp3(), SCIPgetProbabilityExp3IX(), 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 200 of file bandit.c.
References assert(), SCIP_Bandit::data, and NULL.
Referenced by SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITFREE(), SCIP_DECL_BANDITFREE(), and SCIP_DECL_BANDITFREE().
|
static |
internal method to create a bandit VTable
| 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 assert(), BMSallocMemory, BMSclearMemory, BMSduplicateMemoryArray, NULL, SCIP_ALLOC, SCIP_DECL_BANDITFREE, SCIP_DECL_BANDITRESET, and SCIP_OKAY.
Referenced by SCIPbanditvtableCreate().
| SCIP_RETCODE SCIPbanditvtableCreate | ( | SCIP_BANDITVTABLE ** | banditvtable, |
| const char * | name, | ||
| SCIP_DECL_BANDITFREE((*banditfree)) | , | ||
| SCIP_DECL_BANDITSELECT((*banditselect)) | , | ||
| SCIP_DECL_BANDITUPDATE((*banditupdate)) | ) |
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 245 of file bandit.c.
References assert(), doBanditvtableCreate(), NULL, SCIP_CALL_FINALLY, SCIP_DECL_BANDITFREE, SCIP_DECL_BANDITRESET, SCIP_OKAY, and SCIPbanditvtableFree().
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 269 of file bandit.c.
References assert(), BMSfreeMemory, BMSfreeMemoryArrayNull, and NULL.
Referenced by SCIPbanditvtableCreate().