Scippy

SCIP

Solving Constraint Integer Programs

bandit.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2020 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file bandit.h
17  * @ingroup INTERNALAPI
18  * @brief internal methods for bandit algorithms
19  * @author Gregor Hendel
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_BANDIT_H__
25 #define __SCIP_BANDIT_H__
26 
27 
28 #include "scip/def.h"
29 #include "blockmemshell/memory.h"
30 #include "scip/type_retcode.h"
31 #include "scip/type_result.h"
32 #include "scip/type_set.h"
33 #include "scip/type_primal.h"
34 #include "scip/type_bandit.h"
35 #include "scip/stat.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /** creates and resets bandit algorithm */
43  SCIP_BANDIT** bandit, /**< pointer to bandit algorithm data structure */
44  SCIP_BANDITVTABLE* banditvtable, /**< virtual table for this bandit algorithm */
45  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
46  BMS_BUFMEM* bufmem, /**< buffer memory */
47  SCIP_Real* priorities, /**< nonnegative priorities for each action, or NULL if not needed */
48  int nactions, /**< the positive number of actions for this bandit */
49  unsigned int initseed, /**< initial seed for random number generation */
50  SCIP_BANDITDATA* banditdata /**< algorithm specific bandit data */
51  );
52 
53 /** calls destructor and frees memory of bandit algorithm */
55  BMS_BLKMEM* blkmem, /**< block memory */
56  SCIP_BANDIT** bandit /**< pointer to bandit algorithm data structure */
57  );
58 
59 /** reset the bandit algorithm */
61  BMS_BUFMEM* bufmem, /**< buffer memory */
62  SCIP_BANDIT* bandit, /**< pointer to bandit algorithm data structure */
63  SCIP_Real* priorities, /**< priorities for every action, or NULL if not needed */
64  unsigned int seed /**< initial random seed for bandit selection */
65  );
66 
67 /** get data of this bandit algorithm */
69  SCIP_BANDIT* bandit /**< pointer to bandit algorithm data structure */
70  );
71 
72 /** set the data of this bandit algorithm */
74  SCIP_BANDIT* bandit, /**< bandit algorithm data structure */
75  SCIP_BANDITDATA* banditdata /**< bandit algorihm specific data */
76  );
77 
78 /** create a bandit VTable for bandit algorithm callback functions */
80  SCIP_BANDITVTABLE** banditvtable, /**< pointer to virtual table for bandit algorithm */
81  const char* name, /**< a name for the algorithm represented by this vtable */
82  SCIP_DECL_BANDITFREE ((*banditfree)), /**< callback to free bandit specific data structures */
83  SCIP_DECL_BANDITSELECT((*banditselect)), /**< selection callback for bandit selector */
84  SCIP_DECL_BANDITUPDATE((*banditupdate)), /**< update callback for bandit algorithms */
85  SCIP_DECL_BANDITRESET ((*banditreset)) /**< update callback for bandit algorithms */
86  );
87 
88 /** free a bandit vTable for bandit algorithm callback functions */
90  SCIP_BANDITVTABLE** banditvtable /**< pointer to virtual table for bandit algorithm */
91  );
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif
void SCIPbanditvtableFree(SCIP_BANDITVTABLE **banditvtable)
Definition: bandit.c:260
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)))
Definition: bandit.c:236
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
type definitions for global SCIP settings
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPbanditReset(BMS_BUFMEM *bufmem, SCIP_BANDIT *bandit, SCIP_Real *priorities, unsigned int seed)
Definition: bandit.c:100
SCIP_BANDITDATA * SCIPbanditGetData(SCIP_BANDIT *bandit)
Definition: bandit.c:181
void SCIPbanditSetData(SCIP_BANDIT *bandit, SCIP_BANDITDATA *banditdata)
Definition: bandit.c:191
#define SCIP_DECL_BANDITRESET(x)
Definition: type_bandit.h:73
type definitions for bandit selection algorithms
struct SCIP_BanditData SCIP_BANDITDATA
Definition: type_bandit.h:47
SCIP_RETCODE SCIPbanditFree(BMS_BLKMEM *blkmem, SCIP_BANDIT **bandit)
Definition: bandit.c:71
#define SCIP_DECL_BANDITFREE(x)
Definition: type_bandit.h:54
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)
Definition: bandit.c:33
#define SCIP_Real
Definition: def.h:163
internal methods for problem statistics
result codes for SCIP callback methods
#define SCIP_DECL_BANDITUPDATE(x)
Definition: type_bandit.h:66
#define SCIP_DECL_BANDITSELECT(x)
Definition: type_bandit.h:60
type definitions for collecting primal CIP solutions and primal informations
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:429
memory allocation routines