Scippy

UG

Ubiquity Generator framework

scipParaObjLimitUpdator.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and software framework */
4 /* UG --- Ubquity Generator Framework */
5 /* */
6 /* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7 /* Copyright (C) 2021 by Zuse Institute Berlin, */
8 /* licensed under LGPL version 3 or later. */
9 /* Commercial licenses are available through <licenses@zib.de> */
10 /* */
11 /* This code is free software; you can redistribute it and/or */
12 /* modify it under the terms of the GNU Lesser General Public License */
13 /* as published by the Free Software Foundation; either version 3 */
14 /* of the License, or (at your option) any later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* */
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25 
26 /**@file ScipParaObjLimitUpdator.h
27  * @brief heuristic to update objlimit
28  * @author Yuji Shinano
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #ifndef __SCIP_PARA_OBJ_LIMIT_UPDATOR_H__
34 #define __SCIP_PARA_OBJ_LIMIT_UPDATOR_H__
35 
36 #include "objscip/objscip.h"
37 #include "scipParaSolver.h"
38 
39 namespace ParaSCIP
40 {
41 
42 /** C++ wrapper */
43 class ScipParaObjLimitUpdator : public scip::ObjHeur
44 {
46  bool updated;
47 public:
48 
49  /** default constructor */
51  SCIP* scip,
52  ScipParaSolver *solver
53  )
54  : ObjHeur(scip, "ObjLim", "Objlimit updator", 'u',1000000, 1, 0, -1,
55  SCIP_HEURTIMING_DURINGLPLOOP | SCIP_HEURTIMING_AFTERNODE |
56  SCIP_HEURTIMING_BEFORENODE | SCIP_HEURTIMING_AFTERLPLOOP |
57  SCIP_HEURTIMING_AFTERPROPLOOP, FALSE),
58  scipParaSolver(solver), updated(false)
59  {
60  }
61 
62  /** destructor */
64  {
65  } /*lint !e1540*/
66 
67  /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
68  virtual SCIP_DECL_HEURFREE(scip_free);
69 
70  /** initialization method of primal heuristic (called after problem was transformed) */
71  virtual SCIP_DECL_HEURINIT(scip_init);
72 
73  /** deinitialization method of primal heuristic (called before transformed problem is freed) */
74  virtual SCIP_DECL_HEUREXIT(scip_exit);
75 
76  /** solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
77  *
78  * This method is called when the presolving was finished and the branch and bound process is about to begin.
79  * The primal heuristic may use this call to initialize its branch and bound specific data.
80  *
81  */
82  virtual SCIP_DECL_HEURINITSOL(scip_initsol);
83 
84  /** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
85  *
86  * This method is called before the branch and bound process is freed.
87  * The primal heuristic should use this call to clean up its branch and bound data.
88  */
89  virtual SCIP_DECL_HEUREXITSOL(scip_exitsol);
90 
91  /** execution method of primal heuristic
92  *
93  * Searches for feasible primal solutions. The method is called in the node processing loop.
94  *
95  * possible return values for *result:
96  * - SCIP_FOUNDSOL : at least one feasible primal solution was found
97  * - SCIP_DIDNOTFIND : the heuristic searched, but did not find a feasible solution
98  * - SCIP_DIDNOTRUN : the heuristic was skipped
99  * - SCIP_DELAYED : the heuristic was skipped, but should be called again as soon as possible, disregarding
100  * its frequency
101  */
102  virtual SCIP_DECL_HEUREXEC(scip_exec);
103 
104  /** clone method which will be used to copy a objective plugin */
105  virtual SCIP_DECL_HEURCLONE(ObjCloneable* clone); /*lint !e665*/
106 
107  /** returns whether the objective plugin is copyable */
108  virtual SCIP_DECL_HEURISCLONEABLE(iscloneable)
109  {
110  return true;
111  }
112 
113  void update()
114  {
115  updated = true;
116  }
117 
118 }; /*lint !e1712*/
119 
120 }
121 
122 #endif
virtual SCIP_DECL_HEURFREE(scip_free)
virtual SCIP_DECL_HEURCLONE(ObjCloneable *clone)
ScipParaObjLimitUpdator(SCIP *scip, ScipParaSolver *solver)
virtual SCIP_DECL_HEUREXIT(scip_exit)
virtual SCIP_DECL_HEUREXEC(scip_exec)
ParaSolver extension for SCIP: Parallelized solver implementation for SCIP.
virtual SCIP_DECL_HEURINIT(scip_init)
virtual SCIP_DECL_HEUREXITSOL(scip_exitsol)
virtual SCIP_DECL_HEURINITSOL(scip_initsol)