Scippy

UG

Ubiquity Generator framework

paraDiffSubproblem.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 __PARA_DIFF_SUBPROBLEM_H__
38 #define __PARA_DIFF_SUBPROBLEM_H__
39 
40 #include <iostream>
41 #include <fstream>
42 
43 #ifdef UG_WITH_ZLIB
44 #include "gzstream.h"
45 #endif
46 
47 #include "paraComm.h"
48 #include "paraInstance.h"
49 // #include "paraMergeNodesStructs.h"
50 
51 /** uncomment this define to activate debugging on given solution */
52 /** PARASCIP_DEBUG only valid for PARASCIP */
53 // #define UG_DEBUG_SOLUTION "timtab2-trans.sol"
54 
55 namespace UG
56 {
57 
58 class ParaInitiator;
59 
60 ///
61 /// Class for the difference between instance and subproblem
62 ///
63 /// This class should NOT have any data member.
64 ///
66 
67  ///
68  /// DO NOT HAVE DATA MEMBER!!
69  ///
70 
71 public:
72 
73  ///
74  /// default constructor
75  ///
77  )
78  {
79  }
80 
81  ///
82  /// destractor¥
83  ///
85  )
86  {
87  }
88 
89  ///
90  /// create clone of this object
91  /// @return pointer to ParaDiffSubproblem object
92  ///
93  virtual ParaDiffSubproblem *clone(
94  ParaComm *comm ///< communicator used
95  ) = 0;
96 
97  ///
98  /// broadcast function for ParaDiffSubproblem object
99  /// @return always 0 (for future extensions)
100  ///
101  virtual int bcast(
102  ParaComm *comm, ///< communicator used
103  int root ///< root rank of broadcast
104  ) = 0;
105 
106  ///
107  /// send function for ParaDiffSubproblem object
108  /// @return always 0 (for future extensions)
109  ///
110  virtual int send(
111  ParaComm *comm, ///< communicator used
112  int dest ///< destination rank
113  ) = 0;
114 
115  ///
116  /// receive function for ParaDiffSubproblem object
117  /// @return always 0 (for future extensions)
118  ///
119  virtual int receive(
120  ParaComm *comm, ///< communicator used
121  int source ///< source rank
122  ) = 0;
123 
124 #ifdef UG_WITH_ZLIB
125 
126  ///
127  /// function to write ParaDiffSubproblem object to checkpoint file
128  ///
129  virtual void write(
130  gzstream::ogzstream &out ///< gzstream for output
131  ) = 0;
132 
133 #endif
134 
135  ///
136  /// stringfy ParaDiffSubproblem object ( for debugging )
137  /// @return string to show inside of this object
138  ///
139  virtual const std::string toString(
140  ) = 0;
141 
142 #ifdef UG_DEBUG_SOLUTION
143 
144  ///
145  /// check if an optimal solution is included in this subproblem or not (for debugging)
146  ///
147  virtual bool isOptimalSolIncluded(
148  ) = 0;
149 
150  ///
151  /// set indicator to show that an optimal solution is included (for debugging)
152  ///
153  virtual void setOptimalSolIndicator(
154  int i ///< 1: when an optimal solution is included, 0 others
155  ) = 0;
156 
157 #endif
158 
159 };
160 
161 }
162 
163 #endif // __PARA_DIFF_SUBPROBLEM_H__
164 
static ScipParaCommTh * comm
Definition: fscip.cpp:73
virtual ~ParaDiffSubproblem()
destractor¥
ParaDiffSubproblem()
DO NOT HAVE DATA MEMBER!!
Base class of communicator for UG Framework.
virtual ParaDiffSubproblem * clone(ParaComm *comm)=0
create clone of this object
Base class for instance data.
Class for the difference between instance and subproblem.
virtual int send(ParaComm *comm, int dest)=0
send function for ParaDiffSubproblem object
virtual const std::string toString()=0
stringfy ParaDiffSubproblem object ( for debugging )
virtual int receive(ParaComm *comm, int source)=0
receive function for ParaDiffSubproblem object
virtual int bcast(ParaComm *comm, int root)=0
broadcast function for ParaDiffSubproblem object
Base class of communicator object.
Definition: paraComm.h:101