Scippy

UG

Ubiquity Generator framework

bbParaSolverStateTh.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 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 paraSolverStateTh.cpp
27  * @brief BbParaSolverState 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 #include "bbParaComm.h"
37 #include "bbParaSolverStateTh.h"
38 
39 using namespace UG;
40 
43  )
44 {
45  return new BbParaSolverStateTh(
48  lcId,
51  nNodesLeft,
54  detTime,
56  );
57 }
58 
59 void
61  ParaComm *comm,
62  int destination,
63  int tag
64  )
65 {
66  assert(nNodesLeft >= 0);
67  assert(bestDualBoundValue >= -1e+10);
68  DEF_PARA_COMM( commTh, comm);
69 
71  commTh->uTypeSend((void *)createDatatype(), ParaSolverStateType, destination, tag)
72  );
73 }
74 
75 void
77  ParaComm *comm,
78  int source,
79  int tag
80  )
81 {
82  DEF_PARA_COMM( commTh, comm);
83 
84  BbParaSolverStateTh *received;
86  commTh->uTypeReceive((void **)&received, ParaSolverStateType, source, tag)
87  );
88 
89  racingStage = received->racingStage;
90  notificationId = received->notificationId;
91  lcId = received->lcId;
92  globalSubtreeIdInLc = received->globalSubtreeIdInLc;
93  nNodesSolved = received->nNodesSolved;
94  nNodesLeft = received->nNodesLeft;
95  bestDualBoundValue = received->bestDualBoundValue;
96  globalBestPrimalBoundValue = received->globalBestPrimalBoundValue;
97  detTime = received->detTime;
98  averageDualBoundGain = received->averageDualBoundGain;
99 
100  delete received;
101 
102 }
void send(ParaComm *comm, int destination, int tag)
send this object
static ScipParaCommTh * comm
Definition: fscip.cpp:73
void receive(ParaComm *comm, int source, int tag)
receive this object
class BbParaSolverStateTh (ParaSolver state object for notification message by thread communication) ...
int globalSubtreeIdInLc
global subtree id of current ParaTask
#define PARA_COMM_CALL(paracommcall)
Definition: paraComm.h:47
#define DEF_PARA_COMM(para_comm, comm)
double detTime
deterministic time, -1: should be non-deterministic
double averageDualBoundGain
average dual bound gain received
int nNodesLeft
number of remaining nodes
int lcId
lc id of current ParaTask
double globalBestPrimalBoundValue
global best primal bound value
static const int ParaSolverStateType
long long nNodesSolved
number of nodes solved
int racingStage
if this value is 1, solver is in racing stage
BbParaSolverStateTh * createDatatype()
create BbParaSolverStateTh datatype
BbParaSolverStateTh()
default constructor
Base class of communicator object.
Definition: paraComm.h:101
unsigned int notificationId
id for this notification
double bestDualBoundValue
best dual bound value in that of remaining nodes