 Timestamp:
 Aug 17, 2013 11:24:16 AM (7 years ago)
 Location:
 trunk/Clp/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/CbcOrClpParam.cpp
r1973 r1976 80 80 doubleValue_(1.0), 81 81 stringValue_(""), 82 whereUsed_(7) 82 whereUsed_(7), 83 fakeKeyWord_(1), 84 fakeValue_(0) 83 85 { 84 86 } … … 100 102 doubleValue_(1.0), 101 103 stringValue_(""), 102 whereUsed_(7) 104 whereUsed_(7), 105 fakeKeyWord_(1), 106 fakeValue_(0) 103 107 { 104 108 lowerDoubleValue_ = lower; … … 122 126 doubleValue_(1.0), 123 127 stringValue_(""), 124 whereUsed_(7) 128 whereUsed_(7), 129 fakeKeyWord_(1), 130 fakeValue_(0) 125 131 { 126 132 gutsOfConstructor(); … … 148 154 doubleValue_(1.0), 149 155 stringValue_(""), 150 whereUsed_(whereUsed) 156 whereUsed_(whereUsed), 157 fakeKeyWord_(1), 158 fakeValue_(0) 151 159 { 152 160 gutsOfConstructor(); … … 171 179 intValue_(1), 172 180 doubleValue_(1.0), 173 stringValue_("") 181 stringValue_(""), 182 fakeKeyWord_(1), 183 fakeValue_(0) 174 184 { 175 185 whereUsed_ = whereUsed; … … 200 210 stringValue_ = rhs.stringValue_; 201 211 whereUsed_ = rhs.whereUsed_; 212 fakeKeyWord_ = rhs.fakeKeyWord_; 213 fakeValue_ = rhs.fakeValue_; 202 214 } 203 215 … … 234 246 stringValue_ = rhs.stringValue_; 235 247 whereUsed_ = rhs.whereUsed_; 248 fakeKeyWord_ = rhs.fakeKeyWord_; 249 fakeValue_ = rhs.fakeValue_; 236 250 } 237 251 return *this; … … 250 264 lengthName_; 251 265 } 266 } 267 // Sets value of fake keyword to current size of keywords 268 void 269 CbcOrClpParam::setFakeKeyWord(int fakeValue) 270 { 271 fakeKeyWord_ = static_cast<int>(definedKeyWords_.size()); 272 assert (fakeKeyWord_>0); 273 fakeValue_ = fakeValue; 274 assert (fakeValue_>=0); 275 } 276 /* Returns current parameter option position 277 but if fake keyword returns fakeValue_ 278 */ 279 int 280 CbcOrClpParam::currentOptionAsInteger ( ) const 281 { 282 int fakeInteger; 283 return currentOptionAsInteger(fakeInteger); 284 } 285 /* Returns current parameter option position 286 but if fake keyword returns fakeValue_ and sets 287 fakeInteger to value 288 */ 289 int 290 CbcOrClpParam::currentOptionAsInteger ( int & fakeInteger ) const 291 { 292 fakeInteger=COIN_INT_MAX; 293 if (fakeKeyWord_<0) { 294 return currentKeyWord_; 295 } else if (currentKeyWord_>=0&¤tKeyWord_<fakeKeyWord_){ 296 return currentKeyWord_; 297 } else { 298 // fake 299 if (currentKeyWord_<0) 300 fakeInteger = currentKeyWord_ + 1000; 301 else 302 fakeInteger = currentKeyWord_  1000; 303 return fakeValue_; 304 } 252 305 } 253 306 // Returns length of name for printing … … 336 389 } 337 390 } 338 if (whichItem < numberItems) 391 if (whichItem < numberItems) { 339 392 return whichItem; 340 else 341 return 1; 393 } else { 394 if (fakeKeyWord_<=0) 395 return 1; 396 // allow plus or minus 397 int n; 398 if (check.substr(0,4)=="plus"check.substr(0,4)=="PLUS") { 399 n = 4; 400 } else if (check.substr(0,5)=="minus"check.substr(0,5)=="MINUS") { 401 n = 5; 402 } else { 403 return 1; 404 } 405 int value = 0; 406 std::string field=check.substr(n); 407 if (field != "EOL") { 408 const char * start = field.c_str(); 409 char * endPointer = NULL; 410 // check valid 411 value = static_cast<int>(strtol(start, &endPointer, 10)); 412 if (*endPointer != '\0') { 413 return 1; 414 } 415 if (n==4) 416 return value + 1000; 417 else 418 return value  1000; 419 } else { 420 return 1; 421 } 422 } 342 423 } 343 424 } … … 1018 1099 { 1019 1100 if (value != currentKeyWord_) { 1020 sprintf(printArray, "Option for %s changed from %s to %s", 1021 name_.c_str(), definedKeyWords_[currentKeyWord_].c_str(), 1022 definedKeyWords_[value].c_str()); 1023 1024 currentKeyWord_ = value; 1101 char current[100]; 1102 char newString[100]; 1103 if (currentKeyWord_>=0&&(fakeKeyWord_<=0currentKeyWord_<fakeKeyWord_)) 1104 strcpy(current,definedKeyWords_[currentKeyWord_].c_str()); 1105 else if (currentKeyWord_<0) 1106 sprintf(current,"minus%d",currentKeyWord_1000); 1107 else 1108 sprintf(current,"plus%d",currentKeyWord_1000); 1109 if (value>=0&&(fakeKeyWord_<=0value<fakeKeyWord_) ) 1110 strcpy(newString,definedKeyWords_[value].c_str()); 1111 else if (value<0) 1112 sprintf(newString,"minus%d",value1000); 1113 else 1114 sprintf(newString,"plus%d",value1000); 1115 sprintf(printArray, "Option for %s changed from %s to %s", 1116 name_.c_str(), current, newString); 1117 currentKeyWord_ = value; 1025 1118 } else { 1026 1119 printArray[0] = '\0'; … … 1362 1455 parameters[numberParameters1].append("on"); 1363 1456 parameters[numberParameters1].append("decide"); 1457 parameters[numberParameters1].setFakeKeyWord(10); 1364 1458 parameters[numberParameters1].setLonghelp 1365 1459 ( … … 1722 1816 #endif 1723 1817 #ifdef COIN_HAS_CLP 1818 parameters[numberParameters++] = 1819 CbcOrClpParam("decomp!ose", "Whether to try decomposition", 1820 COIN_INT_MAX, COIN_INT_MAX, CLP_PARAM_INT_DECOMPOSE_BLOCKS, 1); 1821 parameters[numberParameters1].setLonghelp 1822 ( 1823 "0  off, 1 choose blocks >1 use as blocks \ 1824 Dantzig Wolfe if primal, Benders if dual \ 1825  uses sprint pass for number of passes" 1826 ); 1827 parameters[numberParameters1].setIntValue(0); 1724 1828 #if CLP_MULTIPLE_FACTORIZATIONS >0 1725 1829 parameters[numberParameters++] = … … 2136 2240 parameters[numberParameters1].append("forceOn"); 2137 2241 parameters[numberParameters1].append("onglobal"); 2242 parameters[numberParameters1].setFakeKeyWord(3); 2138 2243 parameters[numberParameters1].setLonghelp 2139 2244 ( 2140 2245 "This switches on flow cover cuts (either at root or in entire tree) \ 2141 See branchAndCut for information on options." 2246 See branchAndCut for information on options. \ 2247 Can also enter testing values by plusnn (==ifmove)" 2142 2248 ); 2143 2249 parameters[numberParameters++] = … … 2174 2280 #ifdef COIN_HAS_CBC 2175 2281 parameters[numberParameters++] = 2176 CbcOrClpParam("GMI!Cuts", "Whether to use alternative Gomory cuts",2177 "off", CBC_PARAM_STR_GMICUTS);2178 parameters[numberParameters1].append("on");2179 parameters[numberParameters1].append("root");2180 parameters[numberParameters1].append("ifmove");2181 parameters[numberParameters1].append("forceOn");2182 parameters[numberParameters1].append("endonly");2183 parameters[numberParameters1].append("long");2184 parameters[numberParameters1].append("longroot");2185 parameters[numberParameters1].append("longifmove");2186 parameters[numberParameters1].append("forceLongOn");2187 parameters[numberParameters1].append("longendonly");2188 parameters[numberParameters1].setLonghelp2189 (2190 "This switches on an alternative Gomory cut generator (either at root or in entire tree) \2191 This version is by Giacomo Nannicini and may be more robust \2192 See branchAndCut for information on options."2193 );2194 parameters[numberParameters++] =2195 2282 CbcOrClpParam("GMI!Cuts", "Whether to use alternative Gomory cuts", 2196 2283 "off", CBC_PARAM_STR_GMICUTS); … … 3022 3109 parameters[numberParameters1].append("objective!ranging"); 3023 3110 parameters[numberParameters1].append("stats"); 3111 parameters[numberParameters1].append("boundsint"); 3112 parameters[numberParameters1].append("boundsall"); 3024 3113 parameters[numberParameters1].setLonghelp 3025 3114 ( … … 3082 3171 parameters[numberParameters1].append("100"); 3083 3172 parameters[numberParameters1].append("300"); 3173 // but allow numbers after this (returning 1) 3174 parameters[numberParameters1].setFakeKeyWord(1); 3084 3175 parameters[numberParameters1].setLonghelp 3085 3176 ( … … 3087 3178 to incumbent solution (Fischetti and Monaci). \ 3088 3179 See Rounding for meaning of on,both,before. \ 3089 The ones at end have different maxNode settings(and are 'on'(on==30))."3180 Can also set different maxNode settings by plusnnnn (and are 'on'(on==30))." 3090 3181 ); 3091 3182 parameters[numberParameters++] = … … 3395 3486 parameters[numberParameters++] = 3396 3487 CbcOrClpParam("slp!Value", "Number of slp passes before primal", 3397  1, 50000, CLP_PARAM_INT_SLPVALUE, 1);3488 50000, 50000, CLP_PARAM_INT_SLPVALUE, 1); 3398 3489 parameters[numberParameters1].setLonghelp 3399 3490 ( 
trunk/Clp/src/CbcOrClpParam.hpp
r1973 r1976 103 103 CLP_PARAM_INT_RANDOMSEED, 104 104 CLP_PARAM_INT_MORESPECIALOPTIONS, 105 CLP_PARAM_INT_DECOMPOSE_BLOCKS, 105 106 106 107 CBC_PARAM_INT_STRONGBRANCHING = 151, … … 383 384 void setCurrentOption (const std::string value ); 384 385 /// Returns current parameter option position 385 inline int currentOptionAsInteger ( ) const { 386 return currentKeyWord_; 387 } 386 int currentOptionAsInteger ( ) const ; 387 /** Returns current parameter option position 388 but if fake keyword returns a fake value and sets 389 fakeInteger to true value. If not fake then fakeInteger is COIN_INT_MAX 390 */ 391 int currentOptionAsInteger ( int & fakeInteger ) const; 388 392 /// Sets int value 389 393 void setIntValue ( int value ); … … 427 431 return whereUsed_; 428 432 } 433 /// Gets value of fake keyword 434 inline int fakeKeyWord() const 435 { return fakeKeyWord_;} 436 /// Sets value of fake keyword 437 inline void setFakeKeyWord(int value, int fakeValue) 438 { fakeKeyWord_ = value; fakeValue_ = fakeValue;} 439 /// Sets value of fake keyword to current size of keywords 440 void setFakeKeyWord(int fakeValue); 429 441 430 442 private: … … 477 489 */ 478 490 int whereUsed_; 491 /** If >=0 then integers allowed as a fake keyword 492 So minusnnnn would got to nnnn in currentKeyword_ 493 and plusnnnn would go to fakeKeyword_+nnnn 494 */ 495 int fakeKeyWord_; 496 /// Return this as main value if an integer 497 int fakeValue_; 479 498 //@} 480 499 };
Note: See TracChangeset
for help on using the changeset viewer.