Scippy

UG

Ubiquity Generator framework

scipParaDiffSubproblemMpi.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 scipParaDiffSubproblemMpi.h
27  * @brief ScipParaDiffSubproblem extension for MPI 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 
37 #ifndef __SCIP_PARA_DIFF_SUBPROBLEM_MPI_H__
38 #define __SCIP_PARA_DIFF_SUBPROBLEM_MPI_H__
39 
40 #include <mpi.h>
41 #include "ug_bb/bbParaComm.h"
42 #include "scipParaDiffSubproblem.h"
43 
44 namespace ParaSCIP
45 {
46 
47 /** The difference between instance and subproblem: this is base class */
49 {
50 
51  /** create scipDiffSubproblem datatypeCounters */
52  MPI_Datatype createDatatypeCounters();
53  /** create scipDiffSubproblem datatypeBoundChnages */
54  MPI_Datatype createDatatypeBoundChnages(bool memAllocNecessary);
55  /** create scipDiffSubproblem datatypeBranchLinearConss1 */
56  MPI_Datatype createDatatypeBranchLinearConss1(bool memAllocNecessary);
57  /** create scipDiffSubproblem datatypeBranchLinearConss2 */
58  MPI_Datatype createDatatypeBranchLinearConss2(bool memAllocNecessary);
59  /** create scipDiffSubproblem datatypeBranchSetppcConss1 */
60  MPI_Datatype createDatatypeBranchSetppcConss1(bool memAllocNecessary);
61  /** create scipDiffSubproblem datatypeBranchSetppcConss2 */
62  MPI_Datatype createDatatypeBranchSetppcConss2(bool memAllocNecessary);
63  /** create scipDiffSubproblem datatypeLinearConss1 */
64  MPI_Datatype createDatatypeLinearConss1(bool memAllocNecessary);
65  /** create scipDiffSubproblem datatypeLinearConss2 */
66  MPI_Datatype createDatatypeLinearConss2(bool memAllocNecessary);
67  /** create scipDiffSubproblem datatypeBendersLinearConss1 */
68  MPI_Datatype createDatatypeBendersLinearConss1(bool memAllocNecessary);
69  /** create scipDiffSubproblem datatypeBendersLinearConss2 */
70  MPI_Datatype createDatatypeBendersLinearConss2(bool memAllocNecessary);
71  /** create scipDiffSubproblem datatypeBoundDisjunctions1 */
72  MPI_Datatype createDatatypeBoundDisjunctions1(bool memAllocNecessary);
73  /** create scipDiffSubproblem datatypeBoundDisjunctions2 */
74  MPI_Datatype createDatatypeBoundDisjunctions2(bool memAllocNecessary);
75  /** create scipDiffSubproblem datatypeVarBranchStats */
76  MPI_Datatype createDatatypeVarBranchStats(bool memAllocNecessary);
77  /** create scipDiffSubproblem datatypeVarValueVars1 */
78  MPI_Datatype createDatatypeVarValueVars1(bool memAllocNecessary);
79  /** create scipDiffSubproblem datatypeVarValueVars2 */
80  MPI_Datatype createDatatypeVarValueVars2(bool memAllocNecessary);
81 
82 
83  int nBranchLinearConss; // 0 means that this is not used
84  int nBranchSetppcConss; // 0 means that this is not used
85 
91 
92 public:
93  /** default constructor */
94  ScipParaDiffSubproblemMpi() : nBranchLinearConss(0), nBranchSetppcConss(0), nLinearConss(0), nBendersLinearConss(0), nBoundDisjunctions(0), nVarBranchStats(0), nVarValueVars(0)
95  {
96  assert( localInfoIncluded == 0 && nBoundChanges == 0 && nLinearConss == 0 );
97  }
98 
99  /** Constructor */
101  SCIP *inScip,
102  ScipParaSolver *inScipParaSolver,
103  int inNNewBranchVars,
104  SCIP_VAR **inNewBranchVars,
105  SCIP_Real *inNewBranchBounds,
106  SCIP_BOUNDTYPE *inNewBoundTypes,
107  int nAddedConss,
108  SCIP_CONS **addedConss
109  ) : ScipParaDiffSubproblem(inScip, inScipParaSolver,
110  inNNewBranchVars, inNewBranchVars, inNewBranchBounds,inNewBoundTypes, nAddedConss, addedConss), nBranchLinearConss(0), nBranchSetppcConss(0), nLinearConss(0), nBendersLinearConss(0), nBoundDisjunctions(0), nVarBranchStats(0), nVarValueVars(0)
111  {
112  }
113 
114  /** Constructor */
116  ScipParaDiffSubproblem *paraDiffSubproblem
117  ) : ScipParaDiffSubproblem(paraDiffSubproblem), nBranchLinearConss(0), nBranchSetppcConss(0), nLinearConss(0), nBendersLinearConss(0), nBoundDisjunctions(0), nVarBranchStats(0), nVarValueVars(0)
118  {
119  }
120 
121 
122  /** destractor */
124  {
125  }
126 
127  /** create clone of this object */
129 
130  int bcast(UG::ParaComm *comm, int root);
131 
132  int send(UG::ParaComm *comm, int dest);
133 
134  int receive(UG::ParaComm *comm, int source);
135 };
136 
137 }
138 
139 #endif // __SCIP_PARA_DIFF_SUBPROBLEM_MPI_H__
140 
MPI_Datatype createDatatypeVarBranchStats(bool memAllocNecessary)
int send(UG::ParaComm *comm, int dest)
static ScipParaCommTh * comm
Definition: fscip.cpp:73
ParaInitialStat extension for SCIP solver.
MPI_Datatype createDatatypeLinearConss2(bool memAllocNecessary)
MPI_Datatype createDatatypeVarValueVars1(bool memAllocNecessary)
MPI_Datatype createDatatypeBendersLinearConss1(bool memAllocNecessary)
MPI_Datatype createDatatypeVarValueVars2(bool memAllocNecessary)
MPI_Datatype createDatatypeBranchSetppcConss2(bool memAllocNecessary)
ScipParaDiffSubproblemMpi(SCIP *inScip, ScipParaSolver *inScipParaSolver, int inNNewBranchVars, SCIP_VAR **inNewBranchVars, SCIP_Real *inNewBranchBounds, SCIP_BOUNDTYPE *inNewBoundTypes, int nAddedConss, SCIP_CONS **addedConss)
ScipParaDiffSubproblemMpi * clone(UG::ParaComm *comm)
int bcast(UG::ParaComm *comm, int root)
MPI_Datatype createDatatypeBoundDisjunctions2(bool memAllocNecessary)
MPI_Datatype createDatatypeLinearConss1(bool memAllocNecessary)
MPI_Datatype createDatatypeBranchSetppcConss1(bool memAllocNecessary)
MPI_Datatype createDatatypeBranchLinearConss1(bool memAllocNecessary)
MPI_Datatype createDatatypeBoundDisjunctions1(bool memAllocNecessary)
ScipParaDiffSubproblemMpi(ScipParaDiffSubproblem *paraDiffSubproblem)
int receive(UG::ParaComm *comm, int source)
MPI_Datatype createDatatypeBoundChnages(bool memAllocNecessary)
Base class of communicator object.
Definition: paraComm.h:101
MPI_Datatype createDatatypeBendersLinearConss2(bool memAllocNecessary)
MPI_Datatype createDatatypeBranchLinearConss2(bool memAllocNecessary)