BlisParams.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the Bcps Linear 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-2013, 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 
31 //#############################################################################
32 //#############################################################################
33 
34 //** Parameters used in Blis. */
35 class BlisParams : public AlpsParameterSet {
36  public:
39  enum boolParams{
46  //
48  };
49 
51  enum intParams{
54 
57 
65 
73 
92  //
94  };
95 
97  enum dblParams{
100 
104 
108 
112 
115 
119 
122 
125  //
127  };
128 
130  enum strParams{
132  //
134  };
135 
139  //
141  };
142 
143  public:
151  static_cast<int>(endOfBoolParams),
152  static_cast<int>(endOfIntParams),
153  static_cast<int>(endOfDblParams),
154  static_cast<int>(endOfStrParams),
155  static_cast<int>(endOfStrArrayParams)
156  )
157  {
160  }
165  virtual void createKeywordList();
167  virtual void setDefaultEntries();
171  public:
172  //===========================================================================
180  //===========================================================================
181 
182 
191  inline bool entry(const boolParams key) const { return bpar_[key]; }
194  inline int entry(const intParams key) const { return ipar_[key]; }
196  inline double entry(const dblParams key) const { return dpar_[key]; }
198  inline const std::string&
199  entry(const strParams key) const { return spar_[key]; }
201  inline const std::vector<std::string>&
202  entry(const strArrayParams key) const { return sapar_[key]; }
205  //---------------------------------------------------------------------------
207  void setEntry(const boolParams key, const char * val) {
208  bpar_[key] = atoi(val) ? true : false; }
210  void setEntry(const boolParams key, const char val) {
211  bpar_[key] = val ? true : false; }
213  void setEntry(const boolParams key, const bool val) {
214  bpar_[key] = val; }
216  void setEntry(const intParams key, const char * val) {
217  ipar_[key] = atoi(val); }
219  void setEntry(const intParams key, const int val) {
220  ipar_[key] = val; }
222  void setEntry(const dblParams key, const char * val) {
223  dpar_[key] = atof(val); }
225  void setEntry(const dblParams key, const double val) {
226  dpar_[key] = val; }
228  void setEntry(const strParams key, const char * val) {
229  spar_[key] = val; }
231  void setEntry(const strArrayParams key, const char *val) {
232  sapar_[key].push_back(val); }
233 
234  //---------------------------------------------------------------------------
235 
240  void pack(AlpsEncoded& buf) {
244  for (int i = 0; i < endOfStrParams; ++i)
245  buf.writeRep(spar_[i]);
246  for (int i = 0; i < endOfStrArrayParams; ++i) {
247  buf.writeRep(sapar_[i].size());
248  for (size_t j = 0; j < sapar_[i].size(); ++j)
249  buf.writeRep(sapar_[i][j]);
250  }
251  }
253  void unpack(AlpsEncoded& buf) {
254  int dummy;
255  // No need to allocate the arrays, they are of fixed length
256  dummy = static_cast<int>(endOfBoolParams);
257  buf.readRep(bpar_, dummy, false);
258  dummy = static_cast<int>(endOfIntParams);
259  buf.readRep(ipar_, dummy, false);
260  dummy = static_cast<int>(endOfDblParams);
261  buf.readRep(dpar_, dummy, false);
262  for (int i = 0; i < endOfStrParams; ++i)
263  buf.readRep(spar_[i]);
264  for (int i = 0; i < endOfStrArrayParams; ++i) {
265  size_t str_size;
266  buf.readRep(str_size);
267  sapar_[i].reserve(str_size);
268  for (size_t j = 0; j < str_size; ++j){
269  // sapar_[i].unchecked_push_back(std::string());
270  sapar_[i].push_back(std::string());
271  buf.readRep(sapar_[i].back());
272  }
273  }
274  }
277 };
278 
279 #endif
Tolrence to treat as an integer.
Definition: BlisParams.h:99
Weight used to calculate pseudocost.
Definition: BlisParams.h:114
int entry(const intParams key) const
Definition: BlisParams.h:194
AlpsEncoded & readRep(T &value)
Read a single object of type T from repsentation_ .
Definition: AlpsEncoded.h:173
AlpsEncoded & writeRep(const T &value)
Write a single object of type T in repsentation_ .
Definition: AlpsEncoded.h:163
This is the class serves as a holder for a set of parameters.
void pack(AlpsEncoded &buf)
Pack the parameter set into the buffer (AlpsEncoded is used as buffer Here).
Definition: BlisParams.h:240
void setEntry(const boolParams key, const char *val)
char* is true(1) or false(0), not used
Definition: BlisParams.h:207
void setEntry(const strArrayParams key, const char *val)
Definition: BlisParams.h:231
Whether call heuristics. Default: true.
Definition: BlisParams.h:43
int * ipar_
The integer parameters.
-1: disable, 0: default, 1: verbose.
Definition: BlisParams.h:64
const std::string & entry(const strParams key) const
Definition: BlisParams.h:199
void setEntry(const dblParams key, const double val)
Definition: BlisParams.h:225
Scaling indicator of a constraint.
Definition: BlisParams.h:124
void setEntry(const intParams key, const int val)
Definition: BlisParams.h:219
double entry(const dblParams key) const
Definition: BlisParams.h:196
Whether generate cuts during rampup. Default: false.
Definition: BlisParams.h:45
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
virtual void createKeywordList()
Method for creating the list of keyword looked for in the parameter file.
dblParams
Double parameters.
Definition: BlisParams.h:97
BlisParams()
The default constructor creates a parameter set with from the template argument structure.
Definition: BlisParams.h:149
If the absolute gap between best feasible and best relaxed fall into this gap, search stops...
Definition: BlisParams.h:111
strArrayParams
There are no string array parameters.
Definition: BlisParams.h:137
std::string * spar_
The string (actually, std::string) parameters.
The look ahead of pseudocost.
Definition: BlisParams.h:91
void setEntry(const intParams key, const char *val)
Definition: BlisParams.h:216
void setEntry(const strParams key, const char *val)
Definition: BlisParams.h:228
The value added to relaxation value when deciding fathom.
Definition: BlisParams.h:103
strParams
String parameters.
Definition: BlisParams.h:130
void setEntry(const boolParams key, const bool val)
This method is the one that ever been used.
Definition: BlisParams.h:213
boolParams
Character parameters.
Definition: BlisParams.h:39
Whether generate cuts at all. Default: true.
Definition: BlisParams.h:41
std::vector< std::string > * sapar_
The keyword, parameter pairs.
bool * bpar_
The bool parameters.
void unpack(AlpsEncoded &buf)
Unpack the parameter set from the buffer.
Definition: BlisParams.h:253
Cut generators control.
Definition: BlisParams.h:80
virtual void setDefaultEntries()
Method for setting the default values for the parameters.
If the relative gap between best feasible and best relaxed fall into this gap, search stops...
Definition: BlisParams.h:107
Limit the max number cuts applied at a node.
Definition: BlisParams.h:118
bool entry(const boolParams key) const
Definition: BlisParams.h:192
double * dpar_
The double parameters.
intParams
Integer paramters.
Definition: BlisParams.h:51
The relibility of pseudocost.
Definition: BlisParams.h:89
The number of candidate used in strong branching.
Definition: BlisParams.h:53
Dense constraint factor.
Definition: BlisParams.h:121
void setEntry(const dblParams key, const char *val)
Definition: BlisParams.h:222
Heuristics control.
Definition: BlisParams.h:72
void setEntry(const boolParams key, const char val)
char is true(1) or false(0), not used
Definition: BlisParams.h:210
const std::vector< std::string > & entry(const strArrayParams key) const
Definition: BlisParams.h:202