Blis  0.94
BlisParams.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the BiCePS Linear Integer Solver (BLIS). *
3  * *
4  * BLIS is distributed under the Eclipse Public License as part of the *
5  * COIN-OR repository (http://www.coin-or.org). *
6  * *
7  * Authors: *
8  * *
9  * Yan Xu, Lehigh University *
10  * Ted Ralphs, Lehigh University *
11  * *
12  * Conceptual Design: *
13  * *
14  * Yan Xu, Lehigh University *
15  * Ted Ralphs, Lehigh University *
16  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17  * Matthew Saltzman, Clemson University *
18  * *
19  * *
20  * Copyright (C) 2001-2019, Lehigh University, Yan Xu, and Ted Ralphs. *
21  * All Rights Reserved. *
22  *===========================================================================*/
23 
24 #ifndef BlisParams_h
25 #define BlisParams_h
26 
27 #include "AlpsKnowledge.h"
28 #include "AlpsParameterBase.h"
29 
30 #include "Blis.h"
31 
32 //#############################################################################
33 
34 //** Parameters used in Blis. */
35 class BlisParams : public AlpsParameterSet {
36  public:
39  enum chrParams{
57  //
59  };
60 
62  enum intParams{
63 
73 
82 
102 
105 
116 
121 
130  };
131 
133  enum dblParams{
137 
143 
146 
149 
152 
156 
160 
163 
166 
171  };
172 
174  enum strParams{
176  //
178  };
179 
185  };
186 
187  public:
195  static_cast<int>(endOfChrParams),
196  static_cast<int>(endOfIntParams),
197  static_cast<int>(endOfDblParams),
198  static_cast<int>(endOfStrParams),
199  static_cast<int>(endOfStrArrayParams)
200  )
201  {
204  }
209  virtual void createKeywordList();
211  virtual void setDefaultEntries();
215  public:
216  //===========================================================================
224  //===========================================================================
225 
226 
236  inline bool entry(const chrParams key) const { return bpar_[key]; }
238  inline int entry(const intParams key) const { return ipar_[key]; }
240  inline double entry(const dblParams key) const { return dpar_[key]; }
242  inline const std::string&
243  entry(const strParams key) const { return spar_[key]; }
245  inline const std::vector<std::string>&
246  entry(const strArrayParams key) const { return sapar_[key]; }
249  //---------------------------------------------------------------------------
251  void setEntry(const chrParams key, const char * val) {
252  bpar_[key] = atoi(val) ? true : false; }
254  void setEntry(const chrParams key, const char val) {
255  bpar_[key] = val ? true : false; }
257  void setEntry(const chrParams key, const bool val) {
258  bpar_[key] = val; }
260  void setEntry(const intParams key, const char * val) {
261  ipar_[key] = atoi(val); }
263  void setEntry(const intParams key, const int val) {
264  ipar_[key] = val; }
266  void setEntry(const dblParams key, const char * val) {
267  dpar_[key] = atof(val); }
269  void setEntry(const dblParams key, const double val) {
270  dpar_[key] = val; }
272  void setEntry(const strParams key, const char * val) {
273  spar_[key] = val; }
275  void setEntry(const strArrayParams key, const char *val) {
276  sapar_[key].push_back(val); }
277 
278  //---------------------------------------------------------------------------
279 
284  void pack(AlpsEncoded& buf) {
288  for (int i = 0; i < endOfStrParams; ++i)
289  buf.writeRep(spar_[i]);
290  for (int i = 0; i < endOfStrArrayParams; ++i) {
291  buf.writeRep(sapar_[i].size());
292  for (size_t j = 0; j < sapar_[i].size(); ++j)
293  buf.writeRep(sapar_[i][j]);
294  }
295  }
297  void unpack(AlpsEncoded& buf) {
298  int dummy;
299  // No need to allocate the arrays, they are of fixed length
300  dummy = static_cast<int>(endOfChrParams);
301  buf.readRep(bpar_, dummy, false);
302  dummy = static_cast<int>(endOfIntParams);
303  buf.readRep(ipar_, dummy, false);
304  dummy = static_cast<int>(endOfDblParams);
305  buf.readRep(dpar_, dummy, false);
306  for (int i = 0; i < endOfStrParams; ++i)
307  buf.readRep(spar_[i]);
308  for (int i = 0; i < endOfStrArrayParams; ++i) {
309  size_t str_size;
310  buf.readRep(str_size);
311  sapar_[i].reserve(str_size);
312  for (size_t j = 0; j < str_size; ++j){
313  // sapar_[i].unchecked_push_back(std::string());
314  sapar_[i].push_back(std::string());
315  buf.readRep(sapar_[i].back());
316  }
317  }
318  }
321 };
322 
323 #endif
AlpsEncoded & readRep(T &value)
AlpsEncoded & writeRep(const T &value)
std::vector< std::string > * sapar_
std::string * spar_
void setEntry(const dblParams key, const char *val)
Definition: BlisParams.h:266
virtual void setDefaultEntries()
Method for setting the default values for the parameters.
void setEntry(const intParams key, const int val)
Definition: BlisParams.h:263
void setEntry(const strArrayParams key, const char *val)
Definition: BlisParams.h:275
virtual void createKeywordList()
Method for creating the list of keyword looked for in the parameter file.
void setEntry(const chrParams key, const bool val)
This method is the one that ever been used.
Definition: BlisParams.h:257
dblParams
Double parameters.
Definition: BlisParams.h:133
@ cutFactor
Limit the max number cuts applied at a node.
Definition: BlisParams.h:136
@ cutoffInc
The value added to relaxation value when deciding fathom.
Definition: BlisParams.h:142
@ pseudoWeight
Weight used to calculate pseudocost.
Definition: BlisParams.h:162
@ endOfDblParams
Definition: BlisParams.h:170
@ tailOff
Tail off.
Definition: BlisParams.h:168
@ optimalRelGap
If the relative gap between best feasible and best relaxed fall into this gap, search stops.
Definition: BlisParams.h:155
@ objSense
Objective sense: min = 1.0, max = -1.0.
Definition: BlisParams.h:151
@ integerTol
Tolerance to treat as an integer.
Definition: BlisParams.h:148
@ optimalAbsGap
If the absolute gap between best feasible and best relaxed fall into this gap, search stops.
Definition: BlisParams.h:159
@ denseConFactor
Dense constraint factor.
Definition: BlisParams.h:145
@ scaleConFactor
Scaling indicator of a constraint.
Definition: BlisParams.h:165
@ cutoff
Cutoff any nodes whose objective value is higher than it.
Definition: BlisParams.h:139
strArrayParams
There are no string array parameters.
Definition: BlisParams.h:181
@ endOfStrArrayParams
Definition: BlisParams.h:184
double entry(const dblParams key) const
Definition: BlisParams.h:240
void setEntry(const intParams key, const char *val)
Definition: BlisParams.h:260
void setEntry(const chrParams key, const char *val)
char* is true(1) or false(0), not used
Definition: BlisParams.h:251
void setEntry(const dblParams key, const double val)
Definition: BlisParams.h:269
const std::string & entry(const strParams key) const
Definition: BlisParams.h:243
chrParams
Character parameters.
Definition: BlisParams.h:39
@ endOfChrParams
Definition: BlisParams.h:58
@ sharePseudocostRampUp
Share pseudocost during ramp up.
Definition: BlisParams.h:53
@ presolve
Presolve or not.
Definition: BlisParams.h:44
@ shareConstraints
Share constraints Default: false.
Definition: BlisParams.h:47
@ cutRampUp
Generate cuts during rampup.
Definition: BlisParams.h:42
@ sharePseudocostSearch
Share pseudocost during search Default: false.
Definition: BlisParams.h:56
@ shareVariables
Share constraints Default: false.
Definition: BlisParams.h:50
bool entry(const chrParams key) const
Definition: BlisParams.h:236
const std::vector< std::string > & entry(const strArrayParams key) const
Definition: BlisParams.h:246
BlisParams()
The default constructor creates a parameter set with from the template argument structure.
Definition: BlisParams.h:193
void setEntry(const strParams key, const char *val)
Definition: BlisParams.h:272
void unpack(AlpsEncoded &buf)
Unpack the parameter set from the buffer.
Definition: BlisParams.h:297
int entry(const intParams key) const
Definition: BlisParams.h:238
strParams
String parameters.
Definition: BlisParams.h:174
@ endOfStrParams
Definition: BlisParams.h:177
void pack(AlpsEncoded &buf)
Pack the parameter set into the buffer (AlpsEncoded is used as buffer Here).
Definition: BlisParams.h:284
void setEntry(const chrParams key, const char val)
char is true(1) or false(0), not used
Definition: BlisParams.h:254
intParams
Integer paramters.
Definition: BlisParams.h:62
@ endOfIntParams
Definition: BlisParams.h:129
@ branchStrategy
Branching strategy.
Definition: BlisParams.h:71
@ cutFlowCoverStrategy
Definition: BlisParams.h:88
@ heurCallFrequency
All heuristics.
Definition: BlisParams.h:113
@ cutProbingStrategy
Definition: BlisParams.h:92
@ cutProbingFreq
Definition: BlisParams.h:100
@ cutMirStrategy
Definition: BlisParams.h:90
@ cutTwoMirStrategy
Definition: BlisParams.h:93
@ heurRoundStrategy
Definition: BlisParams.h:114
@ cutStrategy
Cut generators control.
Definition: BlisParams.h:80
@ lookAhead
The look ahead of pseudocost.
Definition: BlisParams.h:118
@ sharePcostFrequency
Frequency of sharing pseudocost.
Definition: BlisParams.h:125
@ cutCliqueStrategy
The pass to generate cuts for quick branching.
Definition: BlisParams.h:86
@ strongCandSize
The number of candidate used in strong branching.
Definition: BlisParams.h:127
@ heurStrategy
Heuristics control.
Definition: BlisParams.h:112
@ difference
-1 auto, 0, no, any integer frequency
Definition: BlisParams.h:104
@ cutGenerationFrequency
All constraint generators.
Definition: BlisParams.h:81
@ cutOddHoleFreq
Definition: BlisParams.h:99
@ cutOddHoleStrategy
Definition: BlisParams.h:91
@ sharePcostDepth
Maximum tree depth of sharing pseudocost.
Definition: BlisParams.h:123
@ cutKnapsackFreq
Definition: BlisParams.h:97
@ pseudoRelibility
The relibility of pseudocost.
Definition: BlisParams.h:120
@ cutFlowCoverFreq
Definition: BlisParams.h:96
@ branchStrategyRampUp
Definition: BlisParams.h:72
@ cutKnapsackStrategy
Definition: BlisParams.h:89
@ cutGomoryStrategy
Definition: BlisParams.h:87
@ quickCutPass
The pass to generate cuts.
Definition: BlisParams.h:84
@ cutCliqueFreq
Definition: BlisParams.h:94
@ cutGomoryFreq
Definition: BlisParams.h:95