Scippy

UG

Ubiquity Generator framework

bbParaDiffSubproblem.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 paraDiffSubproblem.h
27  * @brief Base class for a container which has difference between instance and subproblem.
28  * @author Yuji Shinano
29  *
30  *
31  *
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 
37 #ifndef __BB_PARA_DIFF_SUBPROBLEM_H__
38 #define __BB_PARA_DIFF_SUBPROBLEM_H__
39 
40 #include <iostream>
41 #include <fstream>
42 
43 #ifdef UG_WITH_ZLIB
44 #include "ug/gzstream.h"
45 #endif
46 #include "ug/paraDiffSubproblem.h"
47 #include "ug/paraComm.h"
48 #include "ug/paraInstance.h"
49 #include "bbParaNodesMerger.h"
50 
51 
52 /** uncomment this define to activate debugging on given solution */
53 /** PARASCIP_DEBUG only valid for PARASCIP */
54 // #define UG_DEBUG_SOLUTION "timtab2-trans.sol"
55 
56 namespace UG
57 {
58 
59 class ParaInitiator;
60 class BbParaRacingRampUpParamSet;
61 
62 ///
63 /// Class for the difference between instance and subproblem
64 ///
65 /// This class should NOT have any data member.
66 ///
68 {
69 
70  ///
71  /// DO NOT HAVE DATA MEMBER!!
72  ///
73 
74 public:
75 
76  ///
77  /// default constructor
78  ///
80  )
81  {
82  }
83 
84  ///
85  /// destractor¥
86  ///
88  )
89  {
90  }
91 
92 #ifdef UG_WITH_ZLIB
93 
94  ///
95  /// function to read BbParaDiffSubproblem object from checkpoint file
96  ///
97  virtual void read(
98  ParaComm *comm, ///< communicator used
99  gzstream::igzstream &in, ///< gzstream for input
100  bool onlyBoundChanges ///< indicate if only bound changes are output or not
101  ) = 0;
102 
103 #endif
104 
105  ///
106  /// get the number of bound changes
107  /// @return the number of bound changes
108  ///
109  virtual int getNBoundChanges(
110  ) = 0;
111 
112  ///
113  /// get the number of fixed variables
114  /// @return the number of fixed variables
115  ///
116  virtual int getFixedVariables(
117  ParaInstance *instance, ///< pointer to instance object
118  BbParaFixedVariable **fixedVars ///< array of fixed variables
119  ) = 0;
120 
121  ///
122  /// create new BbParaDiffSubproblem object using fixed variables information
123  /// @return pointer to BbParaDiffSubproblem object
124  ///
126  ParaComm *comm, ///< communicator used
127  ParaInitiator *initiator, ///< point to ParaInitiator object
128  int n, ///< the number of fixed variables
129  BbParaFixedVariable *fixedVars ///< array of the fixed variables
130  ) = 0;
131 
132  ///
133  /// stringfy statistics of BbParaDiffSubproblem object
134  /// @return string to show some statistics of this object
135  ///
136  virtual const std::string toStringStat(
137  )
138  {
139  return std::string("");
140  }
141 
142 
143  ///
144  /// set winner racing parameters at warm start racing
145  ///
146  virtual void setWinnerParams(
147  BbParaRacingRampUpParamSet *winerParams ///< pointer to winner racing ramp-up parameters
148  )
149  {
150  std::cout << "**** virtual function UG::BbParaDiffSubproblem::setWinnerParams() is called. *****" << std::endl;
151  }
152 
153  ///
154  /// get winner racing parameters at warm start racing
155  /// @return winner racing ramp-up parameters
156  ///
158  )
159  {
160  std::cout << "**** virtual function UG::BbParaDiffSubproblem::getWinnerParams() is called. *****" << std::endl;
161  return 0;
162  }
163 
164 };
165 
166 }
167 
168 #endif // __BB_PARA_DIFF_SUBPROBLEM_H__
virtual int getNBoundChanges()=0
get the number of bound changes
virtual ~BbParaDiffSubproblem()
destractor¥
class BbParaRacingRampUpParamSet (parameter set for racing ramp-up)
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Base class for a container which has difference between instance and subproblem.
Fixed variable struct.
virtual void setWinnerParams(BbParaRacingRampUpParamSet *winerParams)
set winner racing parameters at warm start racing
Class for initiator.
Definition: paraInitiator.h:62
virtual BbParaRacingRampUpParamSet * getWinnerParams()
get winner racing parameters at warm start racing
Base class of communicator for UG Framework.
Base class for instance data.
Class for the difference between instance and subproblem.
virtual const std::string toStringStat()
stringfy statistics of BbParaDiffSubproblem object
class for instance data
Definition: paraInstance.h:50
Class for the difference between instance and subproblem.
void read(ParaComm *comm, const char *filename)
read ParaParams from file
virtual int getFixedVariables(ParaInstance *instance, BbParaFixedVariable **fixedVars)=0
get the number of fixed variables
virtual BbParaDiffSubproblem * createDiffSubproblem(ParaComm *comm, ParaInitiator *initiator, int n, BbParaFixedVariable *fixedVars)=0
create new BbParaDiffSubproblem object using fixed variables information
Base class of communicator object.
Definition: paraComm.h:101
BbParaDiffSubproblem()
DO NOT HAVE DATA MEMBER!!