42#define BANDIT_NAME "eps-greedy"
43#define EPSGREEDY_SMALL 1e-6
114 banditdata->nselections++;
115 curreps = banditdata->eps * sqrt((
SCIP_Real)nactions/(
SCIP_Real)banditdata->nselections);
118 if( randnr >= curreps )
120 SCIP_Real* weights = banditdata->weights;
121 SCIP_Real* priorities = banditdata->priorities;
129 maxweight = weights[0];
133 for( j = 1; j < nactions; ++j )
138 if( maxweight < weight
146 else if( ! banditdata->usemodification )
156 SCIP_Real* weights = banditdata->weights;
159 for( j = 0; j < nactions; ++j )
160 weightsum += banditdata->weights[j];
168 for( j = 0; j < nactions - 1; ++j )
205 if( banditdata->preferrecent && banditdata->sels[
selection] > banditdata->avglim )
208 banditdata->weights[
selection] *= banditdata->decayfactor;
209 banditdata->weights[
selection] += (1.0 - banditdata->decayfactor) * score;
236 weights = banditdata->weights;
246 if( priorities !=
NULL )
248 for(
w = 1;
w < nactions; ++
w )
257 for(
w = 0;
w < nactions; ++
w )
265 banditdata->nselections = 0;
288 unsigned int initseed
300 banditdata->eps =
eps;
301 banditdata->nselections = 0;
302 banditdata->usemodification = usemodification;
303 banditdata->preferrecent = preferrecent;
304 banditdata->decayfactor = decayfactor;
305 banditdata->avglim = avglim;
324 unsigned int initseed
354 return banditdata->weights;
369 banditdata->eps =
eps;
381 SCIPbanditFreeEpsgreedy, SCIPbanditSelectEpsgreedy, SCIPbanditUpdateEpsgreedy, SCIPbanditResetEpsgreedy) );
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
SCIP_RETCODE SCIPincludeBanditvtableEpsgreedy(SCIP *scip)
SCIP_RETCODE SCIPbanditCreateEpsgreedy(BMS_BLKMEM *blkmem, BMS_BUFMEM *bufmem, SCIP_BANDITVTABLE *vtable, SCIP_BANDIT **epsgreedy, SCIP_Real *priorities, SCIP_Real eps, SCIP_Bool usemodification, SCIP_Bool preferrecent, SCIP_Real decayfactor, int avglim, int nactions, unsigned int initseed)
internal methods for epsilon greedy bandit selection
int SCIPbanditGetNActions(SCIP_BANDIT *bandit)
void SCIPsetEpsilonEpsgreedy(SCIP_BANDIT *epsgreedy, SCIP_Real eps)
SCIP_Real * SCIPgetWeightsEpsgreedy(SCIP_BANDIT *epsgreedy)
SCIP_RANDNUMGEN * SCIPbanditGetRandnumgen(SCIP_BANDIT *bandit)
SCIP_BANDITVTABLE * SCIPfindBanditvtable(SCIP *scip, const char *name)
SCIP_RETCODE SCIPcreateBanditEpsgreedy(SCIP *scip, SCIP_BANDIT **epsgreedy, SCIP_Real *priorities, SCIP_Real eps, SCIP_Bool usemodification, SCIP_Bool preferrecent, SCIP_Real decayfactor, int avglim, int nactions, unsigned int initseed)
SCIP_RETCODE SCIPincludeBanditvtable(SCIP *scip, SCIP_BANDITVTABLE **banditvtable, const char *name, SCIP_DECL_BANDITFREE((*banditfree)), SCIP_DECL_BANDITSELECT((*banditselect)), SCIP_DECL_BANDITUPDATE((*banditupdate)),)
BMS_BUFMEM * SCIPbuffer(SCIP *scip)
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randnumgen, int minrandval, int maxrandval)
unsigned int SCIPinitializeRandomSeed(SCIP *scip, unsigned int initialseedvalue)
assert(minobj< SCIPgetCutoffbound(scip))
#define BMSfreeBlockMemory(mem, ptr)
#define BMSallocBlockMemory(mem, ptr)
#define BMSallocBlockMemoryArray(mem, ptr, num)
#define BMSfreeBlockMemoryArray(mem, ptr, num)
#define BMSclearMemoryArray(ptr, num)
struct BMS_BufMem BMS_BUFMEM
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
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_Bandit SCIP_BANDIT
struct SCIP_BanditData SCIP_BANDITDATA
#define SCIP_DECL_BANDITSELECT(x)
struct SCIP_BanditVTable SCIP_BANDITVTABLE
#define SCIP_DECL_BANDITRESET(x)
struct SCIP_RandNumGen SCIP_RANDNUMGEN
enum SCIP_Retcode SCIP_RETCODE