45BbParaNodesMerger::addNodeToMergeNodeStructs(
116 dynamic_cast<BbParaNode *
>(node)->setMergingStatus(3);
117 dynamic_cast<BbParaNode *
>(node)->setMergeNodeInfo(0);
144 fixedValue->
head = 0;
145 fixedValue->
tail = 0;
146 fixedValue->
next = 0;
154 fixedValue = fixedValue->
next )
158 if( fixedValue == 0 )
162 fixedValue->
head = 0;
163 fixedValue->
tail = 0;
164 fixedValue->
next = 0;
165 prev->
next = fixedValue;
168 assert( fixedValue );
169 if( fixedValue->
tail == 0 )
207 std::multimap<int, BbParaSortedVariable, std::greater<int> > descendent;
219 std::multimap<int, BbParaSortedVariable, std::greater<int> >::iterator pos;
220 pos = descendent.begin();
221 mNode->
keyIndex = pos->second.idxInFixedVariabes;
227 traverse = traverse->
next )
231 assert( traverse->
mnode != mNode );
239 for( ; pos != descendent.end(); ++pos )
244 traverse = traverse->
next )
263 traverse = traverse->
next )
284 cleanup = cleanup->
next )
286 if( cleanup->mnode->mergedTo == mNode )
288 cleanup->mnode->nSameValueVariables = -1;
289 cleanup->mnode->nMergedNodes = -1;
290 cleanup->mnode->keyIndex = -1;
291 cleanup->mnode->mergedTo = 0;
319 int nMergedNodes = 0;
322 cleanup = cleanup->
next )
324 if( cleanup->mnode->mergedTo == mNode )
334 cleanup->mnode->nSameValueVariables = -1;
335 cleanup->mnode->nMergedNodes = -1;
336 cleanup->mnode->keyIndex = -1;
337 cleanup->mnode->mergedTo = 0;
342 assert(nMergedNodes > 0);
345 for( pos = descendent.begin(); pos != descendent.end(); ++pos )
347 fixedVariables[n] = *(pos->second.fixedVariable);
353 delete [] fixedVariables;
404 dynamic_cast<BbParaNode *
>(node)->setMergeNodeInfo(0);
405 dynamic_cast<BbParaNode *
>(node)->resetDualBoundValue();
416 traverse = traverse->
next )
420 mPrev->
next = traverse->mnode;
422 mPrev = traverse->mnode;
424 if( mNode == traverse->mnode->
mergedTo )
430 mPrev = traverse->mnode;
486 traverse = traverse->
next )
488 if( traverse->mnode->nMergedNodes == 0 && mNode == traverse->mnode->
mergedTo )
490 traverse->mnode->mergedTo->nMergedNodes--;
491 if( traverse->mnode->mergedTo->nMergedNodes == 0 && traverse->mnode->mergedTo->paraNode->getMergeNodeInfo() )
494 traverse->mnode->mergedTo->paraNode->setDiffSubproblem(traverse->mnode->mergedTo->origDiffSubproblem);
495 traverse->mnode->mergedTo->paraNode->setMergeNodeInfo(0);
496 traverse->mnode->mergedTo->paraNode->setMergingStatus(-1);
497 delete traverse->mnode->mergedTo->mergedDiffSubproblem;
498 traverse->mnode->mergedTo->mergedDiffSubproblem = 0;
499 traverse->mnode->mergedTo->origDiffSubproblem = 0;
500 assert( traverse->mnode->mergedTo->mergedTo == 0);
503 traverse->mnode->mergedTo = 0;
504 traverse->mnode->paraNode->setMergingStatus(0);
506 traverse->mnode->nMergedNodes = -1;
507 traverse->mnode->nSameValueVariables = -1;
508 traverse->mnode->keyIndex = -1;
516 traverse = traverse->
next )
518 if( traverse->mnode->nMergedNodes == 0 && mNode == traverse->mnode->
mergedTo )
520 traverse->mnode->mergedTo->nMergedNodes--;
521 if( traverse->mnode->mergedTo->nMergedNodes == 0 && traverse->mnode->mergedTo->paraNode->getMergeNodeInfo() )
524 traverse->mnode->mergedTo->paraNode->setDiffSubproblem(traverse->mnode->mergedTo->origDiffSubproblem);
525 traverse->mnode->mergedTo->paraNode->setMergeNodeInfo(0);
526 traverse->mnode->mergedTo->paraNode->setMergingStatus(-1);
527 delete traverse->mnode->mergedDiffSubproblem;
528 traverse->mnode->mergedTo->mergedDiffSubproblem = 0;
529 traverse->mnode->mergedTo->origDiffSubproblem = 0;
530 assert( traverse->mnode->mergedTo->mergedTo == 0);
533 traverse->mnode->mergedTo = 0;
536 traverse->mnode->paraNode->setMergingStatus(0);
538 traverse->mnode->nMergedNodes = -1;
539 traverse->mnode->nSameValueVariables = -1;
540 traverse->mnode->keyIndex = -1;
544 traverse->mnode->paraNode->setMergingStatus(4);
546 traverse->mnode->nMergedNodes = -1;
547 traverse->mnode->nSameValueVariables = -1;
548 traverse->mnode->keyIndex = -1;
561 traverse = traverse->
prev
564 traverse->nSameValue--;
608 traverse = traverse->
next )
610 if( traverse->mnode->nMergedNodes == 0 && mNode == traverse->mnode->
mergedTo )
621 cur->
node = traverse->mnode->paraNode;
625#ifdef UG_DEBUG_SOLUTION
640 assert( delNodes == nMerged );
641 if( delNodes != nMerged )
647 dynamic_cast<BbParaNode *
>(node)->setMergeNodeInfo(0);
648 dynamic_cast<BbParaNode *
>(node)->setMergingStatus(1);
Base class for a container which has difference between instance and subproblem.
Base class for BbParaNode.
Structs used for merging nodes.
Parameter set for UG framework.
Class for the difference between instance and subproblem.
virtual BbParaDiffSubproblem * createDiffSubproblem(ParaComm *comm, ParaInitiator *initiator, int n, BbParaFixedVariable *fixedVars)=0
create new BbParaDiffSubproblem object using fixed variables information
virtual int getVarIndexRange()=0
get variable index range TODO: this function should be in inherited class
virtual int removeMergedNodes(BbParaMergedNodeListElement *head)=0
remove merged BbParaNodes from this pool
int getMergingStatus()
get merging status
BbParaMergeNodeInfo * getMergeNodeInfo()
get merge node information struct
void setDiffSubproblem(BbParaDiffSubproblem *inDiffSubproblem)
setter of diffSubproblem */
BbParaDiffSubproblem * getDiffSubproblem()
getter of diffSubproblem
void setMergeNodeInfo(BbParaMergeNodeInfo *mNode)
set merge node information to this BbParaNode object
void setMergingStatus(int status)
set merging status
double getDualBoundValue()
getter of dual bound value
double mergeNodeTime
accumulate time to make a merged node
double generateMergeNodesCandidatesTime
accumulate time to generate merge nodes candidates
BbParaMergeNodeInfo * mergeInfoHead
head of BbParaMergeNodeInfo list
int nBoundChangesOfBestNode
bound changes of the best node
void deleteMergeNodeInfo(BbParaMergeNodeInfo *mNode)
delete merge node info
int mergeNodes(BbParaNode *node, BbParaNodePool *paraNodePool)
make a merge node
ParaParamSet * paraParamSet
pointer to ParaParamSet object
BbParaMergeNodeInfo * mergeInfoTail
tail of BbParaMergeNodeInfo list times
BbParaFixedValue ** varIndexTable
variable indices table.
double regenerateMergeNodesCandidatesTime
accumulate time to regenerate merge nodes candidates
void generateMergeNodesCandidates(ParaComm *paraComm, ParaInitiator *paraInitiator)
generate merge nodes candidates
BbParaInstance * instance
pointer to ParaInstance object
ParaTimer * paraTimer
normal timer used
double addingNodeToMergeStructTime
accumulate time to add Node to merge struct
void regenerateMergeNodesCandidates(BbParaNode *node, ParaComm *paraComm, ParaInitiator *paraInitiator)
regenerate merge nodes candidates
Base class of communicator object.
double getRealParamValue(int param)
get real parameter value
virtual double getElapsedTime()=0
get elapsed time
static ScipParaInitiator * paraInitiator
struct BbParaFixedValue_ BbParaFixedValue
struct BbParaMergedNodeListElement_ BbParaMergedNodeListElement
struct BbParaMergeNodeInfo_ BbParaMergeNodeInfo
static const int FixedVariablesRatioInMerging
#define DEFAULT_NUM_EPSILON
#define THROW_LOGICAL_ERROR4(msg1, msg2, msg3, msg4)
BbParaFixedValue * next
point next ParaFixedValue struct
BbParaFixedVariable * head
point the head of the ParaFixedVariable
BbParaFixedVariable * tail
point the tail of the ParaFixedVarialbe
double value
value for a fixed variable
BbParaMergeNodeInfo * mnode
pointer to merge node info struct to which this info is belonging
BbParaFixedVariable * prev
pointer to the previous node which has the same fixed value
BbParaFixedVariable * next
pointer to the next node which has the same fixed value
int index
index of the variable among all solvers
int nSameValue
the number of same value fixed variables in the following nodes
Merge node information struct.
@ PARA_MERGE_CHECKING_TO_OTHER_NODE
checking possibility to merge with the other nodes
@ PARA_DELETED
this node is deleted
@ PARA_MERGED_RPRESENTATIVE
representative node for merging
@ PARA_MERGING
in merging process
BbParaDiffSubproblem * mergedDiffSubproblem
merged DiffSubproblem, in case this node is merged and this is the head */
BbParaMergeNodeInfo * mergedTo
pointer to merge node info to which this node is merged */
int nMergedNodes
the number of merged nodes with this node.
BbParaDiffSubproblem * origDiffSubproblem
original DiffSubproblem */
int keyIndex
The fixedVar of this index can reach all merging nodes.
BbParaNode * paraNode
BbParaNode corresponding to this ParaMergeModeInfo */.
BbParaMergeNodeInfo * next
pointer to the next ParaMergeNodeInfo */
BbParaFixedVariable * fixedVariables
array of fixed variable info
int nSameValueVariables
the number of fixed values which are the same as those of the merged node
enum UG::BbParaMergeNodeInfo_::@0 status
status of this ParaMargeNodeInfo
int nFixedVariables
the number of fixed variables
merged node list element stract
BbParaMergedNodeListElement * next
pointer to the next ParaMergedNodeListElement
BbParaNode * node
pointer to BbParaNode object
int idxInFixedVariabes
index in the fixedVariables array
BbParaFixedVariable * fixedVariable
pointer to the fixedVariable