Scippy

UG

Ubiquity Generator framework

bbParaNode.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 paraNode.h
27  * @brief Base class for BbParaNode.
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_H__
38 #define __BB_PARA_NODE_H__
39 
40 #include <cassert>
41 #include <iostream>
42 #include <fstream>
43 #include <map>
44 #include "ug/paraDef.h"
45 #include "ug/paraComm.h"
46 #ifdef UG_WITH_ZLIB
47 #include "ug/gzstream.h"
48 #endif
49 #include "ug/paraTask.h"
50 #include "bbParaDiffSubproblem.h"
51 #include "bbParaNodesMerger.h"
52 
53 
54 namespace UG
55 {
56 
57 
58 ///
59 /// class BbParaNode
60 ///
61 class BbParaNode : public ParaTask
62 {
63 
64 protected:
65 
66  int depth; ///< depth from the root node of original tree
67  double dualBoundValue; ///< dual bound value
68  double initialDualBoundValue; ///< dual bound value when this node is created
69  ///< This value is updated to precise one when there is guarantee
70  int basisInfo; ///< indicate if basis information is including or not
71  int mergingStatus; ///< merging status:
72  ///< -1 - no merging node,
73  ///< 0 - checking,
74  ///< 1 - merged (representative)
75  ///< 2 - merged to the other node
76  ///< 3 - cannot be merged
77  ///< 4 - merging representative was deleted
78  BbParaMergeNodeInfo *mergeNodeInfo; ///< pointer to mergeNodeInfo. Not zero means merging
79  bool nodesAreCollected; ///< subproblems generated from this nodes are collected at interruption.
80  ///< this field is not transferred
81 public:
82 
83  BbParaNode *next; ///< this pointer is used in case of self-split ramp-up in LC
84  ///< this field is not transferred
85 
86  ///
87  /// default constructor
88  ///
90  )
91  : ParaTask(),
92  depth(-1),
93  dualBoundValue(-DBL_MAX),
94  initialDualBoundValue(0.0),
95  basisInfo(0),
96  mergingStatus(-1),
97  mergeNodeInfo(0),
98  nodesAreCollected(false),
99  next(0)
100  {
101  }
102 
103  ///
104  /// constructor
105  ///
107  TaskId inNodeId, ///< node id
108  TaskId inGeneratorNodeId, ///< generator node id
109  int inDepth, ///< depth in global search tree
110  double inDualBoundValue, ///< dual bound value
111  double inOriginalDualBoundValue, ///< original dual bound value when the node is generated
112  double inEstimatedValue, ///< estimated value
113  ParaDiffSubproblem *inDiffSubproblem ///< pointer to BbParaDiffSubproblem object
114  )
115  : ParaTask(inNodeId, inGeneratorNodeId, inEstimatedValue, inDiffSubproblem),
116  depth(inDepth),
117  dualBoundValue(inDualBoundValue),
118  initialDualBoundValue(inOriginalDualBoundValue),
119  basisInfo(0),
120  mergingStatus(-1),
121  mergeNodeInfo(0),
122  nodesAreCollected(false),
123  next(0)
124  {
125  }
126 
127  ///
128  /// destructor
129  ///
130  virtual ~BbParaNode(
131  )
132  {
133  assert((mergingStatus != -1) || (mergingStatus == -1 && mergeNodeInfo == 0) );
134 
135  if( ancestor )
136  {
137  ParaTaskGenealogicalLocalPtr *localPtrAncestor = dynamic_cast< ParaTaskGenealogicalLocalPtr * >(ancestor);
138  if( !descendants.empty() )
139  {
140  std::map< TaskId, ParaTaskGenealogicalPtrPtr >::iterator pos;
141  for( pos = descendants.begin(); pos != descendants.end(); )
142  {
143  if( pos->second->getType() == ParaTaskLocalPtr )
144  {
145  ParaTaskGenealogicalLocalPtr *localPtrDescendant = dynamic_cast< ParaTaskGenealogicalLocalPtr * >(pos->second);
146  assert( localPtrDescendant->getPointerValue()->ancestor->getTaskId() == taskId );
147  assert( localPtrAncestor->getTaskId() == localPtrAncestor->getPointerValue()->taskId );
148  assert( localPtrDescendant->getTaskId() == localPtrDescendant->getPointerValue()->taskId );
149  localPtrDescendant->getPointerValue()->setAncestor(
150  new ParaTaskGenealogicalLocalPtr( localPtrAncestor->getTaskId(), localPtrAncestor->getPointerValue() ) );
151  localPtrAncestor->getPointerValue()->addDescendant(
152  new ParaTaskGenealogicalLocalPtr( localPtrDescendant->getTaskId(), localPtrDescendant->getPointerValue() ) );
153  }
154  else
155  { /** not implemented yet **/
156  ABORT_LOGICAL_ERROR1("remote pointer is not implemented yet, but it is called!");
157  }
158  delete pos->second;
159  descendants.erase(pos++);
160  }
161  }
162  if( ancestor->getType() == ParaTaskLocalPtr )
163  {
164  assert( localPtrAncestor->getTaskId() == localPtrAncestor->getPointerValue()->taskId );
165  localPtrAncestor->getPointerValue()->removeDescendant(taskId);
166  }
167  else
168  { /** not implemented yet **/
169  ABORT_LOGICAL_ERROR1("remote pointer is not implemented yet, but it is called!");
170  }
171  delete ancestor;
172  }
173  else
174  {
175  if( !descendants.empty() )
176  {
177  std::map< TaskId, ParaTaskGenealogicalPtrPtr >::iterator pos;
178  for( pos = descendants.begin(); pos != descendants.end(); )
179  {
180  if( pos->second->getType() == ParaTaskLocalPtr )
181  {
182  ParaTaskGenealogicalLocalPtr *localPtrDescendant = dynamic_cast< ParaTaskGenealogicalLocalPtr * >(pos->second);
183  localPtrDescendant->getPointerValue()->setAncestor(0);
184  }
185  else
186  { /** not implemented yet **/
187  ABORT_LOGICAL_ERROR1("remote pointer is not implemented yet, but it is called!");
188  }
189  delete pos->second;
190  descendants.erase(pos++);
191  }
192  }
193  }
194  if( mergeNodeInfo )
195  {
196  if( mergeNodeInfo->nMergedNodes == 0 && mergeNodeInfo->mergedTo )
197  {
200  mergeNodeInfo->mergedTo->nMergedNodes--;
201  }
202 
203  assert( mergeNodeInfo->status != BbParaMergeNodeInfo::PARA_MERGING);
204 
206  {
207  for( BbParaFixedVariable *traverse = mergeNodeInfo->fixedVariables[mergeNodeInfo->keyIndex].next;
208  traverse;
209  traverse = traverse->next )
210  {
211  if( traverse->mnode->nMergedNodes == 0 && mergeNodeInfo == traverse->mnode->mergedTo )
212  {
213  traverse->mnode->mergedTo->nMergedNodes--;
214  traverse->mnode->mergedTo = 0;
215  if( traverse->mnode->paraNode->getDualBoundValue() < mergeNodeInfo->paraNode->getDualBoundValue() )
216  {
217  traverse->mnode->paraNode->setMergingStatus(0);
218  traverse->mnode->status = BbParaMergeNodeInfo::PARA_MERGING;
219  traverse->mnode->nMergedNodes = -1;
220  traverse->mnode->nSameValueVariables = -1;
221  traverse->mnode->keyIndex = -1;
222  }
223  else
224  {
225  traverse->mnode->paraNode->setMergingStatus(4); // merging representative was deleted -> this node should be deleted
226  traverse->mnode->status = BbParaMergeNodeInfo::PARA_DELETED;
227  traverse->mnode->nMergedNodes = -1;
228  traverse->mnode->nSameValueVariables = -1;
229  traverse->mnode->keyIndex = -1;
230  }
231  }
232  }
233  }
234 
235  if( mergeNodeInfo->fixedVariables )
236  {
237  for( int i = 0; i < mergeNodeInfo->nFixedVariables; i++ )
238  {
239  for( BbParaFixedVariable *traverse = mergeNodeInfo->fixedVariables[i].prev;
240  traverse;
241  traverse = traverse->prev
242  )
243  {
244  traverse->nSameValue--;
245  }
246  if( mergeNodeInfo->fixedVariables[i].prev )
247  {
248  mergeNodeInfo->fixedVariables[i].prev->next = mergeNodeInfo->fixedVariables[i].next;
249  if( mergeNodeInfo->fixedVariables[i].next )
250  {
251  mergeNodeInfo->fixedVariables[i].next->prev = mergeNodeInfo->fixedVariables[i].prev;
252  }
253  else
254  {
255  mergeNodeInfo->fixedVariables[i].prev->next = 0;
256  }
257  }
258  else
259  {
260  if( mergeNodeInfo->fixedVariables[i].next )
261  {
262  mergeNodeInfo->fixedVariables[i].next->prev = 0;
263  }
264  }
265  }
266  delete [] mergeNodeInfo->fixedVariables;
267  }
268  if( mergeNodeInfo->origDiffSubproblem )
269  {
270  if( mergeNodeInfo->origDiffSubproblem != diffSubproblem )
271  {
272  delete mergeNodeInfo->origDiffSubproblem;
273  }
274  }
275  delete mergeNodeInfo;
276  }
277  }
278 
279  ///
280  /// getter of depth
281  /// @return depth of this node in global tree
282  ///
283  int getDepth(
284  )
285  {
286  return depth;
287  }
288 
289  ///
290  /// setter of depth
291  ///
292  void setDepth(
293  int inDepth ///< depth
294  )
295  {
296  depth = inDepth;
297  }
298 
299  ///
300  /// getter of dual bound value
301  /// @return dual bound value
302  ///
304  )
305  {
306  return dualBoundValue;
307  }
308 
309  ///
310  /// getter of initial dual bound value
311  /// @return initial dual bound value
312  ///
313  ///
315  )
316  {
317  return initialDualBoundValue;
318  }
319 
320  ///
321  /// setter of dual bound value
322  ///
324  double inDualBoundValue ///< dual bound value
325  )
326  {
327  dualBoundValue = inDualBoundValue;
328  }
329 
330  ///
331  /// setter of initial dual bound value
332  ///
334  double inTrueDualBoundValue ///< inital dual bound value
335  )
336  {
337  initialDualBoundValue = inTrueDualBoundValue;
338  }
339 
340  ///
341  /// reset dual bound value
342  ///
344  )
345  {
346  dualBoundValue = initialDualBoundValue;
347  }
348 
349  ///
350  /// getter of diffSubproblem
351  /// @return pointer to BbParaDiffSubproblem object
352  ///
354  )
355  {
356  return dynamic_cast<BbParaDiffSubproblem *>(diffSubproblem);
357  }
358 
359  ///
360  /// setter of diffSubproblem */
361  ///
363  BbParaDiffSubproblem *inDiffSubproblem ///< pointer to BbParaDiffSubproblem object
364  )
365  {
366  diffSubproblem = inDiffSubproblem;
367  }
368 
369  ///
370  /// getter of ancestor
371  /// @return ancestor BbParaNodeGenealogicalPtr
372  ///
374  )
375  {
376  return ancestor;
377  }
378 
379  ///
380  /// setter of ancestor
381  ///
383  ParaTaskGenealogicalPtr *inAncestor ///< ancestor BbParaNodeGenealogicalPtr
384  )
385  {
386  if( ancestor ) delete ancestor;
387  ancestor = inAncestor;
388  }
389 
390  ///
391  /// remove a descendant
392  ///
394  TaskId removeNodeId ///< node id to remove
395  )
396  {
397  std::map< TaskId, ParaTaskGenealogicalPtrPtr >::iterator pos;
398  pos = descendants.find(removeNodeId);
399  if( pos != descendants.end() )
400  {
401  delete pos->second;
402  descendants.erase(pos);
403  }
404  else
405  {
406  for( pos = descendants.begin(); pos != descendants.end(); )
407  {
408  if( pos->second->getType() == ParaTaskLocalPtr )
409  {
410  ParaTaskGenealogicalLocalPtr *localPtrDescendant = dynamic_cast< ParaTaskGenealogicalLocalPtr * >(pos->second);
411  std::cout << "Descendant NodeId = " << localPtrDescendant->getTaskId().toString() << std::endl;
412  }
413  else
414  {
415  /** not implemented yet */
416  }
417  pos++;
418  }
419  THROW_LOGICAL_ERROR1("invalid NodeId removed!");
420  }
421  }
422 
423  ///
424  /// check if this node has descendant or not
425  /// @return true if it has descendant
426  ///
428  )
429  {
430  return !(descendants.empty());
431  }
432 
433  ///
434  /// add a descendant
435  ///
437  ParaTaskGenealogicalPtr *inDescendant ///< descendant BbParaNodeGenealogicalPtr
438  )
439  {
440  descendants.insert(std::make_pair(inDescendant->getTaskId(),inDescendant));
441  }
442 
443  ///
444  /// update initial dual bound value by checking descendant dual bound values
445  ///
447  )
448  {
449  // dualBoundValue = getMinimumDualBoundInDesendants(dualBoundValue);
450  /** More accurate dual bound of this node is obtained */
451  initialDualBoundValue = getMinimumDualBoundInDesendants(dualBoundValue);
452  }
453 
454  ///
455  /// get minimum dual bound value in descendants
456  /// @return dual bound value
457  ///
459  double value
460  )
461  {
462  if( descendants.empty() ) return value;
463  std::map< TaskId, ParaTaskGenealogicalPtrPtr >::iterator pos;
464  for( pos = descendants.begin(); pos != descendants.end(); )
465  {
466  if( pos->second->getType() == ParaTaskLocalPtr )
467  {
468  ParaTaskGenealogicalLocalPtr *localPtrDescendant = dynamic_cast< ParaTaskGenealogicalLocalPtr * >(pos->second);
469  value = std::min( value, dynamic_cast<BbParaNode *>(localPtrDescendant->getPointerValue())->getDualBoundValue() );
470  value = std::min(
471  value,
472  dynamic_cast<BbParaNode *>(localPtrDescendant->getPointerValue())->getMinimumDualBoundInDesendants(value));
473  }
474  else
475  {
476  /** not implemented yet */
477  }
478  pos++;
479  }
480  return value;
481  }
482 
483  ///
484  /// clone this BbParaNode
485  /// @return pointer to cloned BbParaNode object
486  ///
487  virtual BbParaNode* clone(
488  ParaComm *comm ///< communicator used
489  ) = 0;
490 
491  ///
492  /// broadcast this object
493  /// @return always 0 (for future extensions)
494  ///
495  virtual int bcast(
496  ParaComm *comm, ///< communicator used
497  int root ///< root rank of broadcast
498  ) = 0;
499 
500  ///
501  /// send this object
502  /// @return always 0 (for future extensions)
503  ///
504  virtual int send(
505  ParaComm *comm, ///< communicator used
506  int destination ///< destination rank
507  ) = 0;
508 
509  ///
510  /// receive this object
511  /// @return always 0 (for future extensions)
512  ///
513  virtual int receive(
514  ParaComm *comm, ///< communicator used
515  int source ///< source rank
516  ) = 0;
517 
518  ///
519  /// send new subtree root node
520  /// @return always 0 (for future extensions)
521  ///
522  virtual int sendNewSubtreeRoot(
523  ParaComm *comm, ///< communicator used
524  int destination ///< destination rank
525  ) = 0;
526 
527  ///
528  /// send subtree root to be removed
529  /// @return always 0 (for future extensions)
530  ///
531  virtual int sendSubtreeRootNodeId(
532  ParaComm *comm, ///< communicator used
533  int destination, ///< destination rank
534  int tag ///< tag of message
535  ) = 0;
536 
537 // ///
538 // /// send subtree root to be reassigned
539 // /// @return always 0 (for future extensions)
540 // ///
541 // virtual int sendReassignSelfSplitSubtreeRoot(
542 // ParaComm *comm, ///< communicator used
543 // int destination ///< destination rank
544 // ) = 0;
545 
546  ///
547  /// receive this object
548  /// @return always 0 (for future extensions)
549  ///
550  virtual int receiveNewSubtreeRoot(
551  ParaComm *comm, ///< communicator used
552  int source ///< source rank
553  ) = 0;
554 
555  ///
556  /// receive this object node Id
557  /// @return always 0 (for future extensions)
558  ///
559  virtual int receiveSubtreeRootNodeId(
560  ParaComm *comm, ///< communicator used
561  int source, ///< source rank
562  int tag ///< tag of message
563  ) = 0;
564 
565 // ///
566 // /// receive this object node Id
567 // /// @return always 0 (for future extensions)
568 // ///
569 // virtual int receiveReassignSelfSplitSubtreeRoot(
570 // ParaComm *comm, ///< communicator used
571 // int source ///< source rank
572 // ) = 0;
573 
574 
575 
576 #ifdef UG_WITH_ZLIB
577 
578  ///
579  /// write to checkpoint file
580  ///
581  void write(
582  gzstream::ogzstream &out ///< gzstream for output
583  );
584 
585  ///
586  /// read from checkpoint file
587  ///
588  bool read(
589  ParaComm *comm, ///< communicator used
590  gzstream::igzstream &in, ///< gzstream for input
591  bool onlyBoundChanges ///< indicate if only bound changes are read or not
592  );
593 
594 #endif
595 
596  ///
597  /// stringfy BbParaNode
598  /// @return string to show inside of this object
599  ///
600  const std::string toString(
601  )
602  {
603  std::ostringstream s;
604  s << "BbParaNodeId = " << (taskId.toString()) << ", GeneratorNodeId = " << (generatorTaskId.toString())
605  << ", depth = " << depth << ", dual bound value = " << dualBoundValue
606  << ", initialDualBoundValue = " << initialDualBoundValue
607  << ", estimated value = " << estimatedValue << std::endl;
608  if( diffSubproblem )
609  {
610  s << diffSubproblem->toString();
611  }
612  return s.str();
613  }
614 
615  ///
616  /// stringfy BbParaNode as simple string
617  /// @return string to show inside of this object
618  ///
619  const std::string toSimpleString(
620  )
621  {
622  std::ostringstream s;
623  s << taskId.toString()
624  << ", "
626  << ", ";
627  if( diffSubproblem )
628  {
629  s << dynamic_cast<BbParaDiffSubproblem *>(diffSubproblem)->getNBoundChanges();
630  }
631  else
632  {
633  s << 0;
634  }
635  s << ", " << depth
636  << ", "
637  << initialDualBoundValue
638  << ", "
639  << dualBoundValue;
640  return s.str();
641  }
642 
643  ///
644  /// set merge node information to this BbParaNode object
645  ///
647  BbParaMergeNodeInfo *mNode ///< pointer to merge node information struct
648  )
649  {
650  assert(mergingStatus != -1);
651  mergeNodeInfo = mNode;
652  }
653 
654  ///
655  /// get merge node information struct
656  /// @return pointer to merge node information struct
657  ///
659  )
660  {
661  return mergeNodeInfo;
662  }
663 
664  ///
665  /// set merging status
666  ///
668  int status ///< merging status
669  )
670  {
671  mergingStatus = status;
672  }
673 
674  ///
675  /// get merging status
676  /// @return merging status
677  ///
679  )
680  {
681  return mergingStatus;
682  }
683 
684  ///
685  /// check if nodes are collected or not
686  /// @return true if they are collected
687  ///
689  )
690  {
691  return nodesAreCollected;
692  }
693 
694  ///
695  /// set all nodes are collected
696  /// TODO: this function has to be investigated
697  ///
699  )
700  {
701  nodesAreCollected = true;
702  }
703 
704  ///
705  /// check if this node's id is the same as that of argument ParaNode's task id
706  /// @return true if the both are the same
707  ///
709  const BbParaNode& inNode ///< ParaNode
710  )
711  {
712  if( taskId.subtaskId == inNode.taskId.subtaskId && generatorTaskId == inNode.generatorTaskId )
713  return true;
714  else return false;
715  }
716 
717 
718 };
719 
721 
722 }
723 
724 #endif // __BB_PARA_NODE_H__
725 
static const int ParaTaskLocalPtr
Definition: paraTask.h:54
BbParaFixedVariable * prev
pointer to the previous node which has the same fixed value
double estimatedValue
estimate value
Definition: paraTask.h:556
double dualBoundValue
dual bound value
Definition: bbParaNode.h:67
int basisInfo
indicate if basis information is including or not
Definition: bbParaNode.h:70
double getMinimumDualBoundInDesendants(double value)
get minimum dual bound value in descendants
Definition: bbParaNode.h:458
void collectsNodes()
set all nodes are collected TODO: this function has to be investigated
Definition: bbParaNode.h:698
int nMergedNodes
the number of merged nodes with this node.
BbParaMergeNodeInfo * getMergeNodeInfo()
get merge node information struct
Definition: bbParaNode.h:658
static ScipParaCommTh * comm
Definition: fscip.cpp:73
enum UG::BbParaMergeNodeInfo_::@0 status
status of this ParaMargeNodeInfo
Fixed variable struct.
void addDescendant(ParaTaskGenealogicalPtr *inDescendant)
add a descendant
Definition: bbParaNode.h:436
void setDiffSubproblem(BbParaDiffSubproblem *inDiffSubproblem)
setter of diffSubproblem */
Definition: bbParaNode.h:362
virtual int sendSubtreeRootNodeId(ParaComm *comm, int destination, int tag)=0
send subtree root to be removed
BbParaFixedVariable * fixedVariables
array of fixed variable info
void resetDualBoundValue()
reset dual bound value
Definition: bbParaNode.h:343
ParaTaskGenealogicalPtr * ancestor
pointer to ancestor ParaTask : This field is not transferred
Definition: paraTask.h:551
#define ABORT_LOGICAL_ERROR1(msg1)
Definition: paraDef.h:61
Base class for ParaTask.
bool nodesAreCollected
subproblems generated from this nodes are collected at interruption. this field is not transferred ...
Definition: bbParaNode.h:79
virtual ~BbParaNode()
destructor
Definition: bbParaNode.h:130
SubtaskId subtaskId
subtree id
Definition: paraTask.h:227
virtual int receiveSubtreeRootNodeId(ParaComm *comm, int source, int tag)=0
receive this object node Id
BbParaNode * BbParaNodePtr
Definition: bbParaNode.h:720
virtual int sendNewSubtreeRoot(ParaComm *comm, int destination)=0
send new subtree root node
Defines for UG Framework.
virtual int send(ParaComm *comm, int destination)=0
send this object
virtual int receiveNewSubtreeRoot(ParaComm *comm, int source)=0
receive this object
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
TaskId class.
Definition: paraTask.h:222
virtual int getType()=0
getter type which indicate the pointer is local or remote
std::string toString()
stringfy task id
Definition: paraTask.h:353
TaskId generatorTaskId
subtree root task id of generator
Definition: paraTask.h:550
class of pointer to indicate a ParaTask genealogical relation
Definition: paraTask.h:369
BbParaNode * next
this pointer is used in case of self-split ramp-up in LC this field is not transferred ...
Definition: bbParaNode.h:83
ParaTask * getPointerValue()
getter for ParaTask pointer
Definition: paraTask.h:465
ParaDiffSubproblem * diffSubproblem
difference between solving instance data and subproblem data
Definition: paraTask.h:558
BbParaNode()
default constructor
Definition: bbParaNode.h:89
BbParaDiffSubproblem * origDiffSubproblem
original DiffSubproblem */
int mergingStatus
merging status: -1 - no merging node, 0 - checking, 1 - merged (representative) 2 - merged to the oth...
Definition: bbParaNode.h:71
BbParaMergeNodeInfo * mergeNodeInfo
pointer to mergeNodeInfo. Not zero means merging
Definition: bbParaNode.h:78
int keyIndex
The fixedVar of this index can reach all merging nodes.
double getInitialDualBoundValue()
getter of initial dual bound value
Definition: bbParaNode.h:314
virtual int bcast(ParaComm *comm, int root)=0
broadcast this object
#define THROW_LOGICAL_ERROR1(msg1)
Definition: paraDef.h:52
BbParaNode(TaskId inNodeId, TaskId inGeneratorNodeId, int inDepth, double inDualBoundValue, double inOriginalDualBoundValue, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
constructor
Definition: bbParaNode.h:106
Base class of communicator for UG Framework.
Class for the difference between instance and subproblem.
BbParaFixedVariable * next
pointer to the next node which has the same fixed value
void setMergingStatus(int status)
set merging status
Definition: bbParaNode.h:667
const std::string toString()
stringfy BbParaNode
Definition: bbParaNode.h:600
int getDepth()
getter of depth
Definition: bbParaNode.h:283
void setMergeNodeInfo(BbParaMergeNodeInfo *mNode)
set merge node information to this BbParaNode object
Definition: bbParaNode.h:646
Class for the difference between instance and subproblem.
const std::string toSimpleString()
stringfy BbParaNode as simple string
Definition: bbParaNode.h:619
void read(ParaComm *comm, const char *filename)
read ParaParams from file
class ParaTaskGenealogicalLocalPtr
Definition: paraTask.h:414
class BbParaNode
Definition: bbParaNode.h:61
void setDualBoundValue(double inDualBoundValue)
setter of dual bound value
Definition: bbParaNode.h:323
double getDualBoundValue()
getter of dual bound value
Definition: bbParaNode.h:303
BbParaDiffSubproblem * getDiffSubproblem()
getter of diffSubproblem
Definition: bbParaNode.h:353
virtual BbParaNode * clone(ParaComm *comm)=0
clone this BbParaNode
virtual const std::string toString()=0
stringfy ParaDiffSubproblem object ( for debugging )
int nFixedVariables
the number of fixed variables
virtual int receive(ParaComm *comm, int source)=0
receive this object
checking possibility to merge with the other nodes
void setAncestor(ParaTaskGenealogicalPtr *inAncestor)
setter of ancestor
Definition: paraTask.h:885
void setAncestor(ParaTaskGenealogicalPtr *inAncestor)
setter of ancestor
Definition: bbParaNode.h:382
void addDescendant(ParaTaskGenealogicalPtr *inDescendant)
add a descendant
Definition: paraTask.h:939
int getMergingStatus()
get merging status
Definition: bbParaNode.h:678
void setDepth(int inDepth)
setter of depth
Definition: bbParaNode.h:292
TaskId getTaskId()
getter of genealogicaltaskId
Definition: paraTask.h:403
Merge node information struct.
int depth
depth from the root node of original tree
Definition: bbParaNode.h:66
bool isSameNodeIdAs(const BbParaNode &inNode)
check if this node&#39;s id is the same as that of argument ParaNode&#39;s task id
Definition: bbParaNode.h:708
void removeDescendant(TaskId removeNodeId)
remove a descendant
Definition: bbParaNode.h:393
std::map< TaskId, ParaTaskGenealogicalPtrPtr > descendants
collection of pointers to descendants : This filed is not transferred
Definition: paraTask.h:552
BbParaMergeNodeInfo * mergedTo
pointer to merge node info to which this node is merged */
void removeDescendant(TaskId removeTaskId)
remove a descendant
Definition: paraTask.h:896
TaskId taskId
solving task information
Definition: paraTask.h:549
bool areNodesCollected()
check if nodes are collected or not
Definition: bbParaNode.h:688
void setInitialDualBoundValue(double inTrueDualBoundValue)
setter of initial dual bound value
Definition: bbParaNode.h:333
void updateInitialDualBoundToSubtreeDualBound()
update initial dual bound value by checking descendant dual bound values
Definition: bbParaNode.h:446
Base class of communicator object.
Definition: paraComm.h:101
BbParaNode * paraNode
BbParaNode corresponding to this ParaMergeModeInfo */.
bool hasDescendant()
check if this node has descendant or not
Definition: bbParaNode.h:427
class ParaTask
Definition: paraTask.h:541
ParaTaskGenealogicalPtr * getAncestor()
getter of ancestor
Definition: bbParaNode.h:373