Scippy

SCIP

Solving Constraint Integer Programs

bandit.h File Reference

Detailed Description

internal methods for bandit algorithms

Author
Gregor Hendel

Definition in file bandit.h.

#include "scip/def.h"
#include "blockmemshell/memory.h"
#include "scip/type_retcode.h"
#include "scip/type_result.h"
#include "scip/type_set.h"
#include "scip/type_primal.h"
#include "scip/type_bandit.h"
#include "scip/stat.h"

Go to the source code of this file.

Functions

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_RETCODE SCIPbanditFree (BMS_BLKMEM *blkmem, SCIP_BANDIT **bandit)
 
SCIP_RETCODE SCIPbanditReset (BMS_BUFMEM *bufmem, SCIP_BANDIT *bandit, SCIP_Real *priorities, unsigned int seed)
 
SCIP_BANDITDATASCIPbanditGetData (SCIP_BANDIT *bandit)
 
void SCIPbanditSetData (SCIP_BANDIT *bandit, SCIP_BANDITDATA *banditdata)
 
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)))
 
void SCIPbanditvtableFree (SCIP_BANDITVTABLE **banditvtable)
 

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
banditpointer to bandit algorithm data structure
banditvtablevirtual table for this bandit algorithm
blkmemblock memory for parameter settings
bufmembuffer memory
prioritiesnonnegative priorities for each action, or NULL if not needed
nactionsthe positive number of actions for this bandit
initseedinitial seed for random number generation
banditdataalgorithm specific bandit data

Definition at line 32 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(), and SCIPbanditCreateUcb().

◆ SCIPbanditFree()

SCIP_RETCODE SCIPbanditFree ( BMS_BLKMEM blkmem,
SCIP_BANDIT **  bandit 
)

calls destructor and frees memory of bandit algorithm

Parameters
blkmemblock memory
banditpointer to bandit algorithm data structure

Definition at line 70 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
bufmembuffer memory
banditpointer to bandit algorithm data structure
prioritiesnonnegative priorities for each action, or NULL if not needed
seedinitial seed for random number generation

Definition at line 99 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()

◆ SCIPbanditSetData()

void SCIPbanditSetData ( SCIP_BANDIT bandit,
SCIP_BANDITDATA banditdata 
)

set the data of this bandit algorithm

Parameters
banditbandit algorithm data structure
banditdatabandit algorihm specific data, or NULL

Definition at line 190 of file bandit.c.

References SCIP_Bandit::data, and NULL.

Referenced by SCIP_DECL_BANDITFREE().

◆ 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
banditvtablepointer to virtual table for bandit algorithm
namea name for the algorithm represented by this vtable

Definition at line 235 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 vTable for bandit algorithm callback functions

free a bandit virtual table for bandit algorithm callback functions

Parameters
banditvtablepointer to virtual table for bandit algorithm

Definition at line 259 of file bandit.c.

References BMSfreeMemory, BMSfreeMemoryArrayNull, and NULL.

Referenced by SCIPbanditvtableCreate(), and SCIPsetFree().