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-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file bandit.h
26  * @ingroup INTERNALAPI
27  * @brief internal methods for bandit algorithms
28  * @author Gregor Hendel
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #ifndef __SCIP_BANDIT_H__
34 #define __SCIP_BANDIT_H__
35 
36 
37 #include "scip/def.h"
38 #include "blockmemshell/memory.h"
39 #include "scip/type_retcode.h"
40 #include "scip/type_result.h"
41 #include "scip/type_set.h"
42 #include "scip/type_primal.h"
43 #include "scip/type_bandit.h"
44 #include "scip/stat.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /** creates and resets bandit algorithm */
52  SCIP_BANDIT** bandit, /**< pointer to bandit algorithm data structure */
53  SCIP_BANDITVTABLE* banditvtable, /**< virtual table for this bandit algorithm */
54  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
55  BMS_BUFMEM* bufmem, /**< buffer memory */
56  SCIP_Real* priorities, /**< nonnegative priorities for each action, or NULL if not needed */
57  int nactions, /**< the positive number of actions for this bandit */
58  unsigned int initseed, /**< initial seed for random number generation */
59  SCIP_BANDITDATA* banditdata /**< algorithm specific bandit data */
60  );
61 
62 /** calls destructor and frees memory of bandit algorithm */
64  BMS_BLKMEM* blkmem, /**< block memory */
65  SCIP_BANDIT** bandit /**< pointer to bandit algorithm data structure */
66  );
67 
68 /** reset the bandit algorithm */
70  BMS_BUFMEM* bufmem, /**< buffer memory */
71  SCIP_BANDIT* bandit, /**< pointer to bandit algorithm data structure */
72  SCIP_Real* priorities, /**< priorities for every action, or NULL if not needed */
73  unsigned int seed /**< initial random seed for bandit selection */
74  );
75 
76 /** get data of this bandit algorithm */
78  SCIP_BANDIT* bandit /**< pointer to bandit algorithm data structure */
79  );
80 
81 /** set the data of this bandit algorithm */
83  SCIP_BANDIT* bandit, /**< bandit algorithm data structure */
84  SCIP_BANDITDATA* banditdata /**< bandit algorihm specific data */
85  );
86 
87 /** create a bandit VTable for bandit algorithm callback functions */
89  SCIP_BANDITVTABLE** banditvtable, /**< pointer to virtual table for bandit algorithm */
90  const char* name, /**< a name for the algorithm represented by this vtable */
91  SCIP_DECL_BANDITFREE ((*banditfree)), /**< callback to free bandit specific data structures */
92  SCIP_DECL_BANDITSELECT((*banditselect)), /**< selection callback for bandit selector */
93  SCIP_DECL_BANDITUPDATE((*banditupdate)), /**< update callback for bandit algorithms */
94  SCIP_DECL_BANDITRESET ((*banditreset)) /**< update callback for bandit algorithms */
95  );
96 
97 /** free a bandit vTable for bandit algorithm callback functions */
99  SCIP_BANDITVTABLE** banditvtable /**< pointer to virtual table for bandit algorithm */
100  );
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif
void SCIPbanditvtableFree(SCIP_BANDITVTABLE **banditvtable)
Definition: bandit.c:269
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:245
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
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:109
SCIP_BANDITDATA * SCIPbanditGetData(SCIP_BANDIT *bandit)
Definition: bandit.c:190
void SCIPbanditSetData(SCIP_BANDIT *bandit, SCIP_BANDITDATA *banditdata)
Definition: bandit.c:200
#define SCIP_DECL_BANDITRESET(x)
Definition: type_bandit.h:82
type definitions for bandit selection algorithms
struct SCIP_BanditData SCIP_BANDITDATA
Definition: type_bandit.h:56
SCIP_RETCODE SCIPbanditFree(BMS_BLKMEM *blkmem, SCIP_BANDIT **bandit)
Definition: bandit.c:80
#define SCIP_DECL_BANDITFREE(x)
Definition: type_bandit.h:63
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:42
#define SCIP_Real
Definition: def.h:186
internal methods for problem statistics
result codes for SCIP callback methods
#define SCIP_DECL_BANDITUPDATE(x)
Definition: type_bandit.h:75
#define SCIP_DECL_BANDITSELECT(x)
Definition: type_bandit.h:69
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:439
memory allocation routines