Scippy

UG

Ubiquity Generator framework

bbParaNodeTh.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-2024 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 bbParaNodeTh.h
27 * @brief BbParaNode extension for threads communication.
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_NODE_TH_H__
38#define __BB_PARA_NODE_TH_H__
39
40#include <iostream>
41#include <fstream>
42#include "bbParaComm.h"
43#include "bbParaNode.h"
44
45namespace UG
46{
47
48///
49/// class BbParaNodeTh
50///
52{
53 ///
54 /// create BbParaNode datatype
55 /// @return pointer to BbParaNodeTh object
56 ///
58 ParaComm *comm ///< communicator used
59 );
60
61public :
62
63 ///
64 /// default constructor
65 ///
67 )
68 {
69 }
70
71 ///
72 /// constructor
73 ///
75 TaskId inNodeId, ///< node id
76 TaskId inGeneratorNodeId, ///< generator node id
77 int inDepth, ///< depth in global search tree
78 double inDualBoundValue, ///< dual bound value
79 double inOriginalDualBoundValue, ///< original dual bound value when the node is generated
80 double inEstimatedValue, ///< estimated value
81 ParaDiffSubproblem *inDiffSubproblem ///< pointer to ParaDiffSubproblem object
82 )
83 : BbParaNode(inNodeId, inGeneratorNodeId, inDepth, inDualBoundValue, inOriginalDualBoundValue, inEstimatedValue, inDiffSubproblem)
84 {
85 }
86
87 ///
88 /// destructor
89 ///
91 )
92 {
93 }
94
95 ///
96 /// clone this BbParaNodeTh
97 /// @return pointer to cloned BbParaNodeTh object
98 ///
100 ParaComm *comm ///< communicator used
101 )
102 {
103 if( diffSubproblem )
104 {
105 return ( new
108 }
109 else
110 {
111 return ( new
114 }
115 }
116
117 ///
118 /// broadcast this object
119 /// @return always 0 (for future extensions)
120 ///
121 int bcast(
122 ParaComm *comm, ///< communicator used
123 int root ///< root rank of broadcast
124 );
125
126 ///
127 /// send this object
128 /// @return always 0 (for future extensions)
129 ///
130 int send(
131 ParaComm *comm, ///< communicator used
132 int destination ///< destination rank
133 );
134
135 ///
136 /// receive this object
137 /// @return always 0 (for future extensions)
138 ///
139 int receive(
140 ParaComm *comm, ///< communicator used
141 int source ///< source rank
142 );
143
144 ///
145 /// send new subtree root node
146 /// @return always 0 (for future extensions)
147 ///
149 ParaComm *comm, ///< communicator used
150 int destination ///< destination rank
151 );
152
153 ///
154 /// send subtree root to be removed
155 /// @return always 0 (for future extensions)
156 ///
158 ParaComm *comm, ///< communicator used
159 int destination, ///< destination rank
160 int tag ///< tag of message
161 );
162
163// ///
164// /// send subtree root to be reassigned
165// /// @return always 0 (for future extensions)
166// ///
167// int sendReassignSelfSplitSubtreeRoot(
168// ParaComm *comm, ///< communicator used
169// int destination ///< destination rank
170// );
171
172 ///
173 /// receive this object
174 /// @return always 0 (for future extensions)
175 ///
177 ParaComm *comm, ///< communicator used
178 int source ///< source rank
179 );
180
181 ///
182 /// receive this object node Id
183 /// @return always 0 (for future extensions)
184 ///
186 ParaComm *comm, ///< communicator used
187 int source, ///< source rank
188 int tag ///< tag of message
189 );
190
191// ///
192// /// receive this object node Id
193// /// @return always 0 (for future extensions)
194// ///
195// int receiveReassignSelfSplitSubtreeRoot(
196// ParaComm *comm, ///< communicator used
197// int source ///< source rank
198// );
199
200};
201
202}
203
204#endif // __BB_PARA_NODE_TH_H__
Base class of communicator for UG Framework.
Base class for BbParaNode.
class BbParaNodeTh
Definition: bbParaNodeTh.h:52
BbParaNodeTh(TaskId inNodeId, TaskId inGeneratorNodeId, int inDepth, double inDualBoundValue, double inOriginalDualBoundValue, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
constructor
Definition: bbParaNodeTh.h:74
int sendSubtreeRootNodeId(ParaComm *comm, int destination, int tag)
send subtree root to be removed
~BbParaNodeTh()
destructor
Definition: bbParaNodeTh.h:90
BbParaNodeTh * createDatatype(ParaComm *comm)
create BbParaNode datatype
int sendNewSubtreeRoot(ParaComm *comm, int destination)
send new subtree root node
BbParaNodeTh * clone(ParaComm *comm)
clone this BbParaNodeTh
Definition: bbParaNodeTh.h:99
int bcast(ParaComm *comm, int root)
broadcast this object
int receive(ParaComm *comm, int source)
receive this object
int receiveNewSubtreeRoot(ParaComm *comm, int source)
receive this object
int send(ParaComm *comm, int destination)
send this object
BbParaNodeTh()
default constructor
Definition: bbParaNodeTh.h:66
int receiveSubtreeRootNodeId(ParaComm *comm, int source, int tag)
receive this object node Id
class BbParaNode
Definition: bbParaNode.h:62
double dualBoundValue
dual bound value
Definition: bbParaNode.h:67
double initialDualBoundValue
dual bound value when this node is created This value is updated to precise one when there is guarant...
Definition: bbParaNode.h:68
int depth
depth from the root node of original tree
Definition: bbParaNode.h:66
Base class of communicator object.
Definition: paraComm.h:102
Class for the difference between instance and subproblem.
virtual ParaDiffSubproblem * clone(ParaComm *comm)=0
create clone of this object
ParaDiffSubproblem * diffSubproblem
difference between solving instance data and subproblem data
Definition: paraTask.h:558
TaskId taskId
solving task information
Definition: paraTask.h:549
TaskId generatorTaskId
subtree root task id of generator
Definition: paraTask.h:550
TaskId class.
Definition: paraTask.h:223
static ScipParaCommTh * comm
Definition: fscip.cpp:73