Scippy

UG

Ubiquity Generator framework

bbParaNode.cpp
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 bbParaNode.cpp
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#include "ug/paraComm.h"
38#include "bbParaNode.h"
39
40using namespace UG;
41
42#ifdef UG_WITH_ZLIB
43void
44BbParaNode::write(gzstream::ogzstream &out){
45 out.write((char *)&taskId.subtaskId.lcId, sizeof(int));
46 out.write((char *)&taskId.subtaskId.globalSubtaskIdInLc, sizeof(int));
47 out.write((char *)&taskId.subtaskId.solverId, sizeof(int));
48 out.write((char *)&taskId.seqNum, sizeof(long long));
49 out.write((char *)&generatorTaskId.subtaskId.lcId, sizeof(int));
50 out.write((char *)&generatorTaskId.subtaskId.globalSubtaskIdInLc, sizeof(int));
51 out.write((char *)&generatorTaskId.subtaskId.solverId, sizeof(int));
52 out.write((char *)&generatorTaskId.seqNum, sizeof(long long));
53 out.write((char *)&depth, sizeof(int));
54 out.write((char *)&dualBoundValue, sizeof(double));
55 out.write((char *)&initialDualBoundValue, sizeof(double));
56 out.write((char *)&estimatedValue, sizeof(double));
57 out.write((char *)&diffSubproblemInfo, sizeof(int));
58 if( !mergeNodeInfo )
59 {
61 }
62 else
63 {
65 {
67 }
68 else
69 {
71 }
72 }
73 out.write((char *)&basisInfo, sizeof(int));
74 // out.write((char *)&mergingStatus, sizeof(int));
75}
76
77bool
78BbParaNode::read(ParaComm *comm, gzstream::igzstream &in, bool onlyBoundChanges){ // bool hasMergingStatus){
79 in.read((char *)&taskId.subtaskId.lcId, sizeof(int));
80 if( in.eof() ) return false;
81 in.read((char *)&taskId.subtaskId.globalSubtaskIdInLc, sizeof(int));
82 in.read((char *)&taskId.subtaskId.solverId, sizeof(int));
83 in.read((char *)&taskId.seqNum, sizeof(long long));
84 in.read((char *)&generatorTaskId.subtaskId.lcId, sizeof(int));
85 in.read((char *)&generatorTaskId.subtaskId.globalSubtaskIdInLc, sizeof(int));
86 in.read((char *)&generatorTaskId.subtaskId.solverId, sizeof(int));
87 in.read((char *)&generatorTaskId.seqNum, sizeof(long long));
88 in.read((char *)&depth, sizeof(int));
89 in.read((char *)&dualBoundValue, sizeof(double));
90 in.read((char *)&initialDualBoundValue, sizeof(double));
91 in.read((char *)&estimatedValue, sizeof(double));
92 in.read((char *)&diffSubproblemInfo, sizeof(int));
94 diffSubproblem = comm->createParaDiffSubproblem();
95 dynamic_cast<BbParaDiffSubproblem *>(diffSubproblem)->read(comm, in, onlyBoundChanges);
96 }
97 in.read((char *)&basisInfo, sizeof(int));
98 /*
99 if( hasMergingStatus )
100 {
101 in.read((char *)&mergingStatus, sizeof(int));
102 if( mergingStatus != 1 )
103 {
104 mergingStatus = -1;
105 }
106 }
107 */
108 return true;
109}
110
111#endif
Base class for BbParaNode.
Class for the difference between instance and subproblem.
double dualBoundValue
dual bound value
Definition: bbParaNode.h:67
BbParaMergeNodeInfo * mergeNodeInfo
pointer to mergeNodeInfo. Not zero means merging
Definition: bbParaNode.h:78
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
bool read(ParaComm *comm, gzstream::igzstream &in, bool onlyBoundChanges)
read from checkpoint file
Definition: bbParaNode.cpp:78
int basisInfo
indicate if basis information is including or not
Definition: bbParaNode.h:70
Base class of communicator object.
Definition: paraComm.h:102
virtual void write(gzstream::ogzstream &out)=0
function to write ParaDiffSubproblem object to checkpoint file
int diffSubproblemInfo
1: with diffSubproblem, 0: no diffSubproblem
Definition: paraTask.h:557
ParaDiffSubproblem * diffSubproblem
difference between solving instance data and subproblem data
Definition: paraTask.h:558
TaskId taskId
solving task information
Definition: paraTask.h:549
double estimatedValue
estimate value
Definition: paraTask.h:556
TaskId generatorTaskId
subtree root task id of generator
Definition: paraTask.h:550
int globalSubtaskIdInLc
Global Subtask ID in Solvers managed by LoadCoordinator.
Definition: paraTask.h:64
int lcId
LoadCoordinator ID.
Definition: paraTask.h:63
int solverId
Solver ID.
Definition: paraTask.h:65
long long seqNum
sequential number in the subtree
Definition: paraTask.h:228
SubtaskId subtaskId
subtree id
Definition: paraTask.h:227
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Base class of communicator for UG Framework.
BbParaDiffSubproblem * origDiffSubproblem
original DiffSubproblem *‍/