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-2018 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 email to scip@zib.de. */
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 */
42 extern
44  SCIP_BANDIT** bandit, /**< pointer to bandit algorithm data structure */
45  SCIP_BANDITVTABLE* banditvtable, /**< virtual table for this bandit algorithm */
46  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
47  BMS_BUFMEM* bufmem, /**< buffer memory */
48  SCIP_Real* priorities, /**< nonnegative priorities for each action, or NULL if not needed */
49  int nactions, /**< the positive number of actions for this bandit */
50  unsigned int initseed, /**< initial seed for random number generation */
51  SCIP_BANDITDATA* banditdata /**< algorithm specific bandit data */
52  );
53 
54 /** calls destructor and frees memory of bandit algorithm */
55 extern
57  BMS_BLKMEM* blkmem, /**< block memory */
58  SCIP_BANDIT** bandit /**< pointer to bandit algorithm data structure */
59  );
60 
61 /** reset the bandit algorithm */
62 extern
64  BMS_BUFMEM* bufmem, /**< buffer memory */
65  SCIP_BANDIT* bandit, /**< pointer to bandit algorithm data structure */
66  SCIP_Real* priorities, /**< priorities for every action, or NULL if not needed */
67  unsigned int seed /**< initial random seed for bandit selection */
68  );
69 
70 /** get data of this bandit algorithm */
71 extern
73  SCIP_BANDIT* bandit /**< pointer to bandit algorithm data structure */
74  );
75 
76 /** set the data of this bandit algorithm */
77 extern
79  SCIP_BANDIT* bandit, /**< bandit algorithm data structure */
80  SCIP_BANDITDATA* banditdata /**< bandit algorihm specific data */
81  );
82 
83 /** create a bandit VTable for bandit algorithm callback functions */
84 extern
86  SCIP_BANDITVTABLE** banditvtable, /**< pointer to virtual table for bandit algorithm */
87  const char* name, /**< a name for the algorithm represented by this vtable */
88  SCIP_DECL_BANDITFREE ((*banditfree)), /**< callback to free bandit specific data structures */
89  SCIP_DECL_BANDITSELECT((*banditselect)), /**< selection callback for bandit selector */
90  SCIP_DECL_BANDITUPDATE((*banditupdate)), /**< update callback for bandit algorithms */
91  SCIP_DECL_BANDITRESET ((*banditreset)) /**< update callback for bandit algorithms */
92  );
93 
94 /** free a bandit vTable for bandit algorithm callback functions */
95 extern
97  SCIP_BANDITVTABLE** banditvtable /**< pointer to virtual table for bandit algorithm */
98  );
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif
void SCIPbanditvtableFree(SCIP_BANDITVTABLE **banditvtable)
Definition: bandit.c:232
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:201
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
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:99
SCIP_BANDITDATA * SCIPbanditGetData(SCIP_BANDIT *bandit)
Definition: bandit.c:180
void SCIPbanditSetData(SCIP_BANDIT *bandit, SCIP_BANDITDATA *banditdata)
Definition: bandit.c:190
#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:70
#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:32
#define SCIP_Real
Definition: def.h:149
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:419
memory allocation routines