Scippy

SCIP

Solving Constraint Integer Programs

bandit_epsgreedy.c File Reference

Detailed Description

implementation of epsilon greedy bandit algorithm

Author
Gregor Hendel

Definition in file bandit_epsgreedy.c.

#include <assert.h>
#include "blockmemshell/memory.h"
#include "scip/bandit_epsgreedy.h"
#include "scip/scip.h"

Go to the source code of this file.

Macros

#define BANDIT_NAME   "eps-greedy"
 
#define DEFAULT_WEIGHT   0.2
 

Functions

 SCIP_DECL_BANDITFREE (SCIPbanditFreeEpsgreedy)
 
 SCIP_DECL_BANDITSELECT (SCIPbanditSelectEpsgreedy)
 
 SCIP_DECL_BANDITUPDATE (SCIPbanditUpdateEpsgreedy)
 
 SCIP_DECL_BANDITRESET (SCIPbanditResetEpsgreedy)
 
SCIP_RETCODE SCIPbanditCreateEpsgreedy (BMS_BLKMEM *blkmem, BMS_BUFMEM *bufmem, SCIP_BANDITVTABLE *vtable, SCIP_BANDIT **epsgreedy, SCIP_Real *priorities, SCIP_Real eps, int nactions, unsigned int initseed)
 
SCIP_RETCODE SCIPcreateBanditEpsgreedy (SCIP *scip, SCIP_BANDIT **epsgreedy, SCIP_Real *priorities, SCIP_Real eps, int nactions, unsigned int initseed)
 
SCIP_RealSCIPgetWeightsEpsgreedy (SCIP_BANDIT *epsgreedy)
 
void SCIPsetEpsilonEpsgreedy (SCIP_BANDIT *epsgreedy, SCIP_Real eps)
 
SCIP_RETCODE SCIPincludeBanditvtableEpsgreedy (SCIP *scip)
 

Macro Definition Documentation

◆ BANDIT_NAME

#define BANDIT_NAME   "eps-greedy"

◆ DEFAULT_WEIGHT

#define DEFAULT_WEIGHT   0.2

Definition at line 29 of file bandit_epsgreedy.c.

Referenced by SCIP_DECL_BANDITRESET().

Function Documentation

◆ SCIP_DECL_BANDITFREE()

SCIP_DECL_BANDITFREE ( SCIPbanditFreeEpsgreedy  )

callback to free bandit specific data structures

Definition at line 47 of file bandit_epsgreedy.c.

References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, SCIP_OKAY, SCIPbanditGetData(), SCIPbanditGetNActions(), and SCIPbanditSetData().

◆ SCIP_DECL_BANDITSELECT()

SCIP_DECL_BANDITSELECT ( SCIPbanditSelectEpsgreedy  )

selection callback for bandit algorithm

Definition at line 67 of file bandit_epsgreedy.c.

References SCIP_OKAY, SCIP_Real, SCIPbanditGetData(), SCIPbanditGetNActions(), SCIPbanditGetRandnumgen(), SCIPrandomGetInt(), SCIPrandomGetReal(), and sqrt().

◆ SCIP_DECL_BANDITUPDATE()

SCIP_DECL_BANDITUPDATE ( SCIPbanditUpdateEpsgreedy  )

update callback for bandit algorithm

Definition at line 127 of file bandit_epsgreedy.c.

References SCIP_OKAY, and SCIPbanditGetData().

◆ SCIP_DECL_BANDITRESET()

SCIP_DECL_BANDITRESET ( SCIPbanditResetEpsgreedy  )

reset callback for bandit algorithm

Definition at line 144 of file bandit_epsgreedy.c.

References DEFAULT_WEIGHT, SCIP_OKAY, SCIP_Real, SCIPbanditGetData(), and SCIPbanditGetNActions().

◆ SCIPbanditCreateEpsgreedy()

SCIP_RETCODE SCIPbanditCreateEpsgreedy ( BMS_BLKMEM blkmem,
BMS_BUFMEM bufmem,
SCIP_BANDITVTABLE vtable,
SCIP_BANDIT **  epsgreedy,
SCIP_Real priorities,
SCIP_Real  eps,
int  nactions,
unsigned int  initseed 
)

internal method to create and reset epsilon greedy bandit algorithm

Parameters
blkmemblock memory
bufmembuffer memory
vtablevirtual function table with epsilon greedy callbacks
epsgreedypointer to store the epsilon greedy bandit algorithm
prioritiesnonnegative priorities for each action, or NULL if not needed
epsparameter to increase probability for exploration between all actions
nactionsthe positive number of possible actions
initseedinitial random seed

Definition at line 208 of file bandit_epsgreedy.c.

References BMSallocBlockMemory, BMSallocBlockMemoryArray, eps, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, and SCIPbanditCreate().

Referenced by SCIPcreateBanditEpsgreedy().

◆ SCIPincludeBanditvtableEpsgreedy()

SCIP_RETCODE SCIPincludeBanditvtableEpsgreedy ( SCIP scip)

creates the epsilon greedy bandit algorithm includes it in SCIP

Parameters
scipSCIP data structure

Definition at line 291 of file bandit_epsgreedy.c.

References BANDIT_NAME, SCIP_CALL, SCIP_OKAY, and SCIPincludeBanditvtable().

Referenced by SCIPincludeCorePlugins().