44#define BANDIT_NAME "ucb"
57 SCIP_Real* meanscores;
72 SCIP_Real* priorities,
86 banditdata->nselections = 0;
92 for(
i = 0;
i < nactions; ++
i )
93 banditdata->startperm[
i] =
i;
96 if( priorities !=
NULL )
98 SCIP_Real* prioritycopy;
103 for(
i = 0;
i < nactions; ++
i )
159 counter = banditdata->counter;
161 if( banditdata->nselections < nactions )
163 *
selection = banditdata->startperm[banditdata->nselections];
169 SCIP_Real* meanscores;
170 SCIP_Real widthfactor;
174 meanscores = banditdata->meanscores;
181 widthfactor = banditdata->alpha *
LOG1P((SCIP_Real)banditdata->nselections);
182 widthfactor = sqrt(widthfactor);
190 for(
i = 0;
i < nactions; ++
i )
197 uppercb = meanscores[
i];
198 rootcount = sqrt((SCIP_Real)counter[
i]);
199 uppercb += widthfactor / rootcount;
231 delta = score - banditdata->meanscores[
selection];
235 banditdata->nselections++;
276 assert(action < nactions);
279 if( banditdata->nselections < nactions )
283 assert(banditdata->counter[action] > 0);
284 uppercb = banditdata->meanscores[action];
287 uppercb += sqrt(banditdata->alpha *
LOG1P((SCIP_Real)banditdata->nselections) / (SCIP_Real)banditdata->counter[action]);
301 return banditdata->startperm;
310 SCIP_Real* priorities,
313 unsigned int initseed
331 banditdata->alpha =
alpha;
342 SCIP_Real* priorities,
345 unsigned int initseed
371 SCIPbanditFreeUcb, SCIPbanditSelectUcb, SCIPbanditUpdateUcb, SCIPbanditResetUcb) );
void SCIPbanditSetData(SCIP_BANDIT *bandit, SCIP_BANDITDATA *banditdata)
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)
SCIP_BANDITDATA * SCIPbanditGetData(SCIP_BANDIT *bandit)
internal methods for bandit algorithms
static SCIP_RETCODE dataReset(BMS_BUFMEM *bufmem, SCIP_BANDIT *ucb, SCIP_BANDITDATA *banditdata, SCIP_Real *priorities, int nactions)
SCIP_RETCODE SCIPincludeBanditvtableUcb(SCIP *scip)
SCIP_RETCODE SCIPbanditCreateUcb(BMS_BLKMEM *blkmem, BMS_BUFMEM *bufmem, SCIP_BANDITVTABLE *vtable, SCIP_BANDIT **ucb, SCIP_Real *priorities, SCIP_Real alpha, int nactions, unsigned int initseed)
internal methods for UCB bandit algorithm
void SCIPrandomPermuteIntArray(SCIP_RANDNUMGEN *randnumgen, int *array, int begin, int end)
int * SCIPgetStartPermutationUcb(SCIP_BANDIT *ucb)
int SCIPbanditGetNActions(SCIP_BANDIT *bandit)
SCIP_RANDNUMGEN * SCIPbanditGetRandnumgen(SCIP_BANDIT *bandit)
SCIP_BANDITVTABLE * SCIPfindBanditvtable(SCIP *scip, const char *name)
SCIP_RETCODE SCIPincludeBanditvtable(SCIP *scip, SCIP_BANDITVTABLE **banditvtable, const char *name, SCIP_DECL_BANDITFREE((*banditfree)), SCIP_DECL_BANDITSELECT((*banditselect)), SCIP_DECL_BANDITUPDATE((*banditupdate)),)
SCIP_Real SCIPgetConfidenceBoundUcb(SCIP_BANDIT *ucb, int action)
SCIP_RETCODE SCIPcreateBanditUcb(SCIP *scip, SCIP_BANDIT **ucb, SCIP_Real *priorities, SCIP_Real alpha, int nactions, unsigned int initseed)
BMS_BUFMEM * SCIPbuffer(SCIP *scip)
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
unsigned int SCIPinitializeRandomSeed(SCIP *scip, unsigned int initialseedvalue)
void SCIPsortDownRealInt(SCIP_Real *realarray, int *intarray, int len)
assert(minobj< SCIPgetCutoffbound(scip))
#define BMSfreeBlockMemory(mem, ptr)
#define BMSduplicateBufferMemoryArray(mem, ptr, source, num)
#define BMSallocBlockMemory(mem, ptr)
#define BMSfreeBufferMemoryArray(mem, ptr)
#define BMSallocBlockMemoryArray(mem, ptr, num)
#define BMSfreeBlockMemoryArray(mem, ptr, num)
#define BMSclearMemoryArray(ptr, num)
struct BMS_BlkMem BMS_BLKMEM
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
public methods for bandit algorithms
public methods for message output
public data structures and miscellaneous methods
methods for sorting joint arrays of various types
public methods for bandit algorithms
public methods for memory management
public methods for random numbers
#define SCIP_DECL_BANDITUPDATE(x)
#define SCIP_DECL_BANDITFREE(x)
struct SCIP_BanditData SCIP_BANDITDATA
#define SCIP_DECL_BANDITSELECT(x)
#define SCIP_DECL_BANDITRESET(x)
enum SCIP_Retcode SCIP_RETCODE