18 #ifdef HAVE_MAiNGO_MPI 22 #define MAiNGO_IF_BAB_MANAGER if (_rank == 0) { 23 #define MAiNGO_IF_BAB_WORKER if (_rank != 0) { 28 #define MAiNGO_END_IF } 30 #define MAiNGO_MPI_BARRIER MPI_Barrier(MPI_COMM_WORLD); 31 #define MAiNGO_MPI_FINALIZE MPI_Finalize(); 33 #define MAiNGO_IF_BAB_MANAGER 34 #define MAiNGO_IF_BAB_WORKER 38 #define MAiNGO_MPI_BARRIER 39 #define MAiNGO_MPI_FINALIZE 43 #ifdef HAVE_MAiNGO_MPI 53 BCAST_NOTHING_PENDING = 0,
55 BCAST_EVERYTHING_FINE,
56 BCAST_TIGHTENING_INFEASIBLE,
57 BCAST_CONSTR_PROP_INFEASIBLE,
69 enum COMMUNICATION_TAG {
75 TAG_NEW_NODE_NO_INCUMBENT,
76 TAG_NEW_NODE_NEW_INCUMBENT,
78 TAG_SOLVED_NODE_STATUS_NORMAL,
79 TAG_SOLVED_NODE_STATUS_CONVERGED,
80 TAG_SOLVED_NODE_STATUS_INFEAS,
82 TAG_SOLVED_NODE_SOLUTION_POINT,
83 TAG_SOLVED_NODE_STATISTICS,
85 TAG_NODE_PRUNING_SCORE,
86 TAG_NODE_LOWER_BOUNDS,
87 TAG_NODE_UPPER_BOUNDS,
88 TAG_NODE_HAS_INCUMBENT,
115 MPI_Ssend(&
id, 1, MPI_INT, dest, TAG_NODE_ID, MPI_COMM_WORLD);
116 MPI_Ssend(&pruningScore, 1, MPI_DOUBLE, dest, TAG_NODE_PRUNING_SCORE, MPI_COMM_WORLD);
117 MPI_Ssend(lb.data(), lb.size(), MPI_DOUBLE, dest, TAG_NODE_LOWER_BOUNDS, MPI_COMM_WORLD);
118 MPI_Ssend(ub.data(), lb.size(), MPI_DOUBLE, dest, TAG_NODE_UPPER_BOUNDS, MPI_COMM_WORLD);
119 MPI_Ssend(&hI, 1, MPI_INT, dest, TAG_NODE_HAS_INCUMBENT, MPI_COMM_WORLD);
120 MPI_Ssend(&depth, 1, MPI_INT, dest, TAG_NODE_DEPTH, MPI_COMM_WORLD);
135 std::vector<double> lb(nvar, 0);
136 std::vector<double> ub(nvar, 0);
142 MPI_Recv(&
id, 1, MPI_INT, source, TAG_NODE_ID, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
143 MPI_Recv(&pruningScore, 1, MPI_DOUBLE, source, TAG_NODE_PRUNING_SCORE, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
144 MPI_Recv(lb.data(), nvar, MPI_DOUBLE, source, TAG_NODE_LOWER_BOUNDS, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
145 MPI_Recv(ub.data(), nvar, MPI_DOUBLE, source, TAG_NODE_UPPER_BOUNDS, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
146 MPI_Recv(&hI, 1, MPI_INT, source, TAG_NODE_HAS_INCUMBENT, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
147 MPI_Recv(&depth, 1, MPI_INT, source, TAG_NODE_DEPTH, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
162 recv_vector_double(std::vector<double> &vec,
int source,
int tag, MPI_Comm comm, MPI_Status *status)
165 MPI_Status probeStatus;
168 MPI_Probe(source, tag, MPI_COMM_WORLD, &probeStatus);
169 MPI_Get_count(&probeStatus, MPI_DOUBLE, &messageSize);
170 vec.resize(messageSize);
172 MPI_Recv(vec.data(), messageSize, MPI_DOUBLE, source, tag, comm, status);
185 recv_vector_int(std::vector<int> &vec,
int source,
int tag, MPI_Comm comm, MPI_Status *status)
188 MPI_Status probeStatus;
191 MPI_Probe(source, tag, MPI_COMM_WORLD, &probeStatus);
192 MPI_Get_count(&probeStatus, MPI_INT, &messageSize);
193 vec.resize(messageSize);
195 MPI_Recv(vec.data(), messageSize, MPI_INT, source, tag, comm, status);
205 struct WorkerNodeComparator {
213 bool operator()(
const std::pair<bool, double> &a,
const std::pair<bool, double> &b)
const 217 return a.second < b.second;
int get_ID() const
Function for querying the node ID.
Definition: babNode.h:100
Class representing a node in the Branch-and-Bound tree.
Definition: babNode.h:35
std::vector< double > get_lower_bounds() const
Function for querying the lower bounds on the optimization variables within this node.
Definition: babNode.h:90
int get_depth() const
Function for querying the node depth.
Definition: babNode.h:105
namespace holding all essentials of MAiNGO
Definition: aleModel.h:31
bool holds_incumbent() const
Function obtaining information whether the node holds the incumbent.
Definition: babNode.h:110
std::vector< double > get_upper_bounds() const
Function for querying the upper bounds on the optimization variables within this node.
Definition: babNode.h:95
double get_pruning_score() const
Function for querying the pruning score within this node.
Definition: babNode.h:80