Scippy

UG

Ubiquity Generator framework

scipParaRacingRampUpParamSet.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 scipParaRacingRampUpParamSet.h
27  * @brief ParaRacingRampUpParamSet extension for SCIP solver.
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_RACING_RAMP_UP_PARAM_SET_H__
38 #define __SCIP_PARA_RACING_RAMP_UP_PARAM_SET_H__
39 
40 #include "scip/scip.h"
42 #include "ug_bb/bbParaComm.h"
43 #include "scipDiffParamSet.h"
44 
45 namespace ParaSCIP
46 {
47 
48 /** The racing ramp-up parameter set for SCIP solver */
50 {
51 protected:
52  int scipRacingParamSeed; /**< seed to generate SCIP racing parameter */
53  int permuteProbSeed; /**< seed to permute problem */
54  int generateBranchOrderSeed; /**< seed to generate branching order */
55  int scipDiffParamSetInfo; /**< 1: with scipDiffParamSet, 0: no scipDiffParamSet */
56  ScipDiffParamSet *scipDiffParamSet; /**< scip parameter set different from default values for racing ramp-up */
57 public:
58  /** default constructor */
60  )
61  : BbParaRacingRampUpParamSet(), scipRacingParamSeed(-1),
62  permuteProbSeed(0), generateBranchOrderSeed(0), scipDiffParamSetInfo(0), scipDiffParamSet(0)
63  {
64  }
65 
67  int inTerminationCriteria,
68  int inNNodesLeft,
69  double inTimeLimit,
70  int inScipRacingParamSeed,
71  int inPermuteProbSeed,
72  int inGenerateBranchOrderSeed,
73  ScipDiffParamSet *inScipDiffParamSet
74  )
75  : BbParaRacingRampUpParamSet(inTerminationCriteria, inNNodesLeft, inTimeLimit),
76  scipRacingParamSeed(inScipRacingParamSeed),permuteProbSeed(inPermuteProbSeed),
77  generateBranchOrderSeed(inGenerateBranchOrderSeed), scipDiffParamSetInfo(0), scipDiffParamSet(inScipDiffParamSet)
78  {
79  if( inScipDiffParamSet ) scipDiffParamSetInfo = 1;
80  }
81 
82  /** destructor */
84  {
85  if( scipDiffParamSet ) delete scipDiffParamSet;
86  }
87 
88 
89  /** getter of permuteProbSeed */
91  )
92  {
93  return permuteProbSeed;
94  }
95 
96  /** getter of generateBranchOrderSeed */
98  )
99  {
101  }
102 
103  /** getter of ScipDiffParamSet */
105  )
106  {
107  return scipDiffParamSet;
108  }
109 
111  )
112  {
113  return scipRacingParamSeed;
114  }
115 
116 #ifdef UG_WITH_ZLIB
117  /** write scipParaRacingRampUpParamSet */
118  void write(
119  gzstream::ogzstream &out
120  );
121 
122  /** read scipParaRacingRampUpParamSet */
123  bool read(
125  gzstream::igzstream &in
126  );
127 #endif
128 
129  /** stringfy ScipParaRacingRampUpParamSet */
130  const std::string toString(
131  )
132  {
133  std::ostringstream s;
134  s << "[ SCIP racing parameter seed; " << scipRacingParamSeed;
135  s << ", Permutate problem seed: " << permuteProbSeed << ", Generate branch order seed: " << generateBranchOrderSeed << " ]" << std::endl;
136  if( scipDiffParamSetInfo )
137  {
138  s << scipDiffParamSet->toString();
139  }
140  return s.str();
141  }
142 
144  )
145  {
146  return scipRacingParamSeed;
147  }
148 };
149 
150 }
151 
152 
153 
154 #endif // __SCIP_PARA_RACING_RAMP_UP_PARAM_SET_H__
155 
class BbParaRacingRampUpParamSet (parameter set for racing ramp-up)
static ScipParaCommTh * comm
Definition: fscip.cpp:73
ScipParaRacingRampUpParamSet(int inTerminationCriteria, int inNNodesLeft, double inTimeLimit, int inScipRacingParamSeed, int inPermuteProbSeed, int inGenerateBranchOrderSeed, ScipDiffParamSet *inScipDiffParamSet)
SCIP parameter set to be transferred ( Only keep difference between default settings )...
void read(ParaComm *comm, const char *filename)
read ParaParams from file
BbParaRacingRampUpParamSet()
default constructor
Base class of communicator object.
Definition: paraComm.h:101