Scippy

UG

Ubiquity Generator framework

scipParaCommMpi.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 scipParaCommMpi.cpp
27 * @brief SCIP ParaComm 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#include "scipParaCommMpi.h"
38#include "scipParaInstanceMpi.h"
40#include "scipParaSolutionMpi.h"
43#include "scipDiffParamSetMpi.h"
44#include "scipParaParamSet.h"
45
46using namespace ParaSCIP;
47
48
49const char *
50ScipParaCommMpi::tagStringTable[] = {
51 TAG_STR(TagInitialStat1),
68};
69
70bool
71ScipParaCommMpi::tagStringTableIsSetUpCoorectly(
72 )
73{
74 return ( sizeof(tagStringTable)/sizeof(char*) == (N_SCIP_MPI_TAGS - UG::N_BB_MPI_TAGS) );
75}
76
77const char *
79 int tag /// tag to be converted to string
80 )
81{
82 assert( tag >= 0 && tag < N_SCIP_MPI_TAGS );
83 if( tag >= 0 && tag < TAG_SCIP_FIRST )
84 {
85 return BbParaCommMpi::getTagString(tag);
86 }
87 else
88 {
89 return tagStringTable[(tag - TAG_SCIP_FIRST)];
90 }
91}
92
93/*******************************************************************************
94* transfer object factory
95*******************************************************************************/
98 )
99{
100 return new ScipParaDiffSubproblemMpi();
101}
102
105 )
106{
107 return new ScipParaInitialStatMpi();
108}
109
112 )
113{
115}
116
119 )
120{
121 return new ScipParaInstanceMpi();
122}
123
126 )
127{
128 return new ScipParaSolutionMpi();
129}
130
133 SCIP *scip,
134 int method
135 )
136{
137 return new ScipParaInstanceMpi(scip, method);
138}
139
142 ScipParaSolver *solver,
143 SCIP_Real objval,
144 int inNvars,
145 SCIP_VAR ** vars,
146 SCIP_Real *vals
147 )
148{
149 return new ScipParaSolutionMpi(solver, objval, inNvars, vars, vals);
150}
151
154 )
155{
156 return new ScipParaParamSet();
157}
158
161 SCIP_Real objval,
162 int inNvars,
163 int *inIndicesAmongSolvers,
164 SCIP_Real *vals
165 )
166{
167 return new ScipParaSolutionMpi(objval, inNvars, inIndicesAmongSolvers, vals);
168}
169
172 SCIP *scip,
173 ScipParaSolver *scipParaSolver,
174 int nNewBranchVars,
175 SCIP_VAR **newBranchVars,
176 SCIP_Real *newBranchBounds,
177 SCIP_BOUNDTYPE *newBoundTypes,
178 int nAddedConss,
179 SCIP_CONS **addedConss
180 )
181{
182 return new ScipParaDiffSubproblemMpi(
183 scip,
184 scipParaSolver,
185 nNewBranchVars,
186 newBranchVars,
187 newBranchBounds,
188 newBoundTypes,
189 nAddedConss,
190 addedConss
191 );
192}
193
196 SCIP *scip
197 )
198{
199 return new ScipParaInitialStatMpi(
200 scip
201 );
202}
203
206 int inMaxDepth,
207 int inMaxTotalDepth,
208 int inNVarBranchStatsDown,
209 int inNVarBranchStatsUp,
210 int *inIdxLBranchStatsVarsDown,
211 int *inNVarBranchingDown,
212 int *inIdxLBranchStatsVarsUp,
213 int *inNVarBranchingUp,
214 SCIP_Real *inDownpscost,
215 SCIP_Real *inDownvsids,
216 SCIP_Real *inDownconflen,
217 SCIP_Real *inDowninfer,
218 SCIP_Real *inDowncutoff,
219 SCIP_Real *inUppscost,
220 SCIP_Real *inUpvsids,
221 SCIP_Real *inUpconflen,
222 SCIP_Real *inUpinfer,
223 SCIP_Real *inUpcutoff
224 )
225{
226 return new ScipParaInitialStatMpi(
227 inMaxDepth,
228 inMaxTotalDepth,
229 inNVarBranchStatsDown,
230 inNVarBranchStatsUp,
231 inIdxLBranchStatsVarsDown,
232 inNVarBranchingDown,
233 inIdxLBranchStatsVarsUp,
234 inNVarBranchingUp,
235 inDownpscost,
236 inDownvsids,
237 inDownconflen,
238 inDowninfer,
239 inDowncutoff,
240 inUppscost,
241 inUpvsids,
242 inUpconflen,
243 inUpinfer,
244 inUpcutoff
245 );
246}
247
250 int inTerminationCriteria,
251 int inNNodesLeft,
252 double inTimeLimit,
253 int inScipRacingParamSeed,
254 int inPermuteProbSeed,
255 int inGenerateBranchOrderSeed,
256 ScipDiffParamSet *inScipDiffParamSet
257 )
258{
260 inTerminationCriteria,
261 inNNodesLeft,
262 inTimeLimit,
263 inScipRacingParamSeed,
264 inPermuteProbSeed,
265 inGenerateBranchOrderSeed,
266 inScipDiffParamSet
267 );
268}
269
272{
273 return new ScipDiffParamSetMpi();
274}
275
278 SCIP *scip
279 )
280{
281 return new ScipDiffParamSetMpi(scip);
282}
283
ScipParaInitialStat * createScipParaInitialStat(SCIP *scip)
UG::ParaDiffSubproblem * createParaDiffSubproblem()
UG::ParaRacingRampUpParamSet * createParaRacingRampUpParamSet()
ScipParaDiffSubproblem * createScipParaDiffSubproblem(SCIP *scip, ScipParaSolver *scipParaSolver, int nNewBranchVars, SCIP_VAR **newBranchVars, SCIP_Real *newBranchBounds, SCIP_BOUNDTYPE *newBoundTypes, int nAddedConss, SCIP_CONS **addedConss)
ScipParaSolution * createScipParaSolution(ScipParaSolver *solver, SCIP_Real objval, int inNvars, SCIP_VAR **vars, SCIP_Real *vals)
ScipParaInstance * createScipParaInstance(SCIP *scip, int method)
const char * getTagString(int tag)
get Tag string for debugging
UG::ParaInstance * createParaInstance()
static const char * tagStringTable[]
tag name string table
UG::ParaInitialStat * createParaInitialStat()
UG::ParaSolution * createParaSolution()
ScipParaRacingRampUpParamSet * createScipParaRacingRampUpParamSet(int inTerminationCriteria, int inNNodesLeft, double inTimeLimit, int inScipRacingParamSeed, int inPermuteProbSeed, int inGenerateBranchOrderSeed, ScipDiffParamSet *inScipDiffParamSet)
ScipDiffParamSet * createScipDiffParamSet()
UG::ParaParamSet * createParaParamSet()
class BbParaParamSet
Class for the difference between instance and subproblem.
class for initial statistics collecting after racing
class for instance data
Definition: paraInstance.h:51
class ParaParamSet
Definition: paraParamSet.h:850
class ParaRacingRampUpParamSet (parameter set for racing ramp-up)
class for solution
Definition: paraSolution.h:54
static const int TagSolution1
static const int TagDiffSubproblem4
static const int TagDiffSubproblem13
static const int TagDiffSubproblem1
static const int TagDiffSubproblem3
static const int TagDiffSubproblem12
static const int TagDiffSubproblem5
static const int TagSolverDiffParamSet1
static const int TagDiffSubproblem6
static const int TAG_SCIP_FIRST
static const int TagDiffSubproblem8
static const int N_SCIP_MPI_TAGS
static const int TagDiffSubproblem10
static const int TagDiffSubproblem9
static const int TagDiffSubproblem7
static const int TagDiffSubproblem11
static const int TagDiffSubproblem14
static const int TagDiffSubproblem2
static const int N_BB_MPI_TAGS
Definition: bbParaTagDef.h:89
#define TAG_STR(tag)
Definition: paraTagDef.h:40
ScipDiffParamSet extension for MPI communication.
SCIP ParaComm extension for MPI communication.
ScipParaDiffSubproblem extension for MPI communication.
ScipParaInitialStat extension for MPI communication.
ScipParaInstance extension for MPI communication.
ScipParaRacingRampUpParamSet extension for MPI communication.
ScipParaSolution extension for MPI communication.