Scippy

SCIP

Solving Constraint Integer Programs

bandit_epsgreedy.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-2024 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_epsgreedy.h
26  * @ingroup INTERNALAPI
27  * @brief internal methods for epsilon greedy bandit selection
28  * @author Gregor Hendel
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #ifndef __SCIP_BANDIT_EPSGREEDY_H__
34 #define __SCIP_BANDIT_EPSGREEDY_H__
35 
36 
37 #include "blockmemshell/memory.h"
38 #include "scip/def.h"
39 #include "scip/type_bandit.h"
40 #include "scip/type_retcode.h"
41 #include "scip/type_scip.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /** creates the epsilon greedy bandit algorithm includes it in SCIP */
49  SCIP* scip /**< SCIP data structure */
50  );
51 
52 /** callback to free bandit specific data structures */
53 SCIP_DECL_BANDITFREE(SCIPbanditFreeEpsgreedy);
54 
55 /** selection callback for bandit algorithm */
56 SCIP_DECL_BANDITSELECT(SCIPbanditSelectEpsgreedy);
57 
58 /** update callback for bandit algorithm */
59 SCIP_DECL_BANDITUPDATE(SCIPbanditUpdateEpsgreedy);
60 
61 /** reset callback for bandit algorithm */
62 SCIP_DECL_BANDITRESET(SCIPbanditResetEpsgreedy);
63 
64 
65 /** internal method to create and reset epsilon greedy bandit algorithm */
67  BMS_BLKMEM* blkmem, /**< block memory */
68  BMS_BUFMEM* bufmem, /**< buffer memory */
69  SCIP_BANDITVTABLE* vtable, /**< virtual function table with epsilon greedy callbacks */
70  SCIP_BANDIT** epsgreedy, /**< pointer to store the epsilon greedy bandit algorithm */
71  SCIP_Real* priorities, /**< nonnegative priorities for each action, or NULL if not needed */
72  SCIP_Real eps, /**< parameter to increase probability for exploration between all actions */
73  SCIP_Bool usemodification, /**< TRUE if modified eps greedy should be used */
74  SCIP_Bool preferrecent, /**< should the weights be updated in an exponentially decaying way? */
75  SCIP_Real decayfactor, /**< the factor to reduce the weight of older observations if exponential decay is enabled */
76  int avglim, /**< nonnegative limit on observation number before the exponential decay starts,
77  * only relevant if exponential decay is enabled
78  */
79  int nactions, /**< the number of possible actions */
80  unsigned int initseed /**< initial random seed */
81  );
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for return codes for SCIP methods
real eps
SCIP_DECL_BANDITSELECT(SCIPbanditSelectEpsgreedy)
type definitions for SCIP&#39;s main datastructure
SCIP_RETCODE SCIPbanditCreateEpsgreedy(BMS_BLKMEM *blkmem, BMS_BUFMEM *bufmem, SCIP_BANDITVTABLE *vtable, SCIP_BANDIT **epsgreedy, SCIP_Real *priorities, SCIP_Real eps, SCIP_Bool usemodification, SCIP_Bool preferrecent, SCIP_Real decayfactor, int avglim, int nactions, unsigned int initseed)
type definitions for bandit selection algorithms
#define SCIP_Bool
Definition: def.h:91
SCIP_DECL_BANDITRESET(SCIPbanditResetEpsgreedy)
SCIP_DECL_BANDITUPDATE(SCIPbanditUpdateEpsgreedy)
SCIP_RETCODE SCIPincludeBanditvtableEpsgreedy(SCIP *scip)
SCIP_DECL_BANDITFREE(SCIPbanditFreeEpsgreedy)
#define SCIP_Real
Definition: def.h:173
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
memory allocation routines