1 | // Copyright (C) 2002, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #if defined(_MSC_VER) |
---|
4 | // Turn off compiler warning about long names |
---|
5 | # pragma warning(disable:4786) |
---|
6 | #endif |
---|
7 | |
---|
8 | #include "CbcOrClpParam.hpp" |
---|
9 | |
---|
10 | #include <string> |
---|
11 | #include <iostream> |
---|
12 | #include <cassert> |
---|
13 | |
---|
14 | #ifdef COIN_HAS_CBC |
---|
15 | #ifdef COIN_HAS_CLP |
---|
16 | #include "OsiClpSolverInterface.hpp" |
---|
17 | #include "ClpSimplex.hpp" |
---|
18 | #endif |
---|
19 | #include "CbcModel.hpp" |
---|
20 | #endif |
---|
21 | #ifdef COIN_HAS_CLP |
---|
22 | #include "ClpSimplex.hpp" |
---|
23 | #include "ClpFactorization.hpp" |
---|
24 | #endif |
---|
25 | #ifdef COIN_HAS_READLINE |
---|
26 | #include <readline/readline.h> |
---|
27 | #include <readline/history.h> |
---|
28 | #endif |
---|
29 | #ifdef COIN_HAS_CBC |
---|
30 | // from CoinSolve |
---|
31 | static char coin_prompt[]="Coin:"; |
---|
32 | #else |
---|
33 | static char coin_prompt[]="Clp:"; |
---|
34 | #endif |
---|
35 | static bool doPrinting=true; |
---|
36 | std::string afterEquals=""; |
---|
37 | void setCbcOrClpPrinting(bool yesNo) |
---|
38 | { |
---|
39 | doPrinting=yesNo; |
---|
40 | } |
---|
41 | //############################################################################# |
---|
42 | // Constructors / Destructor / Assignment |
---|
43 | //############################################################################# |
---|
44 | |
---|
45 | //------------------------------------------------------------------- |
---|
46 | // Default Constructor |
---|
47 | //------------------------------------------------------------------- |
---|
48 | CbcOrClpParam::CbcOrClpParam () |
---|
49 | : type_(INVALID), |
---|
50 | lowerDoubleValue_(0.0), |
---|
51 | upperDoubleValue_(0.0), |
---|
52 | lowerIntValue_(0), |
---|
53 | upperIntValue_(0), |
---|
54 | lengthName_(0), |
---|
55 | lengthMatch_(0), |
---|
56 | definedKeyWords_(), |
---|
57 | name_(), |
---|
58 | shortHelp_(), |
---|
59 | longHelp_(), |
---|
60 | action_(INVALID), |
---|
61 | currentKeyWord_(-1), |
---|
62 | display_(false), |
---|
63 | intValue_(-1), |
---|
64 | doubleValue_(-1.0), |
---|
65 | stringValue_(""), |
---|
66 | whereUsed_(7) |
---|
67 | { |
---|
68 | } |
---|
69 | // Other constructors |
---|
70 | CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, |
---|
71 | double lower, double upper, CbcOrClpParameterType type, |
---|
72 | bool display) |
---|
73 | : type_(type), |
---|
74 | lowerIntValue_(0), |
---|
75 | upperIntValue_(0), |
---|
76 | definedKeyWords_(), |
---|
77 | name_(name), |
---|
78 | shortHelp_(help), |
---|
79 | longHelp_(), |
---|
80 | action_(type), |
---|
81 | currentKeyWord_(-1), |
---|
82 | display_(display), |
---|
83 | intValue_(-1), |
---|
84 | doubleValue_(-1.0), |
---|
85 | stringValue_(""), |
---|
86 | whereUsed_(7) |
---|
87 | { |
---|
88 | lowerDoubleValue_ = lower; |
---|
89 | upperDoubleValue_ = upper; |
---|
90 | gutsOfConstructor(); |
---|
91 | } |
---|
92 | CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, |
---|
93 | int lower, int upper, CbcOrClpParameterType type, |
---|
94 | bool display) |
---|
95 | : type_(type), |
---|
96 | lowerDoubleValue_(0.0), |
---|
97 | upperDoubleValue_(0.0), |
---|
98 | definedKeyWords_(), |
---|
99 | name_(name), |
---|
100 | shortHelp_(help), |
---|
101 | longHelp_(), |
---|
102 | action_(type), |
---|
103 | currentKeyWord_(-1), |
---|
104 | display_(display), |
---|
105 | intValue_(-1), |
---|
106 | doubleValue_(-1.0), |
---|
107 | stringValue_(""), |
---|
108 | whereUsed_(7) |
---|
109 | { |
---|
110 | gutsOfConstructor(); |
---|
111 | lowerIntValue_ = lower; |
---|
112 | upperIntValue_ = upper; |
---|
113 | } |
---|
114 | // Other strings will be added by append |
---|
115 | CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, |
---|
116 | std::string firstValue, |
---|
117 | CbcOrClpParameterType type,int whereUsed, |
---|
118 | bool display) |
---|
119 | : type_(type), |
---|
120 | lowerDoubleValue_(0.0), |
---|
121 | upperDoubleValue_(0.0), |
---|
122 | lowerIntValue_(0), |
---|
123 | upperIntValue_(0), |
---|
124 | definedKeyWords_(), |
---|
125 | name_(name), |
---|
126 | shortHelp_(help), |
---|
127 | longHelp_(), |
---|
128 | action_(type), |
---|
129 | currentKeyWord_(0), |
---|
130 | display_(display), |
---|
131 | intValue_(-1), |
---|
132 | doubleValue_(-1.0), |
---|
133 | stringValue_(""), |
---|
134 | whereUsed_(whereUsed) |
---|
135 | { |
---|
136 | gutsOfConstructor(); |
---|
137 | definedKeyWords_.push_back(firstValue); |
---|
138 | } |
---|
139 | // Action |
---|
140 | CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, |
---|
141 | CbcOrClpParameterType type,int whereUsed, |
---|
142 | bool display) |
---|
143 | : type_(type), |
---|
144 | lowerDoubleValue_(0.0), |
---|
145 | upperDoubleValue_(0.0), |
---|
146 | lowerIntValue_(0), |
---|
147 | upperIntValue_(0), |
---|
148 | definedKeyWords_(), |
---|
149 | name_(name), |
---|
150 | shortHelp_(help), |
---|
151 | longHelp_(), |
---|
152 | action_(type), |
---|
153 | currentKeyWord_(-1), |
---|
154 | display_(display), |
---|
155 | intValue_(-1), |
---|
156 | doubleValue_(-1.0), |
---|
157 | stringValue_("") |
---|
158 | { |
---|
159 | whereUsed_=whereUsed; |
---|
160 | gutsOfConstructor(); |
---|
161 | } |
---|
162 | |
---|
163 | //------------------------------------------------------------------- |
---|
164 | // Copy constructor |
---|
165 | //------------------------------------------------------------------- |
---|
166 | CbcOrClpParam::CbcOrClpParam (const CbcOrClpParam & rhs) |
---|
167 | { |
---|
168 | type_ = rhs.type_; |
---|
169 | lowerDoubleValue_ = rhs.lowerDoubleValue_; |
---|
170 | upperDoubleValue_ = rhs.upperDoubleValue_; |
---|
171 | lowerIntValue_ = rhs.lowerIntValue_; |
---|
172 | upperIntValue_ = rhs.upperIntValue_; |
---|
173 | lengthName_ = rhs.lengthName_; |
---|
174 | lengthMatch_ = rhs.lengthMatch_; |
---|
175 | definedKeyWords_ = rhs.definedKeyWords_; |
---|
176 | name_ = rhs.name_; |
---|
177 | shortHelp_ = rhs.shortHelp_; |
---|
178 | longHelp_ = rhs.longHelp_; |
---|
179 | action_ = rhs.action_; |
---|
180 | currentKeyWord_ = rhs.currentKeyWord_; |
---|
181 | display_=rhs.display_; |
---|
182 | intValue_=rhs.intValue_; |
---|
183 | doubleValue_=rhs.doubleValue_; |
---|
184 | stringValue_=rhs.stringValue_; |
---|
185 | whereUsed_=rhs.whereUsed_; |
---|
186 | } |
---|
187 | |
---|
188 | //------------------------------------------------------------------- |
---|
189 | // Destructor |
---|
190 | //------------------------------------------------------------------- |
---|
191 | CbcOrClpParam::~CbcOrClpParam () |
---|
192 | { |
---|
193 | } |
---|
194 | |
---|
195 | //---------------------------------------------------------------- |
---|
196 | // Assignment operator |
---|
197 | //------------------------------------------------------------------- |
---|
198 | CbcOrClpParam & |
---|
199 | CbcOrClpParam::operator=(const CbcOrClpParam& rhs) |
---|
200 | { |
---|
201 | if (this != &rhs) { |
---|
202 | type_ = rhs.type_; |
---|
203 | lowerDoubleValue_ = rhs.lowerDoubleValue_; |
---|
204 | upperDoubleValue_ = rhs.upperDoubleValue_; |
---|
205 | lowerIntValue_ = rhs.lowerIntValue_; |
---|
206 | upperIntValue_ = rhs.upperIntValue_; |
---|
207 | lengthName_ = rhs.lengthName_; |
---|
208 | lengthMatch_ = rhs.lengthMatch_; |
---|
209 | definedKeyWords_ = rhs.definedKeyWords_; |
---|
210 | name_ = rhs.name_; |
---|
211 | shortHelp_ = rhs.shortHelp_; |
---|
212 | longHelp_ = rhs.longHelp_; |
---|
213 | action_ = rhs.action_; |
---|
214 | currentKeyWord_ = rhs.currentKeyWord_; |
---|
215 | display_=rhs.display_; |
---|
216 | intValue_=rhs.intValue_; |
---|
217 | doubleValue_=rhs.doubleValue_; |
---|
218 | stringValue_=rhs.stringValue_; |
---|
219 | whereUsed_=rhs.whereUsed_; |
---|
220 | } |
---|
221 | return *this; |
---|
222 | } |
---|
223 | void |
---|
224 | CbcOrClpParam::gutsOfConstructor() |
---|
225 | { |
---|
226 | std::string::size_type shriekPos = name_.find('!'); |
---|
227 | lengthName_ = name_.length(); |
---|
228 | if ( shriekPos==std::string::npos ) { |
---|
229 | //does not contain '!' |
---|
230 | lengthMatch_= lengthName_; |
---|
231 | } else { |
---|
232 | lengthMatch_=shriekPos; |
---|
233 | name_ = name_.substr(0,shriekPos)+name_.substr(shriekPos+1); |
---|
234 | lengthName_--; |
---|
235 | } |
---|
236 | } |
---|
237 | // Insert string (only valid for keywords) |
---|
238 | void |
---|
239 | CbcOrClpParam::append(std::string keyWord) |
---|
240 | { |
---|
241 | definedKeyWords_.push_back(keyWord); |
---|
242 | } |
---|
243 | |
---|
244 | int |
---|
245 | CbcOrClpParam::matches (std::string input) const |
---|
246 | { |
---|
247 | // look up strings to do more elegantly |
---|
248 | if (input.length()>lengthName_) { |
---|
249 | return 0; |
---|
250 | } else { |
---|
251 | unsigned int i; |
---|
252 | for (i=0;i<input.length();i++) { |
---|
253 | if (tolower(name_[i])!=tolower(input[i])) |
---|
254 | break; |
---|
255 | } |
---|
256 | if (i<input.length()) { |
---|
257 | return 0; |
---|
258 | } else if (i>=lengthMatch_) { |
---|
259 | return 1; |
---|
260 | } else { |
---|
261 | // matched but too short |
---|
262 | return 2; |
---|
263 | } |
---|
264 | } |
---|
265 | } |
---|
266 | // Returns name which could match |
---|
267 | std::string |
---|
268 | CbcOrClpParam::matchName ( ) const |
---|
269 | { |
---|
270 | if (lengthMatch_==lengthName_) |
---|
271 | return name_; |
---|
272 | else |
---|
273 | return name_.substr(0,lengthMatch_)+"("+name_.substr(lengthMatch_)+")"; |
---|
274 | } |
---|
275 | |
---|
276 | // Returns parameter option which matches (-1 if none) |
---|
277 | int |
---|
278 | CbcOrClpParam::parameterOption ( std::string check ) const |
---|
279 | { |
---|
280 | int numberItems = definedKeyWords_.size(); |
---|
281 | if (!numberItems) { |
---|
282 | return -1; |
---|
283 | } else { |
---|
284 | int whichItem=0; |
---|
285 | unsigned int it; |
---|
286 | for (it=0;it<definedKeyWords_.size();it++) { |
---|
287 | std::string thisOne = definedKeyWords_[it]; |
---|
288 | std::string::size_type shriekPos = thisOne.find('!'); |
---|
289 | unsigned int length1 = thisOne.length(); |
---|
290 | unsigned int length2 = length1; |
---|
291 | if ( shriekPos!=std::string::npos ) { |
---|
292 | //contains '!' |
---|
293 | length2 = shriekPos; |
---|
294 | thisOne = thisOne.substr(0,shriekPos)+ |
---|
295 | thisOne.substr(shriekPos+1); |
---|
296 | length1 = thisOne.length(); |
---|
297 | } |
---|
298 | if (check.length()<=length1&&length2<=check.length()) { |
---|
299 | unsigned int i; |
---|
300 | for (i=0;i<check.length();i++) { |
---|
301 | if (tolower(thisOne[i])!=tolower(check[i])) |
---|
302 | break; |
---|
303 | } |
---|
304 | if (i<check.length()) { |
---|
305 | whichItem++; |
---|
306 | } else if (i>=length2) { |
---|
307 | break; |
---|
308 | } |
---|
309 | } else { |
---|
310 | whichItem++; |
---|
311 | } |
---|
312 | } |
---|
313 | if (whichItem<numberItems) |
---|
314 | return whichItem; |
---|
315 | else |
---|
316 | return -1; |
---|
317 | } |
---|
318 | } |
---|
319 | // Prints parameter options |
---|
320 | void |
---|
321 | CbcOrClpParam::printOptions ( ) const |
---|
322 | { |
---|
323 | std::cout<<"<Possible options for "<<name_<<" are:"; |
---|
324 | unsigned int it; |
---|
325 | for (it=0;it<definedKeyWords_.size();it++) { |
---|
326 | std::string thisOne = definedKeyWords_[it]; |
---|
327 | std::string::size_type shriekPos = thisOne.find('!'); |
---|
328 | if ( shriekPos!=std::string::npos ) { |
---|
329 | //contains '!' |
---|
330 | thisOne = thisOne.substr(0,shriekPos)+ |
---|
331 | "("+thisOne.substr(shriekPos+1)+")"; |
---|
332 | } |
---|
333 | std::cout<<" "<<thisOne; |
---|
334 | } |
---|
335 | assert (currentKeyWord_>=0&¤tKeyWord_<(int)definedKeyWords_.size()); |
---|
336 | std::string current = definedKeyWords_[currentKeyWord_]; |
---|
337 | std::string::size_type shriekPos = current.find('!'); |
---|
338 | if ( shriekPos!=std::string::npos ) { |
---|
339 | //contains '!' |
---|
340 | current = current.substr(0,shriekPos)+ |
---|
341 | "("+current.substr(shriekPos+1)+")"; |
---|
342 | } |
---|
343 | std::cout<<";\n\tcurrent "<<current<<">"<<std::endl; |
---|
344 | } |
---|
345 | // Print action and string |
---|
346 | void |
---|
347 | CbcOrClpParam::printString() const |
---|
348 | { |
---|
349 | if (name_=="directory") |
---|
350 | std::cout<<"Current working directory is "<<stringValue_<<std::endl; |
---|
351 | else if (name_.substr(0,6)=="printM") |
---|
352 | std::cout<<"Current value of printMask is "<<stringValue_<<std::endl; |
---|
353 | else |
---|
354 | std::cout<<"Current default (if $ as parameter) for "<<name_ |
---|
355 | <<" is "<<stringValue_<<std::endl; |
---|
356 | } |
---|
357 | void CoinReadPrintit(const char * input) |
---|
358 | { |
---|
359 | int length =strlen(input); |
---|
360 | char temp[101]; |
---|
361 | int i; |
---|
362 | int n=0; |
---|
363 | for (i=0;i<length;i++) { |
---|
364 | if (input[i]=='\n') { |
---|
365 | temp[n]='\0'; |
---|
366 | std::cout<<temp<<std::endl; |
---|
367 | n=0; |
---|
368 | } else if (n>=65&&input[i]==' ') { |
---|
369 | temp[n]='\0'; |
---|
370 | std::cout<<temp<<std::endl; |
---|
371 | n=0; |
---|
372 | } else if (n||input[i]!=' ') { |
---|
373 | temp[n++]=input[i]; |
---|
374 | } |
---|
375 | } |
---|
376 | if (n) { |
---|
377 | temp[n]='\0'; |
---|
378 | std::cout<<temp<<std::endl; |
---|
379 | } |
---|
380 | } |
---|
381 | // Print Long help |
---|
382 | void |
---|
383 | CbcOrClpParam::printLongHelp() const |
---|
384 | { |
---|
385 | if (type_>=1&&type_<400) { |
---|
386 | CoinReadPrintit(longHelp_.c_str()); |
---|
387 | if (type_<SOLVERLOGLEVEL) { |
---|
388 | printf("<Range of values is %g to %g;\n\tcurrent %g>\n",lowerDoubleValue_,upperDoubleValue_, doubleValue_); |
---|
389 | assert (upperDoubleValue_>lowerDoubleValue_); |
---|
390 | } else if (type_<DIRECTION) { |
---|
391 | printf("<Range of values is %d to %d;\n\tcurrent %d>\n",lowerIntValue_,upperIntValue_,intValue_); |
---|
392 | assert (upperIntValue_>lowerIntValue_); |
---|
393 | } else if (type_<DIRECTORY) { |
---|
394 | printOptions(); |
---|
395 | } |
---|
396 | } |
---|
397 | } |
---|
398 | #ifdef COIN_HAS_CBC |
---|
399 | int |
---|
400 | CbcOrClpParam::setDoubleParameter (OsiSolverInterface * model,double value) |
---|
401 | { |
---|
402 | if (value<lowerDoubleValue_||value>upperDoubleValue_) { |
---|
403 | std::cout<<value<<" was provided for "<<name_<< |
---|
404 | " - valid range is "<<lowerDoubleValue_<<" to "<< |
---|
405 | upperDoubleValue_<<std::endl; |
---|
406 | return 1; |
---|
407 | } else { |
---|
408 | double oldValue=doubleValue_; |
---|
409 | doubleValue_=value; |
---|
410 | switch(type_) { |
---|
411 | case DUALTOLERANCE: |
---|
412 | model->getDblParam(OsiDualTolerance,oldValue); |
---|
413 | model->setDblParam(OsiDualTolerance,value); |
---|
414 | break; |
---|
415 | case PRIMALTOLERANCE: |
---|
416 | model->getDblParam(OsiPrimalTolerance,oldValue); |
---|
417 | model->setDblParam(OsiPrimalTolerance,value); |
---|
418 | break; |
---|
419 | default: |
---|
420 | break; |
---|
421 | } |
---|
422 | if (doPrinting) |
---|
423 | std::cout<<name_<<" was changed from "<<oldValue<<" to " |
---|
424 | <<value<<std::endl; |
---|
425 | return 0; |
---|
426 | } |
---|
427 | } |
---|
428 | #endif |
---|
429 | #ifdef COIN_HAS_CLP |
---|
430 | int |
---|
431 | CbcOrClpParam::setDoubleParameter (ClpSimplex * model,double value) |
---|
432 | { |
---|
433 | double oldValue = doubleValue_; |
---|
434 | if (value<lowerDoubleValue_||value>upperDoubleValue_) { |
---|
435 | std::cout<<value<<" was provided for "<<name_<< |
---|
436 | " - valid range is "<<lowerDoubleValue_<<" to "<< |
---|
437 | upperDoubleValue_<<std::endl; |
---|
438 | return 1; |
---|
439 | } else { |
---|
440 | if (doPrinting) |
---|
441 | std::cout<<name_<<" was changed from "<<oldValue<<" to " |
---|
442 | <<value<<std::endl; |
---|
443 | doubleValue_=value; |
---|
444 | switch(type_) { |
---|
445 | #ifndef COIN_HAS_CBC |
---|
446 | case DUALTOLERANCE: |
---|
447 | model->setDualTolerance(value); |
---|
448 | break; |
---|
449 | case PRIMALTOLERANCE: |
---|
450 | model->setPrimalTolerance(value); |
---|
451 | break; |
---|
452 | #endif |
---|
453 | case DUALBOUND: |
---|
454 | model->setDualBound(value); |
---|
455 | break; |
---|
456 | case PRIMALWEIGHT: |
---|
457 | model->setInfeasibilityCost(value); |
---|
458 | break; |
---|
459 | #ifndef COIN_HAS_CBC |
---|
460 | case TIMELIMIT: |
---|
461 | model->setMaximumSeconds(value); |
---|
462 | break; |
---|
463 | #endif |
---|
464 | case OBJSCALE: |
---|
465 | model->setObjectiveScale(value); |
---|
466 | break; |
---|
467 | case RHSSCALE: |
---|
468 | model->setRhsScale(value); |
---|
469 | break; |
---|
470 | case PRESOLVETOLERANCE: |
---|
471 | model->setDblParam(ClpPresolveTolerance,value); |
---|
472 | break; |
---|
473 | default: |
---|
474 | break; |
---|
475 | } |
---|
476 | return 0; |
---|
477 | } |
---|
478 | } |
---|
479 | double |
---|
480 | CbcOrClpParam::doubleParameter (ClpSimplex * model) const |
---|
481 | { |
---|
482 | double value; |
---|
483 | switch(type_) { |
---|
484 | #ifndef COIN_HAS_CBC |
---|
485 | case DUALTOLERANCE: |
---|
486 | value=model->dualTolerance(); |
---|
487 | break; |
---|
488 | case PRIMALTOLERANCE: |
---|
489 | value=model->primalTolerance(); |
---|
490 | break; |
---|
491 | #endif |
---|
492 | case DUALBOUND: |
---|
493 | value=model->dualBound(); |
---|
494 | break; |
---|
495 | case PRIMALWEIGHT: |
---|
496 | value=model->infeasibilityCost(); |
---|
497 | break; |
---|
498 | #ifndef COIN_HAS_CBC |
---|
499 | case TIMELIMIT: |
---|
500 | value=model->maximumSeconds(); |
---|
501 | break; |
---|
502 | #endif |
---|
503 | case OBJSCALE: |
---|
504 | value=model->objectiveScale(); |
---|
505 | break; |
---|
506 | case RHSSCALE: |
---|
507 | value=model->rhsScale(); |
---|
508 | break; |
---|
509 | default: |
---|
510 | value=doubleValue_; |
---|
511 | break; |
---|
512 | } |
---|
513 | return value; |
---|
514 | } |
---|
515 | int |
---|
516 | CbcOrClpParam::setIntParameter (ClpSimplex * model,int value) |
---|
517 | { |
---|
518 | int oldValue = intValue_; |
---|
519 | if (value<lowerIntValue_||value>upperIntValue_) { |
---|
520 | std::cout<<value<<" was provided for "<<name_<< |
---|
521 | " - valid range is "<<lowerIntValue_<<" to "<< |
---|
522 | upperIntValue_<<std::endl; |
---|
523 | return 1; |
---|
524 | } else { |
---|
525 | intValue_=value; |
---|
526 | if (doPrinting) |
---|
527 | std::cout<<name_<<" was changed from "<<oldValue<<" to " |
---|
528 | <<value<<std::endl; |
---|
529 | switch(type_) { |
---|
530 | case SOLVERLOGLEVEL: |
---|
531 | model->setLogLevel(value); |
---|
532 | if (value>2) |
---|
533 | model->factorization()->messageLevel(8); |
---|
534 | else |
---|
535 | model->factorization()->messageLevel(0); |
---|
536 | break; |
---|
537 | case MAXFACTOR: |
---|
538 | model->factorization()->maximumPivots(value); |
---|
539 | break; |
---|
540 | case PERTVALUE: |
---|
541 | model->setPerturbation(value); |
---|
542 | break; |
---|
543 | case MAXITERATION: |
---|
544 | model->setMaximumIterations(value); |
---|
545 | break; |
---|
546 | case SPECIALOPTIONS: |
---|
547 | model->setSpecialOptions(value); |
---|
548 | #ifdef COIN_HAS_CBC |
---|
549 | case THREADS: |
---|
550 | model->setNumberThreads(value); |
---|
551 | break; |
---|
552 | #endif |
---|
553 | default: |
---|
554 | break; |
---|
555 | } |
---|
556 | return 0; |
---|
557 | } |
---|
558 | } |
---|
559 | int |
---|
560 | CbcOrClpParam::intParameter (ClpSimplex * model) const |
---|
561 | { |
---|
562 | int value; |
---|
563 | switch(type_) { |
---|
564 | #ifndef COIN_HAS_CBC |
---|
565 | case SOLVERLOGLEVEL: |
---|
566 | value=model->logLevel(); |
---|
567 | break; |
---|
568 | #endif |
---|
569 | case MAXFACTOR: |
---|
570 | value=model->factorization()->maximumPivots(); |
---|
571 | break; |
---|
572 | break; |
---|
573 | case PERTVALUE: |
---|
574 | value=model->perturbation(); |
---|
575 | break; |
---|
576 | case MAXITERATION: |
---|
577 | value=model->maximumIterations(); |
---|
578 | break; |
---|
579 | case SPECIALOPTIONS: |
---|
580 | value=model->specialOptions(); |
---|
581 | break; |
---|
582 | #ifndef COIN_HAS_CBC |
---|
583 | case THREADS: |
---|
584 | value = model->numberThreads(); |
---|
585 | #endif |
---|
586 | default: |
---|
587 | value=intValue_; |
---|
588 | break; |
---|
589 | } |
---|
590 | return value; |
---|
591 | } |
---|
592 | #endif |
---|
593 | int |
---|
594 | CbcOrClpParam::checkDoubleParameter (double value) const |
---|
595 | { |
---|
596 | if (value<lowerDoubleValue_||value>upperDoubleValue_) { |
---|
597 | std::cout<<value<<" was provided for "<<name_<< |
---|
598 | " - valid range is "<<lowerDoubleValue_<<" to "<< |
---|
599 | upperDoubleValue_<<std::endl; |
---|
600 | return 1; |
---|
601 | } else { |
---|
602 | return 0; |
---|
603 | } |
---|
604 | } |
---|
605 | #ifdef COIN_HAS_CBC |
---|
606 | double |
---|
607 | CbcOrClpParam::doubleParameter (OsiSolverInterface * model) const |
---|
608 | { |
---|
609 | double value=0.0; |
---|
610 | switch(type_) { |
---|
611 | case DUALTOLERANCE: |
---|
612 | assert(model->getDblParam(OsiDualTolerance,value)); |
---|
613 | break; |
---|
614 | case PRIMALTOLERANCE: |
---|
615 | assert(model->getDblParam(OsiPrimalTolerance,value)); |
---|
616 | break; |
---|
617 | default: |
---|
618 | return doubleValue_; |
---|
619 | break; |
---|
620 | } |
---|
621 | return value; |
---|
622 | } |
---|
623 | int |
---|
624 | CbcOrClpParam::setIntParameter (OsiSolverInterface * model,int value) |
---|
625 | { |
---|
626 | if (value<lowerIntValue_||value>upperIntValue_) { |
---|
627 | std::cout<<value<<" was provided for "<<name_<< |
---|
628 | " - valid range is "<<lowerIntValue_<<" to "<< |
---|
629 | upperIntValue_<<std::endl; |
---|
630 | return 1; |
---|
631 | } else { |
---|
632 | int oldValue=intValue_; |
---|
633 | intValue_=oldValue; |
---|
634 | switch(type_) { |
---|
635 | case SOLVERLOGLEVEL: |
---|
636 | model->messageHandler()->setLogLevel(value); |
---|
637 | break; |
---|
638 | default: |
---|
639 | break; |
---|
640 | } |
---|
641 | if (doPrinting) |
---|
642 | std::cout<<name_<<" was changed from "<<oldValue<<" to " |
---|
643 | <<value<<std::endl; |
---|
644 | return 0; |
---|
645 | } |
---|
646 | } |
---|
647 | int |
---|
648 | CbcOrClpParam::intParameter (OsiSolverInterface * model) const |
---|
649 | { |
---|
650 | int value=0; |
---|
651 | switch(type_) { |
---|
652 | case SOLVERLOGLEVEL: |
---|
653 | value=model->messageHandler()->logLevel(); |
---|
654 | break; |
---|
655 | default: |
---|
656 | value=intValue_; |
---|
657 | break; |
---|
658 | } |
---|
659 | return value; |
---|
660 | } |
---|
661 | int |
---|
662 | CbcOrClpParam::setDoubleParameter (CbcModel &model,double value) |
---|
663 | { |
---|
664 | if (value<lowerDoubleValue_||value>upperDoubleValue_) { |
---|
665 | std::cout<<value<<" was provided for "<<name_<< |
---|
666 | " - valid range is "<<lowerDoubleValue_<<" to "<< |
---|
667 | upperDoubleValue_<<std::endl; |
---|
668 | return 1; |
---|
669 | } else { |
---|
670 | double oldValue=doubleValue_; |
---|
671 | doubleValue_ = value; |
---|
672 | switch(type_) { |
---|
673 | case INFEASIBILITYWEIGHT: |
---|
674 | oldValue=model.getDblParam(CbcModel::CbcInfeasibilityWeight); |
---|
675 | model.setDblParam(CbcModel::CbcInfeasibilityWeight,value); |
---|
676 | break; |
---|
677 | case INTEGERTOLERANCE: |
---|
678 | oldValue=model.getDblParam(CbcModel::CbcIntegerTolerance); |
---|
679 | model.setDblParam(CbcModel::CbcIntegerTolerance,value); |
---|
680 | break; |
---|
681 | case INCREMENT: |
---|
682 | oldValue=model.getDblParam(CbcModel::CbcCutoffIncrement); |
---|
683 | model.setDblParam(CbcModel::CbcCutoffIncrement,value); |
---|
684 | case ALLOWABLEGAP: |
---|
685 | oldValue=model.getDblParam(CbcModel::CbcAllowableGap); |
---|
686 | model.setDblParam(CbcModel::CbcAllowableGap,value); |
---|
687 | break; |
---|
688 | case CUTOFF: |
---|
689 | oldValue=model.getCutoff(); |
---|
690 | model.setCutoff(value); |
---|
691 | break; |
---|
692 | case TIMELIMIT_BAB: |
---|
693 | oldValue = model.getDblParam(CbcModel::CbcMaximumSeconds) ; |
---|
694 | { |
---|
695 | //OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model.solver()); |
---|
696 | //ClpSimplex * lpSolver = clpSolver->getModelPtr(); |
---|
697 | //lpSolver->setMaximumSeconds(value); |
---|
698 | model.setDblParam(CbcModel::CbcMaximumSeconds,value) ; |
---|
699 | } |
---|
700 | break ; |
---|
701 | case DUALTOLERANCE: |
---|
702 | case PRIMALTOLERANCE: |
---|
703 | setDoubleParameter(model.solver(),value); |
---|
704 | return 0; // to avoid message |
---|
705 | default: |
---|
706 | break; |
---|
707 | } |
---|
708 | if (doPrinting) |
---|
709 | std::cout<<name_<<" was changed from "<<oldValue<<" to " |
---|
710 | <<value<<std::endl; |
---|
711 | return 0; |
---|
712 | } |
---|
713 | } |
---|
714 | double |
---|
715 | CbcOrClpParam::doubleParameter (CbcModel &model) const |
---|
716 | { |
---|
717 | double value; |
---|
718 | switch(type_) { |
---|
719 | case INFEASIBILITYWEIGHT: |
---|
720 | value=model.getDblParam(CbcModel::CbcInfeasibilityWeight); |
---|
721 | break; |
---|
722 | case INTEGERTOLERANCE: |
---|
723 | value=model.getDblParam(CbcModel::CbcIntegerTolerance); |
---|
724 | break; |
---|
725 | case INCREMENT: |
---|
726 | value=model.getDblParam(CbcModel::CbcCutoffIncrement); |
---|
727 | case ALLOWABLEGAP: |
---|
728 | value=model.getDblParam(CbcModel::CbcAllowableGap); |
---|
729 | break; |
---|
730 | case CUTOFF: |
---|
731 | value=model.getCutoff(); |
---|
732 | break; |
---|
733 | case TIMELIMIT_BAB: |
---|
734 | value = model.getDblParam(CbcModel::CbcMaximumSeconds) ; |
---|
735 | break ; |
---|
736 | case DUALTOLERANCE: |
---|
737 | case PRIMALTOLERANCE: |
---|
738 | value=doubleParameter(model.solver()); |
---|
739 | break; |
---|
740 | default: |
---|
741 | value = doubleValue_; |
---|
742 | break; |
---|
743 | } |
---|
744 | return value; |
---|
745 | } |
---|
746 | int |
---|
747 | CbcOrClpParam::setIntParameter (CbcModel &model,int value) |
---|
748 | { |
---|
749 | if (value<lowerIntValue_||value>upperIntValue_) { |
---|
750 | std::cout<<value<<" was provided for "<<name_<< |
---|
751 | " - valid range is "<<lowerIntValue_<<" to "<< |
---|
752 | upperIntValue_<<std::endl; |
---|
753 | return 1; |
---|
754 | } else { |
---|
755 | int oldValue=intValue_; |
---|
756 | intValue_ = value; |
---|
757 | switch(type_) { |
---|
758 | case LOGLEVEL: |
---|
759 | oldValue = model.messageHandler()->logLevel(); |
---|
760 | model.messageHandler()->setLogLevel(CoinAbs(value)); |
---|
761 | break; |
---|
762 | case SOLVERLOGLEVEL: |
---|
763 | oldValue = model.solver()->messageHandler()->logLevel(); |
---|
764 | model.solver()->messageHandler()->setLogLevel(value); |
---|
765 | break; |
---|
766 | case MAXNODES: |
---|
767 | oldValue=model.getIntParam(CbcModel::CbcMaxNumNode); |
---|
768 | model.setIntParam(CbcModel::CbcMaxNumNode,value); |
---|
769 | break; |
---|
770 | case MAXSOLS: |
---|
771 | oldValue=model.getIntParam(CbcModel::CbcMaxNumSol); |
---|
772 | model.setIntParam(CbcModel::CbcMaxNumSol,value); |
---|
773 | break; |
---|
774 | case STRONGBRANCHING: |
---|
775 | oldValue=model.numberStrong(); |
---|
776 | model.setNumberStrong(value); |
---|
777 | break; |
---|
778 | case NUMBERBEFORE: |
---|
779 | oldValue=model.numberBeforeTrust(); |
---|
780 | model.setNumberBeforeTrust(value); |
---|
781 | break; |
---|
782 | case NUMBERANALYZE: |
---|
783 | oldValue=model.numberAnalyzeIterations(); |
---|
784 | model.setNumberAnalyzeIterations(value); |
---|
785 | break; |
---|
786 | case NUMBERMINI: |
---|
787 | oldValue=model.sizeMiniTree(); |
---|
788 | model.setSizeMiniTree(value); |
---|
789 | break; |
---|
790 | case CUTPASSINTREE: |
---|
791 | oldValue=model.getMaximumCutPasses(); |
---|
792 | model.setMaximumCutPasses(value); |
---|
793 | break; |
---|
794 | case CUTPASS: |
---|
795 | oldValue=model.getMaximumCutPassesAtRoot(); |
---|
796 | model.setMaximumCutPassesAtRoot(value); |
---|
797 | break; |
---|
798 | #ifdef COIN_HAS_CBC |
---|
799 | #ifdef CBC_THREAD |
---|
800 | case THREADS: |
---|
801 | oldValue=model.getNumberThreads(); |
---|
802 | model.setNumberThreads(value); |
---|
803 | break; |
---|
804 | #endif |
---|
805 | #endif |
---|
806 | default: |
---|
807 | break; |
---|
808 | } |
---|
809 | if (doPrinting) |
---|
810 | std::cout<<name_<<" was changed from "<<oldValue<<" to " |
---|
811 | <<value<<std::endl; |
---|
812 | return 0; |
---|
813 | } |
---|
814 | } |
---|
815 | int |
---|
816 | CbcOrClpParam::intParameter (CbcModel &model) const |
---|
817 | { |
---|
818 | int value; |
---|
819 | switch(type_) { |
---|
820 | case LOGLEVEL: |
---|
821 | value = model.messageHandler()->logLevel(); |
---|
822 | break; |
---|
823 | case SOLVERLOGLEVEL: |
---|
824 | value = model.solver()->messageHandler()->logLevel(); |
---|
825 | break; |
---|
826 | case MAXNODES: |
---|
827 | value = model.getIntParam(CbcModel::CbcMaxNumNode); |
---|
828 | break; |
---|
829 | case MAXSOLS: |
---|
830 | value = model.getIntParam(CbcModel::CbcMaxNumSol); |
---|
831 | break; |
---|
832 | case STRONGBRANCHING: |
---|
833 | value=model.numberStrong(); |
---|
834 | break; |
---|
835 | case NUMBERBEFORE: |
---|
836 | value=model.numberBeforeTrust(); |
---|
837 | break; |
---|
838 | case NUMBERANALYZE: |
---|
839 | value=model.numberAnalyzeIterations(); |
---|
840 | break; |
---|
841 | case NUMBERMINI: |
---|
842 | value=model.sizeMiniTree(); |
---|
843 | break; |
---|
844 | case CUTPASSINTREE: |
---|
845 | value=model.getMaximumCutPasses(); |
---|
846 | break; |
---|
847 | case CUTPASS: |
---|
848 | value=model.getMaximumCutPassesAtRoot(); |
---|
849 | break; |
---|
850 | #ifdef COIN_HAS_CBC |
---|
851 | #ifdef CBC_THREAD |
---|
852 | case THREADS: |
---|
853 | value = model.getNumberThreads(); |
---|
854 | #endif |
---|
855 | #endif |
---|
856 | default: |
---|
857 | value=intValue_; |
---|
858 | break; |
---|
859 | } |
---|
860 | return value; |
---|
861 | } |
---|
862 | #endif |
---|
863 | // Sets current parameter option using string |
---|
864 | void |
---|
865 | CbcOrClpParam::setCurrentOption ( const std::string value ) |
---|
866 | { |
---|
867 | int action = parameterOption(value); |
---|
868 | if (action>=0) |
---|
869 | currentKeyWord_=action; |
---|
870 | } |
---|
871 | // Sets current parameter option |
---|
872 | void |
---|
873 | CbcOrClpParam::setCurrentOption ( int value , bool printIt) |
---|
874 | { |
---|
875 | if (printIt&&value!=currentKeyWord_) |
---|
876 | std::cout<<"Option for "<<name_<<" changed from " |
---|
877 | <<definedKeyWords_[currentKeyWord_]<<" to " |
---|
878 | <<definedKeyWords_[value]<<std::endl; |
---|
879 | |
---|
880 | currentKeyWord_=value; |
---|
881 | } |
---|
882 | void |
---|
883 | CbcOrClpParam::setIntValue ( int value ) |
---|
884 | { |
---|
885 | if (value<lowerIntValue_||value>upperIntValue_) { |
---|
886 | std::cout<<value<<" was provided for "<<name_<< |
---|
887 | " - valid range is "<<lowerIntValue_<<" to "<< |
---|
888 | upperIntValue_<<std::endl; |
---|
889 | } else { |
---|
890 | intValue_=value; |
---|
891 | } |
---|
892 | } |
---|
893 | void |
---|
894 | CbcOrClpParam::setDoubleValue ( double value ) |
---|
895 | { |
---|
896 | if (value<lowerDoubleValue_||value>upperDoubleValue_) { |
---|
897 | std::cout<<value<<" was provided for "<<name_<< |
---|
898 | " - valid range is "<<lowerDoubleValue_<<" to "<< |
---|
899 | upperDoubleValue_<<std::endl; |
---|
900 | } else { |
---|
901 | doubleValue_=value; |
---|
902 | } |
---|
903 | } |
---|
904 | void |
---|
905 | CbcOrClpParam::setStringValue ( std::string value ) |
---|
906 | { |
---|
907 | stringValue_=value; |
---|
908 | } |
---|
909 | static char line[1000]; |
---|
910 | static char * where=NULL; |
---|
911 | extern int CbcOrClpRead_mode; |
---|
912 | extern FILE * CbcOrClpReadCommand; |
---|
913 | // Simple read stuff |
---|
914 | std::string |
---|
915 | CoinReadNextField() |
---|
916 | { |
---|
917 | std::string field; |
---|
918 | if (!where) { |
---|
919 | // need new line |
---|
920 | #ifdef COIN_HAS_READLINE |
---|
921 | if (CbcOrClpReadCommand==stdin) { |
---|
922 | // Get a line from the user. |
---|
923 | where = readline (coin_prompt); |
---|
924 | |
---|
925 | // If the line has any text in it, save it on the history. |
---|
926 | if (where) { |
---|
927 | if ( *where) |
---|
928 | add_history (where); |
---|
929 | strcpy(line,where); |
---|
930 | free(where); |
---|
931 | } |
---|
932 | } else { |
---|
933 | where = fgets(line,1000,CbcOrClpReadCommand); |
---|
934 | } |
---|
935 | #else |
---|
936 | if (CbcOrClpReadCommand==stdin) { |
---|
937 | fprintf(stdout,coin_prompt); |
---|
938 | fflush(stdout); |
---|
939 | } |
---|
940 | where = fgets(line,1000,CbcOrClpReadCommand); |
---|
941 | #endif |
---|
942 | if (!where) |
---|
943 | return field; // EOF |
---|
944 | where = line; |
---|
945 | // clean image |
---|
946 | char * lastNonBlank = line-1; |
---|
947 | while ( *where != '\0' ) { |
---|
948 | if ( *where != '\t' && *where < ' ' ) { |
---|
949 | break; |
---|
950 | } else if ( *where != '\t' && *where != ' ') { |
---|
951 | lastNonBlank = where; |
---|
952 | } |
---|
953 | where++; |
---|
954 | } |
---|
955 | where=line; |
---|
956 | *(lastNonBlank+1)='\0'; |
---|
957 | } |
---|
958 | // munch white space |
---|
959 | while(*where==' '||*where=='\t') |
---|
960 | where++; |
---|
961 | char * saveWhere = where; |
---|
962 | while (*where!=' '&&*where!='\t'&&*where!='\0') |
---|
963 | where++; |
---|
964 | if (where!=saveWhere) { |
---|
965 | char save = *where; |
---|
966 | *where='\0'; |
---|
967 | //convert to string |
---|
968 | field=saveWhere; |
---|
969 | *where=save; |
---|
970 | } else { |
---|
971 | where=NULL; |
---|
972 | field="EOL"; |
---|
973 | } |
---|
974 | return field; |
---|
975 | } |
---|
976 | |
---|
977 | std::string |
---|
978 | CoinReadGetCommand(int argc, const char *argv[]) |
---|
979 | { |
---|
980 | std::string field="EOL"; |
---|
981 | // say no = |
---|
982 | afterEquals=""; |
---|
983 | while (field=="EOL") { |
---|
984 | if (CbcOrClpRead_mode>0) { |
---|
985 | if (CbcOrClpRead_mode<argc) { |
---|
986 | field = argv[CbcOrClpRead_mode++]; |
---|
987 | if (field=="-") { |
---|
988 | std::cout<<"Switching to line mode"<<std::endl; |
---|
989 | CbcOrClpRead_mode=-1; |
---|
990 | field=CoinReadNextField(); |
---|
991 | } else if (field[0]!='-') { |
---|
992 | if (CbcOrClpRead_mode!=2) { |
---|
993 | // now allow std::cout<<"skipping non-command "<<field<<std::endl; |
---|
994 | // field="EOL"; // skip |
---|
995 | } else { |
---|
996 | // special dispensation - taken as -import name |
---|
997 | CbcOrClpRead_mode--; |
---|
998 | field="import"; |
---|
999 | } |
---|
1000 | } else { |
---|
1001 | if (field!="--") { |
---|
1002 | // take off - |
---|
1003 | field = field.substr(1); |
---|
1004 | } else { |
---|
1005 | // special dispensation - taken as -import -- |
---|
1006 | CbcOrClpRead_mode--; |
---|
1007 | field="import"; |
---|
1008 | } |
---|
1009 | } |
---|
1010 | } else { |
---|
1011 | field=""; |
---|
1012 | } |
---|
1013 | } else { |
---|
1014 | field=CoinReadNextField(); |
---|
1015 | } |
---|
1016 | } |
---|
1017 | // if = then modify and save |
---|
1018 | std::string::size_type found = field.find('='); |
---|
1019 | if (found!=std::string::npos) { |
---|
1020 | afterEquals = field.substr(found+1); |
---|
1021 | field = field.substr(0,found); |
---|
1022 | } |
---|
1023 | //std::cout<<field<<std::endl; |
---|
1024 | return field; |
---|
1025 | } |
---|
1026 | std::string |
---|
1027 | CoinReadGetString(int argc, const char *argv[]) |
---|
1028 | { |
---|
1029 | std::string field="EOL"; |
---|
1030 | if (afterEquals=="") { |
---|
1031 | if (CbcOrClpRead_mode>0) { |
---|
1032 | if (CbcOrClpRead_mode<argc) { |
---|
1033 | if (argv[CbcOrClpRead_mode][0]!='-') { |
---|
1034 | field = argv[CbcOrClpRead_mode++]; |
---|
1035 | } else if (!strcmp(argv[CbcOrClpRead_mode],"--")) { |
---|
1036 | field = argv[CbcOrClpRead_mode++]; |
---|
1037 | // -- means import from stdin |
---|
1038 | field = "-"; |
---|
1039 | } |
---|
1040 | } |
---|
1041 | } else { |
---|
1042 | field=CoinReadNextField(); |
---|
1043 | } |
---|
1044 | } else { |
---|
1045 | field=afterEquals; |
---|
1046 | afterEquals = ""; |
---|
1047 | } |
---|
1048 | //std::cout<<field<<std::endl; |
---|
1049 | return field; |
---|
1050 | } |
---|
1051 | // valid 0 - okay, 1 bad, 2 not there |
---|
1052 | int |
---|
1053 | CoinReadGetIntField(int argc, const char *argv[],int * valid) |
---|
1054 | { |
---|
1055 | std::string field="EOL"; |
---|
1056 | if (afterEquals=="") { |
---|
1057 | if (CbcOrClpRead_mode>0) { |
---|
1058 | if (CbcOrClpRead_mode<argc) { |
---|
1059 | // may be negative value so do not check for - |
---|
1060 | field = argv[CbcOrClpRead_mode++]; |
---|
1061 | } |
---|
1062 | } else { |
---|
1063 | field=CoinReadNextField(); |
---|
1064 | } |
---|
1065 | } else { |
---|
1066 | field=afterEquals; |
---|
1067 | afterEquals = ""; |
---|
1068 | } |
---|
1069 | int value=0; |
---|
1070 | //std::cout<<field<<std::endl; |
---|
1071 | if (field!="EOL") { |
---|
1072 | // how do I check valid |
---|
1073 | value = atoi(field.c_str()); |
---|
1074 | *valid=0; |
---|
1075 | } else { |
---|
1076 | *valid=2; |
---|
1077 | } |
---|
1078 | return value; |
---|
1079 | } |
---|
1080 | double |
---|
1081 | CoinReadGetDoubleField(int argc, const char *argv[],int * valid) |
---|
1082 | { |
---|
1083 | std::string field="EOL"; |
---|
1084 | if (afterEquals=="") { |
---|
1085 | if (CbcOrClpRead_mode>0) { |
---|
1086 | if (CbcOrClpRead_mode<argc) { |
---|
1087 | // may be negative value so do not check for - |
---|
1088 | field = argv[CbcOrClpRead_mode++]; |
---|
1089 | } |
---|
1090 | } else { |
---|
1091 | field=CoinReadNextField(); |
---|
1092 | } |
---|
1093 | } else { |
---|
1094 | field=afterEquals; |
---|
1095 | afterEquals = ""; |
---|
1096 | } |
---|
1097 | double value=0.0; |
---|
1098 | //std::cout<<field<<std::endl; |
---|
1099 | if (field!="EOL") { |
---|
1100 | // how do I check valid |
---|
1101 | value = atof(field.c_str()); |
---|
1102 | *valid=0; |
---|
1103 | } else { |
---|
1104 | *valid=2; |
---|
1105 | } |
---|
1106 | return value; |
---|
1107 | } |
---|
1108 | /* |
---|
1109 | Subroutine to establish the cbc parameter array. See the description of |
---|
1110 | class CbcOrClpParam for details. Pulled from C..Main() for clarity. |
---|
1111 | */ |
---|
1112 | void |
---|
1113 | establishParams (int &numberParameters, CbcOrClpParam *const parameters) |
---|
1114 | { |
---|
1115 | numberParameters=0; |
---|
1116 | parameters[numberParameters++]= |
---|
1117 | CbcOrClpParam("?","For help",GENERALQUERY,7,false); |
---|
1118 | parameters[numberParameters++]= |
---|
1119 | CbcOrClpParam("???","For help",FULLGENERALQUERY,7,false); |
---|
1120 | parameters[numberParameters++]= |
---|
1121 | CbcOrClpParam("-","From stdin", |
---|
1122 | STDIN,3,false); |
---|
1123 | #ifdef COIN_HAS_CBC |
---|
1124 | parameters[numberParameters++]= |
---|
1125 | CbcOrClpParam("allow!ableGap","Stop when gap between best possible and \ |
---|
1126 | best less than this", |
---|
1127 | 0.0,1.0e20,ALLOWABLEGAP); |
---|
1128 | parameters[numberParameters-1].setDoubleValue(0.0); |
---|
1129 | parameters[numberParameters-1].setLonghelp |
---|
1130 | ( |
---|
1131 | "If the gap between best solution and best possible solution is less than this \ |
---|
1132 | then the search will be terminated. Also see ratioGap." |
---|
1133 | ); |
---|
1134 | #endif |
---|
1135 | #ifdef COIN_HAS_CLP |
---|
1136 | parameters[numberParameters++]= |
---|
1137 | CbcOrClpParam("allS!lack","Set basis back to all slack and reset solution", |
---|
1138 | ALLSLACK,3); |
---|
1139 | parameters[numberParameters-1].setLonghelp |
---|
1140 | ( |
---|
1141 | "Mainly useful for tuning purposes. Normally the first dual or primal will be using an all slack \ |
---|
1142 | basis anyway." |
---|
1143 | ); |
---|
1144 | parameters[numberParameters++]= |
---|
1145 | CbcOrClpParam("auto!Scale","Whether to scale objective, rhs and bounds of problem if they look odd", |
---|
1146 | "off",AUTOSCALE,7,false); |
---|
1147 | parameters[numberParameters-1].append("on"); |
---|
1148 | parameters[numberParameters-1].setLonghelp |
---|
1149 | ( |
---|
1150 | "If you think you may get odd objective values or large equality rows etc then\ |
---|
1151 | it may be worth setting this true. It is still experimental and you may prefer\ |
---|
1152 | to use objective!Scale and rhs!Scale" |
---|
1153 | ); |
---|
1154 | parameters[numberParameters++]= |
---|
1155 | CbcOrClpParam("barr!ier","Solve using primal dual predictor corrector algorithm", |
---|
1156 | BARRIER); |
---|
1157 | parameters[numberParameters-1].setLonghelp |
---|
1158 | ( |
---|
1159 | "This command solves the current model using the primal dual predictor \ |
---|
1160 | corrector algorithm. You will probably want to link in and choose a better \ |
---|
1161 | ordering and factorization than the default ones provided. It will also solve models \ |
---|
1162 | with quadratic objectives." |
---|
1163 | |
---|
1164 | ); |
---|
1165 | parameters[numberParameters++]= |
---|
1166 | CbcOrClpParam("basisI!n","Import basis from bas file", |
---|
1167 | BASISIN,3); |
---|
1168 | parameters[numberParameters-1].setLonghelp |
---|
1169 | ( |
---|
1170 | "This will read an MPS format basis file from the given file name. It will use the default\ |
---|
1171 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
1172 | is initialized to '', i.e. it must be set. If you have libz then it can read compressed\ |
---|
1173 | files 'xxxxxxxx.gz'.." |
---|
1174 | ); |
---|
1175 | parameters[numberParameters++]= |
---|
1176 | CbcOrClpParam("basisO!ut","Export basis as bas file", |
---|
1177 | BASISOUT); |
---|
1178 | parameters[numberParameters-1].setLonghelp |
---|
1179 | ( |
---|
1180 | "This will write an MPS format basis file to the given file name. It will use the default\ |
---|
1181 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
1182 | is initialized to 'default.bas'." |
---|
1183 | ); |
---|
1184 | parameters[numberParameters++]= |
---|
1185 | CbcOrClpParam("biasLU","Whether factorization biased towards U", |
---|
1186 | "UU",BIASLU,2,false); |
---|
1187 | parameters[numberParameters-1].append("UX"); |
---|
1188 | parameters[numberParameters-1].append("LX"); |
---|
1189 | parameters[numberParameters-1].append("LL"); |
---|
1190 | parameters[numberParameters-1].setCurrentOption("LX"); |
---|
1191 | #endif |
---|
1192 | #ifdef COIN_HAS_CBC |
---|
1193 | parameters[numberParameters++]= |
---|
1194 | CbcOrClpParam("branch!AndCut","Do Branch and Cut", |
---|
1195 | BAB); |
---|
1196 | parameters[numberParameters-1].setLonghelp |
---|
1197 | ( |
---|
1198 | "This does branch and cut. There are many parameters which can affect the performance. \ |
---|
1199 | First just try with default settings and look carefully at the log file. Did cuts help? Did they take too long? \ |
---|
1200 | Look at output to see which cuts were effective and then do some tuning. You will see that the \ |
---|
1201 | options for cuts are off, on, root and ifmove, forceon. Off is \ |
---|
1202 | obvious, on means that this cut generator will be tried in the branch and cut tree (you can fine tune using \ |
---|
1203 | 'depth'). Root means just at the root node while 'ifmove' means that cuts will be used in the tree if they \ |
---|
1204 | look as if they are doing some good and moving the objective value. Forceon is same as on but forces code to use \ |
---|
1205 | cut generator at every node. For probing forceonbut just does fixing probing in tree - not strengthening etc. \ |
---|
1206 | If pre-processing reduced the size of the \ |
---|
1207 | problem or strengthened many coefficients then it is probably wise to leave it on. Switch off heuristics \ |
---|
1208 | which did not provide solutions. The other major area to look at is the search. Hopefully good solutions \ |
---|
1209 | were obtained fairly early in the search so the important point is to select the best variable to branch on. \ |
---|
1210 | See whether strong branching did a good job - or did it just take a lot of iterations. Adjust the strongBranching \ |
---|
1211 | and trustPseudoCosts parameters." |
---|
1212 | ); |
---|
1213 | #endif |
---|
1214 | parameters[numberParameters++]= |
---|
1215 | CbcOrClpParam("bscale","Whether to scale in barrier", |
---|
1216 | "off",BARRIERSCALE,7,false); |
---|
1217 | parameters[numberParameters-1].append("on"); |
---|
1218 | parameters[numberParameters++]= |
---|
1219 | CbcOrClpParam("chol!esky","Which cholesky algorithm", |
---|
1220 | "native",CHOLESKY,7); |
---|
1221 | parameters[numberParameters-1].append("dense"); |
---|
1222 | //#ifdef FOREIGN_BARRIER |
---|
1223 | #ifdef WSSMP_BARRIER |
---|
1224 | parameters[numberParameters-1].append("fudge!Long"); |
---|
1225 | parameters[numberParameters-1].append("wssmp"); |
---|
1226 | #define REAL_BARRIER |
---|
1227 | #else |
---|
1228 | parameters[numberParameters-1].append("fudge!Long_dummy"); |
---|
1229 | parameters[numberParameters-1].append("wssmp_dummy"); |
---|
1230 | #endif |
---|
1231 | #ifdef UFL_BARRIER |
---|
1232 | parameters[numberParameters-1].append("Uni!versityOfFlorida"); |
---|
1233 | #define REAL_BARRIER |
---|
1234 | #else |
---|
1235 | parameters[numberParameters-1].append("Uni!versityOfFlorida_dummy"); |
---|
1236 | #endif |
---|
1237 | #ifdef TAUCS_BARRIER |
---|
1238 | parameters[numberParameters-1].append("Taucs"); |
---|
1239 | #define REAL_BARRIER |
---|
1240 | #else |
---|
1241 | parameters[numberParameters-1].append("Taucs_dummy"); |
---|
1242 | #endif |
---|
1243 | parameters[numberParameters-1].setLonghelp |
---|
1244 | ( |
---|
1245 | "For a barrier code to be effective it needs a good Cholesky ordering and factorization. \ |
---|
1246 | You will need to link in one from another source. See Makefile.locations for some \ |
---|
1247 | possibilities." |
---|
1248 | ); |
---|
1249 | //#endif |
---|
1250 | #ifdef COIN_HAS_CBC |
---|
1251 | parameters[numberParameters++]= |
---|
1252 | CbcOrClpParam("clique!Cuts","Whether to use Clique cuts", |
---|
1253 | "off",CLIQUECUTS); |
---|
1254 | parameters[numberParameters-1].append("on"); |
---|
1255 | parameters[numberParameters-1].append("root"); |
---|
1256 | parameters[numberParameters-1].append("ifmove"); |
---|
1257 | parameters[numberParameters-1].append("forceOn"); |
---|
1258 | parameters[numberParameters-1].setLonghelp |
---|
1259 | ( |
---|
1260 | "This switches on clique cuts (either at root or in entire tree) \ |
---|
1261 | See branchAndCut for information on options." |
---|
1262 | ); |
---|
1263 | parameters[numberParameters++]= |
---|
1264 | CbcOrClpParam("combine!Solutions","Whether to use combine solution heuristic", |
---|
1265 | "off",COMBINE); |
---|
1266 | parameters[numberParameters-1].append("on"); |
---|
1267 | parameters[numberParameters-1].setLonghelp |
---|
1268 | ( |
---|
1269 | "This switches on a heuristic which does branch and cut on the problem given by just \ |
---|
1270 | using variables which have appeared in one or more solutions. \ |
---|
1271 | It obviously only tries after two or more solutions." |
---|
1272 | ); |
---|
1273 | parameters[numberParameters++]= |
---|
1274 | CbcOrClpParam("cost!Strategy","How to use costs as priorities", |
---|
1275 | "off",COSTSTRATEGY); |
---|
1276 | parameters[numberParameters-1].append("pri!orities"); |
---|
1277 | parameters[numberParameters-1].append("column!Order?"); |
---|
1278 | parameters[numberParameters-1].append("01f!irst?"); |
---|
1279 | parameters[numberParameters-1].append("01l!ast?"); |
---|
1280 | parameters[numberParameters-1].append("length!?"); |
---|
1281 | parameters[numberParameters-1].setLonghelp |
---|
1282 | ( |
---|
1283 | "This orders the variables in order of their absolute costs - with largest cost ones being branched on \ |
---|
1284 | first. This primitive strategy can be surprsingly effective. The column order\ |
---|
1285 | option is obviously not on costs but easy to code here." |
---|
1286 | ); |
---|
1287 | #endif |
---|
1288 | parameters[numberParameters++]= |
---|
1289 | CbcOrClpParam("cpp!Generate","Generates C++ code", |
---|
1290 | -1,50000,CPP); |
---|
1291 | parameters[numberParameters-1].setLonghelp |
---|
1292 | ( |
---|
1293 | "Once you like what the stand-alone solver does then this allows \ |
---|
1294 | you to generate user_driver.cpp which approximates the code. \ |
---|
1295 | 0 gives simplest driver, 1 generates saves and restores, 2 \ |
---|
1296 | generates saves and restores even for variables at default value. \ |
---|
1297 | 4 bit in cbc generates size dependent code rather than computed values." |
---|
1298 | ); |
---|
1299 | #ifdef COIN_HAS_CLP |
---|
1300 | parameters[numberParameters++]= |
---|
1301 | CbcOrClpParam("crash","Whether to create basis for problem", |
---|
1302 | "off",CRASH); |
---|
1303 | parameters[numberParameters-1].append("on"); |
---|
1304 | parameters[numberParameters-1].append("so!low_halim"); |
---|
1305 | parameters[numberParameters-1].append("ha!lim_solow(JJF mods)"); |
---|
1306 | // parameters[numberParameters-1].append("4"); |
---|
1307 | // parameters[numberParameters-1].append("5"); |
---|
1308 | parameters[numberParameters-1].setLonghelp |
---|
1309 | ( |
---|
1310 | "If crash is set on and there is an all slack basis then Clp will flip or put structural\ |
---|
1311 | variables into basis with the aim of getting dual feasible. On the whole dual seems to be\ |
---|
1312 | better without it and there alernative types of 'crash' for primal e.g. 'idiot' or 'sprint'. \ |
---|
1313 | I have also added a variant due to Solow and Halim which is as on but just flip."); |
---|
1314 | parameters[numberParameters++]= |
---|
1315 | CbcOrClpParam("cross!over","Whether to get a basic solution after barrier", |
---|
1316 | "on",CROSSOVER); |
---|
1317 | parameters[numberParameters-1].append("off"); |
---|
1318 | parameters[numberParameters-1].append("maybe"); |
---|
1319 | parameters[numberParameters-1].append("presolve"); |
---|
1320 | parameters[numberParameters-1].setLonghelp |
---|
1321 | ( |
---|
1322 | "Interior point algorithms do not obtain a basic solution (and \ |
---|
1323 | the feasibility criterion is a bit suspect (JJF)). This option will crossover \ |
---|
1324 | to a basic solution suitable for ranging or branch and cut. With the current state \ |
---|
1325 | of quadratic it may be a good idea to switch off crossover for quadratic (and maybe \ |
---|
1326 | presolve as well) - the option maybe does this." |
---|
1327 | ); |
---|
1328 | #endif |
---|
1329 | #ifdef COIN_HAS_CBC |
---|
1330 | parameters[numberParameters++]= |
---|
1331 | CbcOrClpParam("cutD!epth","Depth in tree at which to do cuts", |
---|
1332 | -1,999999,CUTDEPTH); |
---|
1333 | parameters[numberParameters-1].setLonghelp |
---|
1334 | ( |
---|
1335 | "Cut generators may be - off, on only at root, on if they look possible \ |
---|
1336 | and on. If they are done every node then that is that, but it may be worth doing them \ |
---|
1337 | every so often. The original method was every so many nodes but it is more logical \ |
---|
1338 | to do it whenever depth in tree is a multiple of K. This option does that and defaults \ |
---|
1339 | to -1 (off)." |
---|
1340 | ); |
---|
1341 | parameters[numberParameters-1].setIntValue(-1); |
---|
1342 | parameters[numberParameters++]= |
---|
1343 | CbcOrClpParam("cuto!ff","All solutions must be better than this", |
---|
1344 | -1.0e60,1.0e60,CUTOFF); |
---|
1345 | parameters[numberParameters-1].setDoubleValue(1.0e50); |
---|
1346 | parameters[numberParameters-1].setLonghelp |
---|
1347 | ( |
---|
1348 | "All solutions must be better than this value (in a minimization sense). \ |
---|
1349 | This is also set by code whenever it obtains a solution and is set to value of \ |
---|
1350 | objective for solution minus cutoff increment." |
---|
1351 | ); |
---|
1352 | parameters[numberParameters++]= |
---|
1353 | CbcOrClpParam("cuts!OnOff","Switches all cuts on or off", |
---|
1354 | "off",CUTSSTRATEGY); |
---|
1355 | parameters[numberParameters-1].append("on"); |
---|
1356 | parameters[numberParameters-1].append("root"); |
---|
1357 | parameters[numberParameters-1].append("ifmove"); |
---|
1358 | parameters[numberParameters-1].append("forceOn"); |
---|
1359 | parameters[numberParameters-1].setLonghelp |
---|
1360 | ( |
---|
1361 | "This can be used to switch on or off all cuts (apart from Reduce and Split). Then you can do \ |
---|
1362 | individual ones off or on \ |
---|
1363 | See branchAndCut for information on options." |
---|
1364 | ); |
---|
1365 | parameters[numberParameters++]= |
---|
1366 | CbcOrClpParam("debug!In","read valid solution from file", |
---|
1367 | DEBUG,7,false); |
---|
1368 | parameters[numberParameters-1].setLonghelp |
---|
1369 | ( |
---|
1370 | "This will read a solution file from the given file name. It will use the default\ |
---|
1371 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
1372 | is initialized to '', i.e. it must be set.\n\n\ |
---|
1373 | If set to create it will create a file called debug.file after search; if set \ |
---|
1374 | to createAfterPre it will create one suitable for use after preprocessing.\n\n\ |
---|
1375 | The idea is that if you suspect a bad cut generator and you did not use preprocessing \ |
---|
1376 | you can do a good run with debug set to 'create' and then switch on the cuts you suspect and \ |
---|
1377 | re-run with debug set to 'debug.file' Similarly if you do use preprocessing but use \ |
---|
1378 | createAfterPre. The create case has same effect as saveSolution." |
---|
1379 | ); |
---|
1380 | #endif |
---|
1381 | #ifdef COIN_HAS_CBC |
---|
1382 | parameters[numberParameters++]= |
---|
1383 | CbcOrClpParam("dextra1","Extra double parameter 1", |
---|
1384 | -COIN_DBL_MAX,COIN_DBL_MAX,DEXTRA1,false); |
---|
1385 | parameters[numberParameters-1].setDoubleValue(0.0); |
---|
1386 | parameters[numberParameters++]= |
---|
1387 | CbcOrClpParam("dextra2","Extra double parameter 2", |
---|
1388 | -COIN_DBL_MAX,COIN_DBL_MAX,DEXTRA2,false); |
---|
1389 | parameters[numberParameters-1].setDoubleValue(0.0); |
---|
1390 | parameters[numberParameters++]= |
---|
1391 | CbcOrClpParam("dextra3","Extra double parameter 3", |
---|
1392 | -COIN_DBL_MAX,COIN_DBL_MAX,DEXTRA3,false); |
---|
1393 | parameters[numberParameters-1].setDoubleValue(0.0); |
---|
1394 | parameters[numberParameters++]= |
---|
1395 | CbcOrClpParam("dextra4","Extra double parameter 4", |
---|
1396 | -COIN_DBL_MAX,COIN_DBL_MAX,DEXTRA4,false); |
---|
1397 | parameters[numberParameters-1].setDoubleValue(0.0); |
---|
1398 | #endif |
---|
1399 | parameters[numberParameters++]= |
---|
1400 | CbcOrClpParam("direction","Minimize or Maximize", |
---|
1401 | "min!imize",DIRECTION); |
---|
1402 | parameters[numberParameters-1].append("max!imize"); |
---|
1403 | parameters[numberParameters-1].append("zero"); |
---|
1404 | parameters[numberParameters-1].setLonghelp |
---|
1405 | ( |
---|
1406 | "The default is minimize - use 'direction maximize' for maximization.\n\ |
---|
1407 | You can also use the parameters 'maximize' or 'minimize'." |
---|
1408 | ); |
---|
1409 | parameters[numberParameters++]= |
---|
1410 | CbcOrClpParam("directory","Set Default directory for import etc.", |
---|
1411 | DIRECTORY); |
---|
1412 | parameters[numberParameters-1].setLonghelp |
---|
1413 | ( |
---|
1414 | "This sets the directory which import, export, saveModel, restoreModel etc will use.\ |
---|
1415 | This is also the directory where the netlib problems are read from when unitTest\ |
---|
1416 | is invoked with -netlib or -netlibp.\ |
---|
1417 | It is initialized to './'" |
---|
1418 | ); |
---|
1419 | #ifdef COIN_HAS_CLP |
---|
1420 | parameters[numberParameters++]= |
---|
1421 | CbcOrClpParam("dualB!ound","Initially algorithm acts as if no \ |
---|
1422 | gap between bounds exceeds this value", |
---|
1423 | 1.0e-20,1.0e12,DUALBOUND); |
---|
1424 | parameters[numberParameters-1].setLonghelp |
---|
1425 | ( |
---|
1426 | "The dual algorithm in Clp is a single phase algorithm as opposed to a two phase\ |
---|
1427 | algorithm where you first get feasible then optimal. If a problem has both upper and\ |
---|
1428 | lower bounds then it is trivial to get dual feasible by setting non basic variables\ |
---|
1429 | to correct bound. If the gap between the upper and lower bounds of a variable is more\ |
---|
1430 | than the value of dualBound Clp introduces fake bounds so that it can make the problem\ |
---|
1431 | dual feasible. This has the same effect as a composite objective function in the\ |
---|
1432 | primal algorithm. Too high a value may mean more iterations, while too low a bound means\ |
---|
1433 | the code may go all the way and then have to increase the bounds. OSL had a heuristic to\ |
---|
1434 | adjust bounds, maybe we need that here." |
---|
1435 | ); |
---|
1436 | parameters[numberParameters++]= |
---|
1437 | CbcOrClpParam("dualize","Solves dual reformulation", |
---|
1438 | 0,2,DUALIZE,false); |
---|
1439 | parameters[numberParameters-1].setLonghelp |
---|
1440 | ( |
---|
1441 | "Don't even think about it." |
---|
1442 | ); |
---|
1443 | parameters[numberParameters++]= |
---|
1444 | CbcOrClpParam("dualP!ivot","Dual pivot choice algorithm", |
---|
1445 | "auto!matic",DUALPIVOT); |
---|
1446 | parameters[numberParameters-1].append("dant!zig"); |
---|
1447 | parameters[numberParameters-1].append("partial"); |
---|
1448 | parameters[numberParameters-1].append("steep!est"); |
---|
1449 | parameters[numberParameters-1].setLonghelp |
---|
1450 | ( |
---|
1451 | "Clp can use any pivot selection algorithm which the user codes as long as it\ |
---|
1452 | implements the features in the abstract pivot base class. The Dantzig method is implemented\ |
---|
1453 | to show a simple method but its use is deprecated. Steepest is the method of choice and there\ |
---|
1454 | are two variants which keep all weights updated but only scan a subset each iteration.\ |
---|
1455 | Partial switches this on while automatic decides at each iteration based on information\ |
---|
1456 | about the factorization." |
---|
1457 | ); |
---|
1458 | parameters[numberParameters++]= |
---|
1459 | CbcOrClpParam("dualS!implex","Do dual simplex algorithm", |
---|
1460 | DUALSIMPLEX); |
---|
1461 | parameters[numberParameters-1].setLonghelp |
---|
1462 | ( |
---|
1463 | "This command solves the current model using the dual steepest edge algorithm.\ |
---|
1464 | The time and iterations may be affected by settings such as presolve, scaling, crash\ |
---|
1465 | and also by dual pivot method, fake bound on variables and dual and primal tolerances." |
---|
1466 | ); |
---|
1467 | #endif |
---|
1468 | parameters[numberParameters++]= |
---|
1469 | CbcOrClpParam("dualT!olerance","For an optimal solution \ |
---|
1470 | no dual infeasibility may exceed this value", |
---|
1471 | 1.0e-20,1.0e12,DUALTOLERANCE); |
---|
1472 | parameters[numberParameters-1].setLonghelp |
---|
1473 | ( |
---|
1474 | "Normally the default tolerance is fine, but you may want to increase it a\ |
---|
1475 | bit if a dual run seems to be having a hard time. One method which can be faster is \ |
---|
1476 | to use a large tolerance e.g. 1.0e-4 and dual and then clean up problem using primal and the \ |
---|
1477 | correct tolerance (remembering to switch off presolve for this final short clean up phase)." |
---|
1478 | ); |
---|
1479 | #ifdef COIN_HAS_CLP |
---|
1480 | parameters[numberParameters++]= |
---|
1481 | CbcOrClpParam("either!Simplex","Do dual or primal simplex algorithm", |
---|
1482 | EITHERSIMPLEX); |
---|
1483 | parameters[numberParameters-1].setLonghelp |
---|
1484 | ( |
---|
1485 | "This command solves the current model using the dual or primal algorithm,\ |
---|
1486 | based on a dubious analysis of model." |
---|
1487 | ); |
---|
1488 | #endif |
---|
1489 | parameters[numberParameters++]= |
---|
1490 | CbcOrClpParam("end","Stops clp execution", |
---|
1491 | EXIT); |
---|
1492 | parameters[numberParameters-1].setLonghelp |
---|
1493 | ( |
---|
1494 | "This stops execution ; end, exit, quit and stop are synonyms" |
---|
1495 | ); |
---|
1496 | parameters[numberParameters++]= |
---|
1497 | CbcOrClpParam("error!sAllowed","Whether to allow import errors", |
---|
1498 | "off",ERRORSALLOWED,3); |
---|
1499 | parameters[numberParameters-1].append("on"); |
---|
1500 | parameters[numberParameters-1].setLonghelp |
---|
1501 | ( |
---|
1502 | "The default is not to use any model which had errors when reading the mps file.\ |
---|
1503 | Setting this to 'on' will allow all errors from which the code can recover\ |
---|
1504 | simply by ignoring the error. There are some errors from which the code can not recover \ |
---|
1505 | e.g. no ENDATA. This has to be set before import i.e. -errorsAllowed on -import xxxxxx.mps." |
---|
1506 | ); |
---|
1507 | parameters[numberParameters++]= |
---|
1508 | CbcOrClpParam("exit","Stops clp execution", |
---|
1509 | EXIT); |
---|
1510 | parameters[numberParameters-1].setLonghelp |
---|
1511 | ( |
---|
1512 | "This stops the execution of Clp, end, exit, quit and stop are synonyms" |
---|
1513 | ); |
---|
1514 | parameters[numberParameters++]= |
---|
1515 | CbcOrClpParam("export","Export model as mps file", |
---|
1516 | EXPORT); |
---|
1517 | parameters[numberParameters-1].setLonghelp |
---|
1518 | ( |
---|
1519 | "This will write an MPS format file to the given file name. It will use the default\ |
---|
1520 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
1521 | is initialized to 'default.mps'." |
---|
1522 | ); |
---|
1523 | #ifdef COIN_HAS_CBC |
---|
1524 | parameters[numberParameters++]= |
---|
1525 | CbcOrClpParam("extra1","Extra integer parameter 1", |
---|
1526 | -1,COIN_INT_MAX,EXTRA1,false); |
---|
1527 | parameters[numberParameters-1].setIntValue(-1); |
---|
1528 | parameters[numberParameters++]= |
---|
1529 | CbcOrClpParam("extra2","Extra integer parameter 2", |
---|
1530 | -1,COIN_INT_MAX,EXTRA2,false); |
---|
1531 | parameters[numberParameters-1].setIntValue(-1); |
---|
1532 | parameters[numberParameters++]= |
---|
1533 | CbcOrClpParam("extra3","Extra integer parameter 3", |
---|
1534 | -1,COIN_INT_MAX,EXTRA3,false); |
---|
1535 | parameters[numberParameters-1].setIntValue(-1); |
---|
1536 | parameters[numberParameters++]= |
---|
1537 | CbcOrClpParam("extra4","Extra integer parameter 4", |
---|
1538 | -1,COIN_INT_MAX,EXTRA4,false); |
---|
1539 | parameters[numberParameters-1].setIntValue(-1); |
---|
1540 | #endif |
---|
1541 | #ifdef COIN_HAS_CLP |
---|
1542 | parameters[numberParameters++]= |
---|
1543 | CbcOrClpParam("fakeB!ound","All bounds <= this value - DEBUG", |
---|
1544 | 1.0,1.0e15,FAKEBOUND,false); |
---|
1545 | #ifdef COIN_HAS_CBC |
---|
1546 | parameters[numberParameters++]= |
---|
1547 | CbcOrClpParam("feas!ibilityPump","Whether to try Feasibility Pump", |
---|
1548 | "off",FPUMP); |
---|
1549 | parameters[numberParameters-1].append("on"); |
---|
1550 | parameters[numberParameters-1].setLonghelp |
---|
1551 | ( |
---|
1552 | "This switches on feasibility pump heuristic at root. This is due to Fischetti and Lodi \ |
---|
1553 | and uses a sequence of Lps to try and get an integer feasible solution. \ |
---|
1554 | Some fine tuning is available by passFeasibilityPump." |
---|
1555 | ); |
---|
1556 | parameters[numberParameters++]= |
---|
1557 | CbcOrClpParam("fix!OnDj","Try heuristic based on fixing variables with \ |
---|
1558 | reduced costs greater than this", |
---|
1559 | -1.0e20,1.0e20,DJFIX,false); |
---|
1560 | parameters[numberParameters-1].setLonghelp |
---|
1561 | ( |
---|
1562 | "If this is set integer variables with reduced costs greater than this will be fixed \ |
---|
1563 | before branch and bound - use with extreme caution!" |
---|
1564 | ); |
---|
1565 | parameters[numberParameters++]= |
---|
1566 | CbcOrClpParam("flow!CoverCuts","Whether to use Flow Cover cuts", |
---|
1567 | "off",FLOWCUTS); |
---|
1568 | parameters[numberParameters-1].append("on"); |
---|
1569 | parameters[numberParameters-1].append("root"); |
---|
1570 | parameters[numberParameters-1].append("ifmove"); |
---|
1571 | parameters[numberParameters-1].append("forceOn"); |
---|
1572 | parameters[numberParameters-1].setLonghelp |
---|
1573 | ( |
---|
1574 | "This switches on flow cover cuts (either at root or in entire tree) \ |
---|
1575 | See branchAndCut for information on options." |
---|
1576 | ); |
---|
1577 | parameters[numberParameters++]= |
---|
1578 | CbcOrClpParam("force!Solution","Whether to use given solution as crash for BAB", |
---|
1579 | "off",USESOLUTION); |
---|
1580 | parameters[numberParameters-1].append("on"); |
---|
1581 | parameters[numberParameters-1].setLonghelp |
---|
1582 | ( |
---|
1583 | "If on then tries to branch to solution given by AMPL or priorities file." |
---|
1584 | ); |
---|
1585 | #endif |
---|
1586 | parameters[numberParameters++]= |
---|
1587 | CbcOrClpParam("gamma!(Delta)","Whether to regularize barrier", |
---|
1588 | "off",GAMMA,7,false); |
---|
1589 | parameters[numberParameters-1].append("on"); |
---|
1590 | parameters[numberParameters-1].append("gamma"); |
---|
1591 | parameters[numberParameters-1].append("delta"); |
---|
1592 | parameters[numberParameters-1].append("onstrong"); |
---|
1593 | parameters[numberParameters-1].append("gammastrong"); |
---|
1594 | parameters[numberParameters-1].append("deltastrong"); |
---|
1595 | #endif |
---|
1596 | #ifdef COIN_HAS_CBC |
---|
1597 | parameters[numberParameters++]= |
---|
1598 | CbcOrClpParam("gomory!Cuts","Whether to use Gomory cuts", |
---|
1599 | "off",GOMORYCUTS); |
---|
1600 | parameters[numberParameters-1].append("on"); |
---|
1601 | parameters[numberParameters-1].append("root"); |
---|
1602 | parameters[numberParameters-1].append("ifmove"); |
---|
1603 | parameters[numberParameters-1].append("forceOn"); |
---|
1604 | parameters[numberParameters-1].setLonghelp |
---|
1605 | ( |
---|
1606 | "The original cuts - beware of imitations! Having gone out of favor, they are now more \ |
---|
1607 | fashionable as LP solvers are more robust and they interact well with other cuts. They will almost always \ |
---|
1608 | give cuts (although in this executable they are limited as to number of variables in cut). \ |
---|
1609 | However the cuts may be dense so it is worth experimenting. \ |
---|
1610 | See branchAndCut for information on options." |
---|
1611 | ); |
---|
1612 | parameters[numberParameters++]= |
---|
1613 | CbcOrClpParam("greedy!Heuristic","Whether to use a greedy heuristic", |
---|
1614 | "off",GREEDY); |
---|
1615 | parameters[numberParameters-1].append("on"); |
---|
1616 | parameters[numberParameters-1].append("root"); |
---|
1617 | parameters[numberParameters-1].setLonghelp |
---|
1618 | ( |
---|
1619 | "Switches on a greedy heuristic which will try and obtain a solution. It may just fix a \ |
---|
1620 | percentage of variables and then try a small branch and cut run." |
---|
1621 | ); |
---|
1622 | parameters[numberParameters++]= |
---|
1623 | CbcOrClpParam("heur!isticsOnOff","Switches most heuristics on or off", |
---|
1624 | "off",HEURISTICSTRATEGY); |
---|
1625 | parameters[numberParameters-1].append("on"); |
---|
1626 | parameters[numberParameters-1].setLonghelp |
---|
1627 | ( |
---|
1628 | "This can be used to switch on or off all heuristics. Then you can do \ |
---|
1629 | individual ones off or on. CbcTreeLocal is not included as it dramatically \ |
---|
1630 | alters search." |
---|
1631 | ); |
---|
1632 | #endif |
---|
1633 | parameters[numberParameters++]= |
---|
1634 | CbcOrClpParam("help","Print out version, non-standard options and some help", |
---|
1635 | HELP,3); |
---|
1636 | parameters[numberParameters-1].setLonghelp |
---|
1637 | ( |
---|
1638 | "This prints out some help to get user started. If you have printed this then \ |
---|
1639 | you should be past that stage:-)" |
---|
1640 | ); |
---|
1641 | #ifdef COIN_HAS_CBC |
---|
1642 | parameters[numberParameters++]= |
---|
1643 | CbcOrClpParam("hot!StartMaxIts","Maximum iterations on hot start", |
---|
1644 | 0,COIN_INT_MAX,MAXHOTITS,false); |
---|
1645 | #endif |
---|
1646 | #ifdef COIN_HAS_CLP |
---|
1647 | parameters[numberParameters++]= |
---|
1648 | CbcOrClpParam("idiot!Crash","Whether to try idiot crash", |
---|
1649 | -1,999999,IDIOT); |
---|
1650 | parameters[numberParameters-1].setLonghelp |
---|
1651 | ( |
---|
1652 | "This is a type of 'crash' which works well on some homogeneous problems.\ |
---|
1653 | It works best on problems with unit elements and rhs but will do something to any model. It should only be\ |
---|
1654 | used before primal. It can be set to -1 when the code decides for itself whether to use it,\ |
---|
1655 | 0 to switch off or n > 0 to do n passes." |
---|
1656 | ); |
---|
1657 | #endif |
---|
1658 | parameters[numberParameters++]= |
---|
1659 | CbcOrClpParam("import","Import model from mps file", |
---|
1660 | IMPORT,3); |
---|
1661 | parameters[numberParameters-1].setLonghelp |
---|
1662 | ( |
---|
1663 | "This will read an MPS format file from the given file name. It will use the default\ |
---|
1664 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
1665 | is initialized to '', i.e. it must be set. If you have libgz then it can read compressed\ |
---|
1666 | files 'xxxxxxxx.gz'.." |
---|
1667 | ); |
---|
1668 | #ifdef COIN_HAS_CBC |
---|
1669 | parameters[numberParameters++]= |
---|
1670 | CbcOrClpParam("inc!rement","A valid solution must be at least this \ |
---|
1671 | much better than last integer solution", |
---|
1672 | -1.0e20,1.0e20,INCREMENT); |
---|
1673 | parameters[numberParameters-1].setLonghelp |
---|
1674 | ( |
---|
1675 | "Whenever a solution is found the bound on solutions is set to solution (in a minimization\ |
---|
1676 | sense) plus this. If it is not set then the code will try and work one out e.g. if \ |
---|
1677 | all objective coefficients are multiples of 0.01 and only integer variables have entries in \ |
---|
1678 | objective then this can be set to 0.01. Be careful if you set this negative!" |
---|
1679 | ); |
---|
1680 | parameters[numberParameters++]= |
---|
1681 | CbcOrClpParam("inf!easibilityWeight","Each integer infeasibility is expected \ |
---|
1682 | to cost this much", |
---|
1683 | 0.0,1.0e20,INFEASIBILITYWEIGHT); |
---|
1684 | parameters[numberParameters-1].setLonghelp |
---|
1685 | ( |
---|
1686 | "A primitive way of deciding which node to explore next. Satisfying each integer infeasibility is \ |
---|
1687 | expected to cost this much." |
---|
1688 | ); |
---|
1689 | parameters[numberParameters++]= |
---|
1690 | CbcOrClpParam("initialS!olve","Solve to continuous", |
---|
1691 | SOLVECONTINUOUS); |
---|
1692 | parameters[numberParameters-1].setLonghelp |
---|
1693 | ( |
---|
1694 | "This just solves the problem to continuous - without adding any cuts" |
---|
1695 | ); |
---|
1696 | parameters[numberParameters++]= |
---|
1697 | CbcOrClpParam("integerT!olerance","For an optimal solution \ |
---|
1698 | no integer variable may be this away from an integer value", |
---|
1699 | 1.0e-20,0.5,INTEGERTOLERANCE); |
---|
1700 | parameters[numberParameters-1].setLonghelp |
---|
1701 | ( |
---|
1702 | "Beware of setting this smaller than the primal tolerance." |
---|
1703 | ); |
---|
1704 | #endif |
---|
1705 | #ifdef COIN_HAS_CLP |
---|
1706 | parameters[numberParameters++]= |
---|
1707 | CbcOrClpParam("keepN!ames","Whether to keep names from import", |
---|
1708 | "on",KEEPNAMES); |
---|
1709 | parameters[numberParameters-1].append("off"); |
---|
1710 | parameters[numberParameters-1].setLonghelp |
---|
1711 | ( |
---|
1712 | "It saves space to get rid of names so if you need to you can set this to off. \ |
---|
1713 | This needs to be set before the import of model - so -keepnames off -import xxxxx.mps." |
---|
1714 | ); |
---|
1715 | parameters[numberParameters++]= |
---|
1716 | CbcOrClpParam("KKT","Whether to use KKT factorization", |
---|
1717 | "off",KKT,7,false); |
---|
1718 | parameters[numberParameters-1].append("on"); |
---|
1719 | #endif |
---|
1720 | #ifdef COIN_HAS_CBC |
---|
1721 | parameters[numberParameters++]= |
---|
1722 | CbcOrClpParam("knapsack!Cuts","Whether to use Knapsack cuts", |
---|
1723 | "off",KNAPSACKCUTS); |
---|
1724 | parameters[numberParameters-1].append("on"); |
---|
1725 | parameters[numberParameters-1].append("root"); |
---|
1726 | parameters[numberParameters-1].append("ifmove"); |
---|
1727 | parameters[numberParameters-1].append("forceOn"); |
---|
1728 | parameters[numberParameters-1].setLonghelp |
---|
1729 | ( |
---|
1730 | "This switches on knapsack cuts (either at root or in entire tree) \ |
---|
1731 | See branchAndCut for information on options." |
---|
1732 | ); |
---|
1733 | parameters[numberParameters++]= |
---|
1734 | CbcOrClpParam("lift!AndProjectCuts","Whether to use Lift and Project cuts", |
---|
1735 | "off",LANDPCUTS); |
---|
1736 | parameters[numberParameters-1].append("on"); |
---|
1737 | parameters[numberParameters-1].append("root"); |
---|
1738 | parameters[numberParameters-1].append("ifmove"); |
---|
1739 | parameters[numberParameters-1].append("forceOn"); |
---|
1740 | parameters[numberParameters-1].setLonghelp |
---|
1741 | ( |
---|
1742 | "Lift and project cuts - may be expensive to compute. \ |
---|
1743 | See branchAndCut for information on options." |
---|
1744 | ); |
---|
1745 | parameters[numberParameters++]= |
---|
1746 | CbcOrClpParam("local!TreeSearch","Whether to use local treesearch", |
---|
1747 | "off",LOCALTREE); |
---|
1748 | parameters[numberParameters-1].append("on"); |
---|
1749 | parameters[numberParameters-1].setLonghelp |
---|
1750 | ( |
---|
1751 | "This switches on a local search algorithm when a solution is found. This is from \ |
---|
1752 | Fischetti and Lodi and is not really a heuristic although it can be used as one. \ |
---|
1753 | When used from Coin solve it has limited functionality. It is not switched on when \ |
---|
1754 | heuristics are switched on." |
---|
1755 | ); |
---|
1756 | #endif |
---|
1757 | #ifndef COIN_HAS_CBC |
---|
1758 | parameters[numberParameters++]= |
---|
1759 | CbcOrClpParam("log!Level","Level of detail in Solver output", |
---|
1760 | -1,63,SOLVERLOGLEVEL); |
---|
1761 | #else |
---|
1762 | parameters[numberParameters++]= |
---|
1763 | CbcOrClpParam("log!Level","Level of detail in Coin branch and Cut output", |
---|
1764 | -63,63,LOGLEVEL); |
---|
1765 | parameters[numberParameters-1].setIntValue(1); |
---|
1766 | #endif |
---|
1767 | parameters[numberParameters-1].setLonghelp |
---|
1768 | ( |
---|
1769 | "If 0 then there should be no output in normal circumstances. 1 is probably the best\ |
---|
1770 | value for most uses, while 2 and 3 give more information." |
---|
1771 | ); |
---|
1772 | parameters[numberParameters++]= |
---|
1773 | CbcOrClpParam("max!imize","Set optimization direction to maximize", |
---|
1774 | MAXIMIZE,7); |
---|
1775 | parameters[numberParameters-1].setLonghelp |
---|
1776 | ( |
---|
1777 | "The default is minimize - use 'maximize' for maximization.\n\ |
---|
1778 | You can also use the parameters 'direction maximize'." |
---|
1779 | ); |
---|
1780 | #ifdef COIN_HAS_CLP |
---|
1781 | parameters[numberParameters++]= |
---|
1782 | CbcOrClpParam("maxF!actor","Maximum number of iterations between \ |
---|
1783 | refactorizations", |
---|
1784 | 1,999999,MAXFACTOR); |
---|
1785 | parameters[numberParameters-1].setLonghelp |
---|
1786 | ( |
---|
1787 | "If this is at its initial value of 200 then in this executable clp will guess at a\ |
---|
1788 | value to use. Otherwise the user can set a value. The code may decide to re-factorize\ |
---|
1789 | earlier for accuracy." |
---|
1790 | ); |
---|
1791 | parameters[numberParameters++]= |
---|
1792 | CbcOrClpParam("maxIt!erations","Maximum number of iterations before \ |
---|
1793 | stopping", |
---|
1794 | 0,2147483647,MAXITERATION); |
---|
1795 | parameters[numberParameters-1].setLonghelp |
---|
1796 | ( |
---|
1797 | "This can be used for testing purposes. The corresponding library call\n\ |
---|
1798 | \tsetMaximumIterations(value)\n can be useful. If the code stops on\ |
---|
1799 | seconds or by an interrupt this will be treated as stopping on maximum iterations" |
---|
1800 | ); |
---|
1801 | #endif |
---|
1802 | #ifdef COIN_HAS_CBC |
---|
1803 | parameters[numberParameters++]= |
---|
1804 | CbcOrClpParam("maxN!odes","Maximum number of nodes to do", |
---|
1805 | 0,2147483647,MAXNODES); |
---|
1806 | parameters[numberParameters-1].setLonghelp |
---|
1807 | ( |
---|
1808 | "This is a repeatable way to limit search. Normally using time is easier \ |
---|
1809 | but then the results may not be repeatable." |
---|
1810 | ); |
---|
1811 | parameters[numberParameters++]= |
---|
1812 | CbcOrClpParam("maxS!olutions","Maximum number of solutions to get", |
---|
1813 | 1,2147483647,MAXSOLS); |
---|
1814 | parameters[numberParameters-1].setLonghelp |
---|
1815 | ( |
---|
1816 | "You may want to stop after (say) two solutions or an hour." |
---|
1817 | ); |
---|
1818 | #endif |
---|
1819 | parameters[numberParameters++]= |
---|
1820 | CbcOrClpParam("min!imize","Set optimization direction to minimize", |
---|
1821 | MINIMIZE,7); |
---|
1822 | parameters[numberParameters-1].setLonghelp |
---|
1823 | ( |
---|
1824 | "The default is minimize - use 'maximize' for maximization.\n\ |
---|
1825 | This should only be necessary if you have previously set maximization \ |
---|
1826 | You can also use the parameters 'direction minimize'." |
---|
1827 | ); |
---|
1828 | #ifdef COIN_HAS_CBC |
---|
1829 | parameters[numberParameters++]= |
---|
1830 | CbcOrClpParam("mipO!ptions","Dubious options for mip", |
---|
1831 | 0,COIN_INT_MAX,MIPOPTIONS,false); |
---|
1832 | parameters[numberParameters++]= |
---|
1833 | CbcOrClpParam("more!MipOptions","More dubious options for mip", |
---|
1834 | -1,COIN_INT_MAX,MOREMIPOPTIONS,false); |
---|
1835 | parameters[numberParameters++]= |
---|
1836 | CbcOrClpParam("mixed!IntegerRoundingCuts","Whether to use Mixed Integer Rounding cuts", |
---|
1837 | "off",MIXEDCUTS); |
---|
1838 | parameters[numberParameters-1].append("on"); |
---|
1839 | parameters[numberParameters-1].append("root"); |
---|
1840 | parameters[numberParameters-1].append("ifmove"); |
---|
1841 | parameters[numberParameters-1].append("forceOn"); |
---|
1842 | parameters[numberParameters-1].setLonghelp |
---|
1843 | ( |
---|
1844 | "This switches on mixed integer rounding cuts (either at root or in entire tree) \ |
---|
1845 | See branchAndCut for information on options." |
---|
1846 | ); |
---|
1847 | #endif |
---|
1848 | parameters[numberParameters++]= |
---|
1849 | CbcOrClpParam("mess!ages","Controls if Clpnnnn is printed", |
---|
1850 | "off",MESSAGES); |
---|
1851 | parameters[numberParameters-1].append("on"); |
---|
1852 | parameters[numberParameters-1].setLonghelp |
---|
1853 | ("The default behavior is to put out messages such as:\n\ |
---|
1854 | Clp0005 2261 Objective 109.024 Primal infeas 944413 (758)\n\ |
---|
1855 | but this program turns this off to make it look more friendly. It can be useful\ |
---|
1856 | to turn them back on if you want to be able to 'grep' for particular messages or if\ |
---|
1857 | you intend to override the behavior of a particular message." |
---|
1858 | ); |
---|
1859 | #ifdef COIN_HAS_CBC |
---|
1860 | parameters[numberParameters++]= |
---|
1861 | CbcOrClpParam("miniT!ree","Size of fast mini tree", |
---|
1862 | 0,COIN_INT_MAX,NUMBERMINI,false); |
---|
1863 | parameters[numberParameters-1].setLonghelp |
---|
1864 | ( |
---|
1865 | "The idea is that I can do a small tree fast. \ |
---|
1866 | This is a first try and will hopefully become more sophisticated." |
---|
1867 | ); |
---|
1868 | parameters[numberParameters++]= |
---|
1869 | CbcOrClpParam("miplib","Do some of miplib test set", |
---|
1870 | MIPLIB,3); |
---|
1871 | #endif |
---|
1872 | #ifdef COIN_HAS_CLP |
---|
1873 | parameters[numberParameters++]= |
---|
1874 | CbcOrClpParam("netlib","Solve entire netlib test set", |
---|
1875 | NETLIB_EITHER,3); |
---|
1876 | parameters[numberParameters-1].setLonghelp |
---|
1877 | ( |
---|
1878 | "This exercises the unit test for clp and then solves the netlib test set using dual or primal.\ |
---|
1879 | The user can set options before e.g. clp -presolve off -netlib" |
---|
1880 | ); |
---|
1881 | #ifdef REAL_BARRIER |
---|
1882 | parameters[numberParameters++]= |
---|
1883 | CbcOrClpParam("netlibB!arrier","Solve entire netlib test set with barrier", |
---|
1884 | NETLIB_BARRIER,3); |
---|
1885 | parameters[numberParameters-1].setLonghelp |
---|
1886 | ( |
---|
1887 | "This exercises the unit test for clp and then solves the netlib test set using barrier.\ |
---|
1888 | The user can set options before e.g. clp -kkt on -netlib" |
---|
1889 | ); |
---|
1890 | #endif |
---|
1891 | parameters[numberParameters++]= |
---|
1892 | CbcOrClpParam("netlibD!ual","Solve entire netlib test set (dual)", |
---|
1893 | NETLIB_DUAL,3); |
---|
1894 | parameters[numberParameters-1].setLonghelp |
---|
1895 | ( |
---|
1896 | "This exercises the unit test for clp and then solves the netlib test set using dual.\ |
---|
1897 | The user can set options before e.g. clp -presolve off -netlib" |
---|
1898 | ); |
---|
1899 | parameters[numberParameters++]= |
---|
1900 | CbcOrClpParam("netlibP!rimal","Solve entire netlib test set (primal)", |
---|
1901 | NETLIB_PRIMAL,3); |
---|
1902 | parameters[numberParameters-1].setLonghelp |
---|
1903 | ( |
---|
1904 | "This exercises the unit test for clp and then solves the netlib test set using primal.\ |
---|
1905 | The user can set options before e.g. clp -presolve off -netlibp" |
---|
1906 | ); |
---|
1907 | parameters[numberParameters++]= |
---|
1908 | CbcOrClpParam("netlibT!une","Solve entire netlib test set with 'best' algorithm", |
---|
1909 | NETLIB_TUNE,3); |
---|
1910 | parameters[numberParameters-1].setLonghelp |
---|
1911 | ( |
---|
1912 | "This exercises the unit test for clp and then solves the netlib test set using whatever \ |
---|
1913 | works best. I know this is cheating but it also stresses the code better by doing a \ |
---|
1914 | mixture of stuff. The best algorithm was chosen on a Linux ThinkPad using native cholesky \ |
---|
1915 | with University of Florida ordering." |
---|
1916 | ); |
---|
1917 | parameters[numberParameters++]= |
---|
1918 | CbcOrClpParam("network","Tries to make network matrix", |
---|
1919 | NETWORK,7,false); |
---|
1920 | parameters[numberParameters-1].setLonghelp |
---|
1921 | ( |
---|
1922 | "Clp will go faster if the matrix can be converted to a network. The matrix\ |
---|
1923 | operations may be a bit faster with more efficient storage, but the main advantage\ |
---|
1924 | comes from using a network factorization. It will probably not be as fast as a \ |
---|
1925 | specialized network code." |
---|
1926 | ); |
---|
1927 | #ifdef COIN_HAS_CBC |
---|
1928 | parameters[numberParameters++]= |
---|
1929 | CbcOrClpParam("node!Strategy","What strategy to use to select nodes", |
---|
1930 | "hybrid",NODESTRATEGY); |
---|
1931 | parameters[numberParameters-1].append("fewest"); |
---|
1932 | parameters[numberParameters-1].append("depth"); |
---|
1933 | parameters[numberParameters-1].append("upfewest"); |
---|
1934 | parameters[numberParameters-1].append("downfewest"); |
---|
1935 | parameters[numberParameters-1].append("updepth"); |
---|
1936 | parameters[numberParameters-1].append("downdepth"); |
---|
1937 | parameters[numberParameters-1].setLonghelp |
---|
1938 | ( |
---|
1939 | "Normally before a solution the code will choose node with fewest infeasibilities. \ |
---|
1940 | You can choose depth as the criterion. You can also say if up or down branch must \ |
---|
1941 | be done first (the up down choice will carry on after solution). \ |
---|
1942 | Default has now been changed to hybrid which is breadth first on small depth nodes then fewest." |
---|
1943 | ); |
---|
1944 | parameters[numberParameters++]= |
---|
1945 | CbcOrClpParam("numberA!nalyze","Number of analysis iterations", |
---|
1946 | -COIN_INT_MAX,COIN_INT_MAX,NUMBERANALYZE,false); |
---|
1947 | parameters[numberParameters-1].setLonghelp |
---|
1948 | ( |
---|
1949 | "This says how many iterations to spend at root node analyzing problem. \ |
---|
1950 | This is a first try and will hopefully become more sophisticated." |
---|
1951 | ); |
---|
1952 | #endif |
---|
1953 | parameters[numberParameters++]= |
---|
1954 | CbcOrClpParam("objective!Scale","Scale factor to apply to objective", |
---|
1955 | -1.0e20,1.0e20,OBJSCALE,false); |
---|
1956 | parameters[numberParameters-1].setLonghelp |
---|
1957 | ( |
---|
1958 | "If the objective function has some very large values, you may wish to scale them\ |
---|
1959 | internally by this amount. It can also be set by autoscale. It is applied after scaling" |
---|
1960 | ); |
---|
1961 | parameters[numberParameters-1].setDoubleValue(1.0); |
---|
1962 | #endif |
---|
1963 | #ifdef COIN_HAS_CBC |
---|
1964 | parameters[numberParameters++]= |
---|
1965 | CbcOrClpParam("outDup!licates","takes duplicate rows etc out of integer model", |
---|
1966 | OUTDUPROWS,7,false); |
---|
1967 | #endif |
---|
1968 | parameters[numberParameters++]= |
---|
1969 | CbcOrClpParam("output!Format","Which output format to use", |
---|
1970 | 1,6,OUTPUTFORMAT); |
---|
1971 | parameters[numberParameters-1].setLonghelp |
---|
1972 | ( |
---|
1973 | "Normally export will be done using normal representation for numbers and two values\ |
---|
1974 | per line. You may want to do just one per line (for grep or suchlike) and you may wish\ |
---|
1975 | to save with absolute accuracy using a coded version of the IEEE value. A value of 2 is normal.\ |
---|
1976 | otherwise odd values gives one value per line, even two. Values 1,2 give normal format, 3,4\ |
---|
1977 | gives greater precision, while 5,6 give IEEE values. When used for exporting a basis 1 does not save \ |
---|
1978 | values, 2 saves values, 3 with greater accuracy and 4 in IEEE." |
---|
1979 | ); |
---|
1980 | #ifdef COIN_HAS_CBC |
---|
1981 | parameters[numberParameters++]= |
---|
1982 | CbcOrClpParam("passC!uts","Number of cut passes at root node", |
---|
1983 | -999999,999999,CUTPASS); |
---|
1984 | parameters[numberParameters-1].setLonghelp |
---|
1985 | ( |
---|
1986 | "The default is 100 passes if less than 500 columns, 100 passes (but \ |
---|
1987 | stop if drop small if less than 5000 columns, 20 otherwise" |
---|
1988 | ); |
---|
1989 | parameters[numberParameters++]= |
---|
1990 | CbcOrClpParam("passF!easibilityPump","How many passes in feasibility pump", |
---|
1991 | 0,10000,FPUMPITS); |
---|
1992 | parameters[numberParameters-1].setLonghelp |
---|
1993 | ( |
---|
1994 | "This fine tunes Feasibility Pump by doing more or fewer passes." |
---|
1995 | ); |
---|
1996 | parameters[numberParameters-1].setIntValue(20); |
---|
1997 | #endif |
---|
1998 | #ifdef COIN_HAS_CLP |
---|
1999 | parameters[numberParameters++]= |
---|
2000 | CbcOrClpParam("passP!resolve","How many passes in presolve", |
---|
2001 | -200,100,PRESOLVEPASS,false); |
---|
2002 | parameters[numberParameters-1].setLonghelp |
---|
2003 | ( |
---|
2004 | "Normally Presolve does 5 passes but you may want to do less to make it\ |
---|
2005 | more lightweight or do more if improvements are still being made. As Presolve will return\ |
---|
2006 | if nothing is being taken out, you should not normally need to use this fine tuning." |
---|
2007 | ); |
---|
2008 | #endif |
---|
2009 | #ifdef COIN_HAS_CBC |
---|
2010 | parameters[numberParameters++]= |
---|
2011 | CbcOrClpParam("passT!reeCuts","Number of cut passes in tree", |
---|
2012 | -999999,999999,CUTPASSINTREE); |
---|
2013 | parameters[numberParameters-1].setLonghelp |
---|
2014 | ( |
---|
2015 | "The default is one pass" |
---|
2016 | ); |
---|
2017 | #endif |
---|
2018 | #ifdef COIN_HAS_CLP |
---|
2019 | parameters[numberParameters++]= |
---|
2020 | CbcOrClpParam("pertV!alue","Method of perturbation", |
---|
2021 | -5000,102,PERTVALUE,false); |
---|
2022 | parameters[numberParameters++]= |
---|
2023 | CbcOrClpParam("perturb!ation","Whether to perturb problem", |
---|
2024 | "on",PERTURBATION); |
---|
2025 | parameters[numberParameters-1].append("off"); |
---|
2026 | parameters[numberParameters-1].setLonghelp |
---|
2027 | ( |
---|
2028 | "Perturbation helps to stop cycling, but Clp uses other measures for this.\ |
---|
2029 | However large problems and especially ones with unit elements and unit rhs or costs\ |
---|
2030 | benefit from perturbation. Normally Clp tries to be intelligent, but you can switch this off.\ |
---|
2031 | The Clp library has this off by default. This program has it on by default." |
---|
2032 | ); |
---|
2033 | parameters[numberParameters++]= |
---|
2034 | CbcOrClpParam("PFI","Whether to use Product Form of Inverse in simplex", |
---|
2035 | "off",PFI,7,false); |
---|
2036 | parameters[numberParameters-1].append("on"); |
---|
2037 | parameters[numberParameters-1].setLonghelp |
---|
2038 | ( |
---|
2039 | "By default clp uses Forrest-Tomlin L-U update. If you are masochistic you can switch it off." |
---|
2040 | ); |
---|
2041 | parameters[numberParameters++]= |
---|
2042 | CbcOrClpParam("plus!Minus","Tries to make +- 1 matrix", |
---|
2043 | PLUSMINUS,7,false); |
---|
2044 | parameters[numberParameters-1].setLonghelp |
---|
2045 | ( |
---|
2046 | "Clp will go slightly faster if the matrix can be converted so that the elements are\ |
---|
2047 | not stored and are known to be unit. The main advantage is memory use. Clp may automatically\ |
---|
2048 | see if it can convert the problem so you should not need to use this." |
---|
2049 | ); |
---|
2050 | parameters[numberParameters++]= |
---|
2051 | CbcOrClpParam("pO!ptions","Dubious print options", |
---|
2052 | 0,COIN_INT_MAX,PRINTOPTIONS,false); |
---|
2053 | parameters[numberParameters-1].setIntValue(0); |
---|
2054 | parameters[numberParameters-1].setLonghelp |
---|
2055 | ( |
---|
2056 | "If this is > 0 then presolve will give more information and branch and cut will give statistics" |
---|
2057 | ); |
---|
2058 | parameters[numberParameters++]= |
---|
2059 | CbcOrClpParam("preO!pt","Presolve options", |
---|
2060 | 0,COIN_INT_MAX,PRESOLVEOPTIONS,false); |
---|
2061 | #endif |
---|
2062 | parameters[numberParameters++]= |
---|
2063 | CbcOrClpParam("presolve","Whether to presolve problem", |
---|
2064 | "on",PRESOLVE); |
---|
2065 | parameters[numberParameters-1].append("off"); |
---|
2066 | parameters[numberParameters-1].append("more"); |
---|
2067 | parameters[numberParameters-1].append("file"); |
---|
2068 | parameters[numberParameters-1].setLonghelp |
---|
2069 | ( |
---|
2070 | "Presolve analyzes the model to find such things as redundant equations, equations\ |
---|
2071 | which fix some variables, equations which can be transformed into bounds etc etc. For the\ |
---|
2072 | initial solve of any problem this is worth doing unless you know that it will have no effect. \ |
---|
2073 | on will normally do 5 passes while using 'more' will do 10. If the problem is very large you may need \ |
---|
2074 | to write the original to file using 'file'." |
---|
2075 | ); |
---|
2076 | #ifdef COIN_HAS_CBC |
---|
2077 | parameters[numberParameters++]= |
---|
2078 | CbcOrClpParam("preprocess","Whether to use integer preprocessing", |
---|
2079 | "off",PREPROCESS); |
---|
2080 | parameters[numberParameters-1].append("on"); |
---|
2081 | parameters[numberParameters-1].append("save"); |
---|
2082 | parameters[numberParameters-1].append("equal"); |
---|
2083 | parameters[numberParameters-1].append("sos"); |
---|
2084 | parameters[numberParameters-1].append("trysos"); |
---|
2085 | parameters[numberParameters-1].append("equalall"); |
---|
2086 | parameters[numberParameters-1].append("strategy"); |
---|
2087 | parameters[numberParameters-1].setLonghelp |
---|
2088 | ( |
---|
2089 | "This tries to reduce size of model in a similar way to presolve and \ |
---|
2090 | it also tries to strengthen the model - this can be very useful and is worth trying. \ |
---|
2091 | Save option saves on file presolved.mps. equal will turn <= cliques into \ |
---|
2092 | ==. sos will create sos sets if all 0-1 in sets (well one extra is allowed) \ |
---|
2093 | and no overlaps. trysos is same but allows any number extra. equalall will turn all \ |
---|
2094 | valid inequalities into equalities with integer slacks. strategy is as \ |
---|
2095 | on but uses CbcStrategy." |
---|
2096 | ); |
---|
2097 | #endif |
---|
2098 | #ifdef COIN_HAS_CLP |
---|
2099 | parameters[numberParameters++]= |
---|
2100 | CbcOrClpParam("preT!olerance","Tolerance to use in presolve", |
---|
2101 | 1.0e-20,1.0e12,PRESOLVETOLERANCE); |
---|
2102 | parameters[numberParameters-1].setLonghelp |
---|
2103 | ( |
---|
2104 | "The default is 1.0e-8 - you may wish to try 1.0e-7 if presolve says the problem is \ |
---|
2105 | infeasible and you have awkward numbers and you are sure the problem is really feasible." |
---|
2106 | ); |
---|
2107 | parameters[numberParameters++]= |
---|
2108 | CbcOrClpParam("primalP!ivot","Primal pivot choice algorithm", |
---|
2109 | "auto!matic",PRIMALPIVOT); |
---|
2110 | parameters[numberParameters-1].append("exa!ct"); |
---|
2111 | parameters[numberParameters-1].append("dant!zig"); |
---|
2112 | parameters[numberParameters-1].append("part!ial"); |
---|
2113 | parameters[numberParameters-1].append("steep!est"); |
---|
2114 | parameters[numberParameters-1].append("change"); |
---|
2115 | parameters[numberParameters-1].append("sprint"); |
---|
2116 | parameters[numberParameters-1].setLonghelp |
---|
2117 | ( |
---|
2118 | "Clp can use any pivot selection algorithm which the user codes as long as it\ |
---|
2119 | implements the features in the abstract pivot base class. The Dantzig method is implemented\ |
---|
2120 | to show a simple method but its use is deprecated. Exact devex is the method of choice and there\ |
---|
2121 | are two variants which keep all weights updated but only scan a subset each iteration.\ |
---|
2122 | Partial switches this on while change initially does dantzig until the factorization\ |
---|
2123 | becomes denser. This is still a work in progress." |
---|
2124 | ); |
---|
2125 | parameters[numberParameters++]= |
---|
2126 | CbcOrClpParam("primalS!implex","Do primal simplex algorithm", |
---|
2127 | PRIMALSIMPLEX); |
---|
2128 | parameters[numberParameters-1].setLonghelp |
---|
2129 | ( |
---|
2130 | "This command solves the current model using the primal algorithm.\ |
---|
2131 | The default is to use exact devex.\ |
---|
2132 | The time and iterations may be affected by settings such as presolve, scaling, crash\ |
---|
2133 | and also by column selection method, infeasibility weight and dual and primal tolerances." |
---|
2134 | ); |
---|
2135 | #endif |
---|
2136 | parameters[numberParameters++]= |
---|
2137 | CbcOrClpParam("primalT!olerance","For an optimal solution \ |
---|
2138 | no primal infeasibility may exceed this value", |
---|
2139 | 1.0e-20,1.0e12,PRIMALTOLERANCE); |
---|
2140 | parameters[numberParameters-1].setLonghelp |
---|
2141 | ( |
---|
2142 | "Normally the default tolerance is fine, but you may want to increase it a\ |
---|
2143 | bit if a primal run seems to be having a hard time" |
---|
2144 | ); |
---|
2145 | #ifdef COIN_HAS_CLP |
---|
2146 | parameters[numberParameters++]= |
---|
2147 | CbcOrClpParam("primalW!eight","Initially algorithm acts as if it \ |
---|
2148 | costs this much to be infeasible", |
---|
2149 | 1.0e-20,1.0e20,PRIMALWEIGHT); |
---|
2150 | parameters[numberParameters-1].setLonghelp |
---|
2151 | ( |
---|
2152 | "The primal algorithm in Clp is a single phase algorithm as opposed to a two phase\ |
---|
2153 | algorithm where you first get feasible then optimal. So Clp is minimizing this weight times\ |
---|
2154 | the sum of primal infeasibilities plus the true objective function (in minimization sense).\ |
---|
2155 | Too high a value may mean more iterations, while too low a bound means\ |
---|
2156 | the code may go all the way and then have to increase the weight in order to get feasible.\ |
---|
2157 | OSL had a heuristic to\ |
---|
2158 | adjust bounds, maybe we need that here." |
---|
2159 | ); |
---|
2160 | #endif |
---|
2161 | parameters[numberParameters++]= |
---|
2162 | CbcOrClpParam("printi!ngOptions","Print options", |
---|
2163 | "normal",INTPRINT,3); |
---|
2164 | parameters[numberParameters-1].append("integer"); |
---|
2165 | parameters[numberParameters-1].append("special"); |
---|
2166 | parameters[numberParameters-1].append("rows"); |
---|
2167 | parameters[numberParameters-1].append("all"); |
---|
2168 | parameters[numberParameters-1].setLonghelp |
---|
2169 | ( |
---|
2170 | "This changes the amount and format of printing a solution:\nnormal - nonzero column variables \n\ |
---|
2171 | integer - nonzero integer column variables\n\ |
---|
2172 | special - in format suitable for OsiRowCutDebugger\n\ |
---|
2173 | rows - nonzero column variables and row activities\n\ |
---|
2174 | all - all column variables and row activities.\n\ |
---|
2175 | \nFor non-integer problems 'integer' and 'special' act like 'normal'. \ |
---|
2176 | Also see printMask for controlling output." |
---|
2177 | ); |
---|
2178 | parameters[numberParameters++]= |
---|
2179 | CbcOrClpParam("printM!ask","Control printing of solution on a mask", |
---|
2180 | PRINTMASK,3); |
---|
2181 | parameters[numberParameters-1].setLonghelp |
---|
2182 | ( |
---|
2183 | "If set then only those names which match mask are printed in a solution. \ |
---|
2184 | '?' matches any character and '*' matches any set of characters. \ |
---|
2185 | The default is '' i.e. unset so all variables are printed. \ |
---|
2186 | This is only active if model has names." |
---|
2187 | ); |
---|
2188 | #ifdef COIN_HAS_CBC |
---|
2189 | parameters[numberParameters++]= |
---|
2190 | CbcOrClpParam("prio!rityIn","Import priorities etc from file", |
---|
2191 | PRIORITYIN,3); |
---|
2192 | parameters[numberParameters-1].setLonghelp |
---|
2193 | ( |
---|
2194 | "This will read a file with priorities from the given file name. It will use the default\ |
---|
2195 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
2196 | is initialized to '', i.e. it must be set. This can not read from compressed files. \ |
---|
2197 | File is in csv format with allowed headings - name, number, priority, direction, up, down, solution. Exactly one of\ |
---|
2198 | name and number must be given." |
---|
2199 | ); |
---|
2200 | parameters[numberParameters++]= |
---|
2201 | CbcOrClpParam("probing!Cuts","Whether to use Probing cuts", |
---|
2202 | "off",PROBINGCUTS); |
---|
2203 | parameters[numberParameters-1].append("on"); |
---|
2204 | parameters[numberParameters-1].append("root"); |
---|
2205 | parameters[numberParameters-1].append("ifmove"); |
---|
2206 | parameters[numberParameters-1].append("forceOn"); |
---|
2207 | parameters[numberParameters-1].append("forceOnBut"); |
---|
2208 | parameters[numberParameters-1].append("forceOnStrong"); |
---|
2209 | parameters[numberParameters-1].append("forceOnButStrong"); |
---|
2210 | parameters[numberParameters-1].setLonghelp |
---|
2211 | ( |
---|
2212 | "This switches on probing cuts (either at root or in entire tree) \ |
---|
2213 | See branchAndCut for information on options. \ |
---|
2214 | but strong options do more probing" |
---|
2215 | ); |
---|
2216 | parameters[numberParameters++]= |
---|
2217 | CbcOrClpParam("pumpT!une","Dubious ideas for feasibility pump", |
---|
2218 | 0,100000000,FPUMPTUNE); |
---|
2219 | parameters[numberParameters-1].setLonghelp |
---|
2220 | ( |
---|
2221 | "This fine tunes Feasibility Pump \n\ |
---|
2222 | \t>=1000000 use as accumulate switch\n\ |
---|
2223 | \t>=1000 use index+1 as number of large loops\n\ |
---|
2224 | \t>=100 use 0.05 objvalue as increment\n\ |
---|
2225 | \t>=10 use +0.1 objvalue for cutoff (add)\n\ |
---|
2226 | \t1 == fix ints at bounds, 2 fix all integral ints, 3 and continuous at bounds" |
---|
2227 | ); |
---|
2228 | parameters[numberParameters-1].setIntValue(0); |
---|
2229 | #endif |
---|
2230 | parameters[numberParameters++]= |
---|
2231 | CbcOrClpParam("quit","Stops clp execution", |
---|
2232 | EXIT); |
---|
2233 | parameters[numberParameters-1].setLonghelp |
---|
2234 | ( |
---|
2235 | "This stops the execution of Clp, end, exit, quit and stop are synonyms" |
---|
2236 | ); |
---|
2237 | #ifdef COIN_HAS_CBC |
---|
2238 | parameters[numberParameters++]= |
---|
2239 | CbcOrClpParam("ratio!Gap","Stop when gap between best possible and \ |
---|
2240 | best less than this fraction of larger of two", |
---|
2241 | 0.0,1.0e20,GAPRATIO); |
---|
2242 | parameters[numberParameters-1].setDoubleValue(0.0); |
---|
2243 | parameters[numberParameters-1].setLonghelp |
---|
2244 | ( |
---|
2245 | "If the gap between best solution and best possible solution is less than this fraction \ |
---|
2246 | of the objective value at the root node then the search will terminate. See 'allowableGap' for a \ |
---|
2247 | way of using absolute value rather than fraction." |
---|
2248 | ); |
---|
2249 | #endif |
---|
2250 | #ifdef COIN_HAS_CLP |
---|
2251 | parameters[numberParameters++]= |
---|
2252 | CbcOrClpParam("reallyO!bjectiveScale","Scale factor to apply to objective in place", |
---|
2253 | -1.0e20,1.0e20,OBJSCALE2,false); |
---|
2254 | parameters[numberParameters-1].setLonghelp |
---|
2255 | ( |
---|
2256 | "You can set this to -1.0 to test maximization or other to stress code" |
---|
2257 | ); |
---|
2258 | parameters[numberParameters-1].setDoubleValue(1.0); |
---|
2259 | parameters[numberParameters++]= |
---|
2260 | CbcOrClpParam("reallyS!cale","Scales model in place", |
---|
2261 | REALLY_SCALE,7,false); |
---|
2262 | #endif |
---|
2263 | #ifdef COIN_HAS_CBC |
---|
2264 | parameters[numberParameters++]= |
---|
2265 | CbcOrClpParam("reduce!AndSplitCuts","Whether to use Reduce-and-Split cuts", |
---|
2266 | "off",REDSPLITCUTS); |
---|
2267 | parameters[numberParameters-1].append("on"); |
---|
2268 | parameters[numberParameters-1].append("root"); |
---|
2269 | parameters[numberParameters-1].append("ifmove"); |
---|
2270 | parameters[numberParameters-1].append("forceOn"); |
---|
2271 | parameters[numberParameters-1].setLonghelp |
---|
2272 | ( |
---|
2273 | "This switches on reduce and split cuts (either at root or in entire tree) \ |
---|
2274 | See branchAndCut for information on options." |
---|
2275 | ); |
---|
2276 | parameters[numberParameters++]= |
---|
2277 | CbcOrClpParam("residual!CapacityCuts","Whether to use Residual Capacity cuts", |
---|
2278 | "off",RESIDCUTS); |
---|
2279 | parameters[numberParameters-1].append("on"); |
---|
2280 | parameters[numberParameters-1].append("root"); |
---|
2281 | parameters[numberParameters-1].append("ifmove"); |
---|
2282 | parameters[numberParameters-1].append("forceOn"); |
---|
2283 | parameters[numberParameters-1].setLonghelp |
---|
2284 | ( |
---|
2285 | "Residual capacity cuts. \ |
---|
2286 | See branchAndCut for information on options." |
---|
2287 | ); |
---|
2288 | #endif |
---|
2289 | #ifdef COIN_HAS_CLP |
---|
2290 | parameters[numberParameters++]= |
---|
2291 | CbcOrClpParam("restore!Model","Restore model from binary file", |
---|
2292 | RESTORE); |
---|
2293 | parameters[numberParameters-1].setLonghelp |
---|
2294 | ( |
---|
2295 | "This reads data save by saveModel from the given file. It will use the default\ |
---|
2296 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
2297 | is initialized to 'default.prob'." |
---|
2298 | ); |
---|
2299 | parameters[numberParameters++]= |
---|
2300 | CbcOrClpParam("reverse","Reverses sign of objective", |
---|
2301 | REVERSE,7,false); |
---|
2302 | parameters[numberParameters-1].setLonghelp |
---|
2303 | ( |
---|
2304 | "Useful for testing if maximization works correctly" |
---|
2305 | ); |
---|
2306 | parameters[numberParameters++]= |
---|
2307 | CbcOrClpParam("rhs!Scale","Scale factor to apply to rhs and bounds", |
---|
2308 | -1.0e20,1.0e20,RHSSCALE,false); |
---|
2309 | parameters[numberParameters-1].setLonghelp |
---|
2310 | ( |
---|
2311 | "If the rhs or bounds have some very large meaningful values, you may wish to scale them\ |
---|
2312 | internally by this amount. It can also be set by autoscale" |
---|
2313 | ); |
---|
2314 | parameters[numberParameters-1].setDoubleValue(1.0); |
---|
2315 | #endif |
---|
2316 | #ifdef COIN_HAS_CBC |
---|
2317 | parameters[numberParameters++]= |
---|
2318 | CbcOrClpParam("Rins","Whether to try Relaxed Induced Neighborhood Search", |
---|
2319 | "off",RINS); |
---|
2320 | parameters[numberParameters-1].append("on"); |
---|
2321 | parameters[numberParameters-1].setLonghelp |
---|
2322 | ( |
---|
2323 | "This switches on Relaxed induced neighborhood Search." |
---|
2324 | ); |
---|
2325 | parameters[numberParameters++]= |
---|
2326 | CbcOrClpParam("round!ingHeuristic","Whether to use Rounding heuristic", |
---|
2327 | "off",ROUNDING); |
---|
2328 | parameters[numberParameters-1].append("on"); |
---|
2329 | parameters[numberParameters-1].setLonghelp |
---|
2330 | ( |
---|
2331 | "This switches on a simple (but effective) rounding heuristic at each node of tree." |
---|
2332 | ); |
---|
2333 | #endif |
---|
2334 | parameters[numberParameters++]= |
---|
2335 | CbcOrClpParam("saveM!odel","Save model to binary file", |
---|
2336 | SAVE); |
---|
2337 | parameters[numberParameters-1].setLonghelp |
---|
2338 | ( |
---|
2339 | "This will save the problem to the given file name for future use\ |
---|
2340 | by restoreModel. It will use the default\ |
---|
2341 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
2342 | is initialized to 'default.prob'." |
---|
2343 | ); |
---|
2344 | parameters[numberParameters++]= |
---|
2345 | CbcOrClpParam("saveS!olution","saves solution to file", |
---|
2346 | SAVESOL); |
---|
2347 | parameters[numberParameters-1].setLonghelp |
---|
2348 | ( |
---|
2349 | "This will write a binary solution file to the given file name. It will use the default\ |
---|
2350 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
2351 | is initialized to 'solution.file'. To read the file use fread(int) twice to pick up number of rows \ |
---|
2352 | and columns, then fread(double) to pick up objective value, then pick up row activities, row duals, column \ |
---|
2353 | activities and reduced costs - see bottom of CbcOrClpParam.cpp for code that reads or writes file." |
---|
2354 | ); |
---|
2355 | parameters[numberParameters++]= |
---|
2356 | CbcOrClpParam("scal!ing","Whether to scale problem", |
---|
2357 | "off",SCALING); |
---|
2358 | parameters[numberParameters-1].append("equi!librium"); |
---|
2359 | parameters[numberParameters-1].append("geo!metric"); |
---|
2360 | parameters[numberParameters-1].append("auto!matic"); |
---|
2361 | parameters[numberParameters-1].setLonghelp |
---|
2362 | ( |
---|
2363 | "Scaling can help in solving problems which might otherwise fail because of lack of\ |
---|
2364 | accuracy. It can also reduce the number of iterations. It is not applied if the range\ |
---|
2365 | of elements is small. When unscaled it is possible that there may be small primal and/or\ |
---|
2366 | infeasibilities." |
---|
2367 | ); |
---|
2368 | parameters[numberParameters-1].setCurrentOption(3); // say auto |
---|
2369 | #ifndef COIN_HAS_CBC |
---|
2370 | parameters[numberParameters++]= |
---|
2371 | CbcOrClpParam("sec!onds","Maximum seconds", |
---|
2372 | -1.0,1.0e12,TIMELIMIT); |
---|
2373 | parameters[numberParameters-1].setLonghelp |
---|
2374 | ( |
---|
2375 | "After this many seconds clp will act as if maximum iterations had been reached \ |
---|
2376 | (if value >=0). \ |
---|
2377 | In this program it is really only useful for testing but the library function\n\ |
---|
2378 | \tsetMaximumSeconds(value)\n can be useful." |
---|
2379 | ); |
---|
2380 | #else |
---|
2381 | parameters[numberParameters++]= |
---|
2382 | CbcOrClpParam("sec!onds","maximum seconds", |
---|
2383 | -1.0,1.0e12,TIMELIMIT_BAB); |
---|
2384 | parameters[numberParameters-1].setLonghelp |
---|
2385 | ( |
---|
2386 | "After this many seconds coin solver will act as if maximum nodes had been reached." |
---|
2387 | ); |
---|
2388 | #endif |
---|
2389 | parameters[numberParameters++]= |
---|
2390 | CbcOrClpParam("sleep","for debug", |
---|
2391 | DUMMY,7,false); |
---|
2392 | parameters[numberParameters-1].setLonghelp |
---|
2393 | ( |
---|
2394 | "If passed to solver fom ampl, then ampl will wait so that you can copy .nl file for debug." |
---|
2395 | ); |
---|
2396 | #ifdef COIN_HAS_CLP |
---|
2397 | parameters[numberParameters++]= |
---|
2398 | CbcOrClpParam("slp!Value","Number of slp passes before primal", |
---|
2399 | -1,50000,SLPVALUE,false); |
---|
2400 | parameters[numberParameters-1].setLonghelp |
---|
2401 | ( |
---|
2402 | "If you are solving a quadratic problem using primal then it may be helpful to do some \ |
---|
2403 | sequential Lps to get a good approximate solution." |
---|
2404 | ); |
---|
2405 | #endif |
---|
2406 | parameters[numberParameters++]= |
---|
2407 | CbcOrClpParam("solu!tion","Prints solution to file", |
---|
2408 | SOLUTION); |
---|
2409 | parameters[numberParameters-1].setLonghelp |
---|
2410 | ( |
---|
2411 | "This will write a primitive solution file to the given file name. It will use the default\ |
---|
2412 | directory given by 'directory'. A name of '$' will use the previous value for the name. This\ |
---|
2413 | is initialized to 'stdout'. The amount of output can be varied using printi!ngOptions or printMask." |
---|
2414 | ); |
---|
2415 | #ifdef COIN_HAS_CLP |
---|
2416 | #ifdef COIN_HAS_CBC |
---|
2417 | parameters[numberParameters++]= |
---|
2418 | CbcOrClpParam("solv!e","Solve problem", |
---|
2419 | BAB); |
---|
2420 | parameters[numberParameters-1].setLonghelp |
---|
2421 | ( |
---|
2422 | "If there are no integer variables then this just solves LP. If there are integer variables \ |
---|
2423 | this does branch and cut." |
---|
2424 | ); |
---|
2425 | parameters[numberParameters++]= |
---|
2426 | CbcOrClpParam("sos!Options","Whether to use SOS from AMPL", |
---|
2427 | "off",SOS); |
---|
2428 | parameters[numberParameters-1].append("on"); |
---|
2429 | parameters[numberParameters-1].setCurrentOption("on"); |
---|
2430 | parameters[numberParameters-1].setLonghelp |
---|
2431 | ( |
---|
2432 | "Normally if AMPL says there are SOS variables they should be used, but sometime sthey should\ |
---|
2433 | be turned off - this does so." |
---|
2434 | ); |
---|
2435 | parameters[numberParameters++]= |
---|
2436 | CbcOrClpParam("slog!Level","Level of detail in Solver output", |
---|
2437 | -1,63,SOLVERLOGLEVEL); |
---|
2438 | parameters[numberParameters-1].setLonghelp |
---|
2439 | ( |
---|
2440 | "If 0 then there should be no output in normal circumstances. 1 is probably the best\ |
---|
2441 | value for most uses, while 2 and 3 give more information." |
---|
2442 | ); |
---|
2443 | #else |
---|
2444 | // allow solve as synonym for dual |
---|
2445 | parameters[numberParameters++]= |
---|
2446 | CbcOrClpParam("solv!e","Solve problem using dual simplex", |
---|
2447 | BAB); |
---|
2448 | parameters[numberParameters-1].setLonghelp |
---|
2449 | ( |
---|
2450 | "Just so can use solve for clp as well as in cbc" |
---|
2451 | ); |
---|
2452 | #endif |
---|
2453 | #endif |
---|
2454 | #ifdef COIN_HAS_CLP |
---|
2455 | parameters[numberParameters++]= |
---|
2456 | CbcOrClpParam("spars!eFactor","Whether factorization treated as sparse", |
---|
2457 | "on",SPARSEFACTOR,7,false); |
---|
2458 | parameters[numberParameters-1].append("off"); |
---|
2459 | parameters[numberParameters++]= |
---|
2460 | CbcOrClpParam("special!Options","Dubious options for Simplex - see ClpSimplex.hpp", |
---|
2461 | 0,COIN_INT_MAX,SPECIALOPTIONS,false); |
---|
2462 | parameters[numberParameters++]= |
---|
2463 | CbcOrClpParam("sprint!Crash","Whether to try sprint crash", |
---|
2464 | -1,5000000,SPRINT); |
---|
2465 | parameters[numberParameters-1].setLonghelp |
---|
2466 | ( |
---|
2467 | "For long and thin problems this program may solve a series of small problems\ |
---|
2468 | created by taking a subset of the columns. I introduced the idea as 'Sprint' after\ |
---|
2469 | an LP code of that name of the 60's which tried the same tactic (not totally successfully).\ |
---|
2470 | Cplex calls it 'sifting'. -1 is automatic choice, 0 is off, n is number of passes" |
---|
2471 | ); |
---|
2472 | parameters[numberParameters++]= |
---|
2473 | CbcOrClpParam("stat!istics","Print some statistics", |
---|
2474 | STATISTICS); |
---|
2475 | parameters[numberParameters-1].setLonghelp |
---|
2476 | ( |
---|
2477 | "This command prints some statistics for the current model.\ |
---|
2478 | If log level >1 then more is printed.\ |
---|
2479 | These are for presolved model if presolve on (and unscaled)." |
---|
2480 | ); |
---|
2481 | #endif |
---|
2482 | parameters[numberParameters++]= |
---|
2483 | CbcOrClpParam("stop","Stops clp execution", |
---|
2484 | EXIT); |
---|
2485 | parameters[numberParameters-1].setLonghelp |
---|
2486 | ( |
---|
2487 | "This stops the execution of Clp, end, exit, quit and stop are synonyms" |
---|
2488 | ); |
---|
2489 | #ifdef COIN_HAS_CBC |
---|
2490 | parameters[numberParameters++]= |
---|
2491 | CbcOrClpParam("strengthen","Create strengthened problem", |
---|
2492 | STRENGTHEN,3); |
---|
2493 | parameters[numberParameters-1].setLonghelp |
---|
2494 | ( |
---|
2495 | "This creates a new problem by applying the root node cuts. All tight constraints \ |
---|
2496 | will be in resulting problem" |
---|
2497 | ); |
---|
2498 | parameters[numberParameters++]= |
---|
2499 | CbcOrClpParam("strong!Branching","Number of variables to look at in strong branching", |
---|
2500 | 0,999999,STRONGBRANCHING); |
---|
2501 | parameters[numberParameters-1].setLonghelp |
---|
2502 | ( |
---|
2503 | "In order to decide which variable to branch on, the code will choose up to this number \ |
---|
2504 | of unsatisfied variables to do mini up and down branches on. Then the most effective one is chosen. \ |
---|
2505 | If a variable is branched on many times then the previous average up and down costs may be used - \ |
---|
2506 | see number before trust." |
---|
2507 | ); |
---|
2508 | #endif |
---|
2509 | #ifdef COIN_HAS_CLP |
---|
2510 | parameters[numberParameters++]= |
---|
2511 | CbcOrClpParam("subs!titution","How long a column to substitute for in presolve", |
---|
2512 | 0,10000,SUBSTITUTION,false); |
---|
2513 | parameters[numberParameters-1].setLonghelp |
---|
2514 | ( |
---|
2515 | "Normally Presolve gets rid of 'free' variables when there are no more than 3 \ |
---|
2516 | variables in column. If you increase this the number of rows may decrease but number of \ |
---|
2517 | elements may increase." |
---|
2518 | ); |
---|
2519 | #endif |
---|
2520 | #ifdef COIN_HAS_CBC |
---|
2521 | parameters[numberParameters++]= |
---|
2522 | CbcOrClpParam("testO!si","Test OsiObject stuff", |
---|
2523 | -1,COIN_INT_MAX,TESTOSI,false); |
---|
2524 | #endif |
---|
2525 | #ifdef CBC_THREAD |
---|
2526 | parameters[numberParameters++]= |
---|
2527 | CbcOrClpParam("thread!s","Number of threads to try and use", |
---|
2528 | -100,10000,THREADS,false); |
---|
2529 | parameters[numberParameters-1].setLonghelp |
---|
2530 | ( |
---|
2531 | "To use multiple threads, set threads to number wanted. It may be better \ |
---|
2532 | to use one or two more than number of cpus available. If 100+n then n threads and \ |
---|
2533 | threads used in sub-trees, if 200+n use threads for root cuts, 300+n - both." |
---|
2534 | ); |
---|
2535 | #endif |
---|
2536 | #ifdef COIN_HAS_CBC |
---|
2537 | parameters[numberParameters++]= |
---|
2538 | CbcOrClpParam("tighten!Factor","Tighten bounds using this times largest \ |
---|
2539 | activity at continuous solution", |
---|
2540 | 1.0e-3,1.0e20,TIGHTENFACTOR,false); |
---|
2541 | parameters[numberParameters-1].setLonghelp |
---|
2542 | ( |
---|
2543 | "This sleazy trick can help on some problems." |
---|
2544 | ); |
---|
2545 | #endif |
---|
2546 | #ifdef COIN_HAS_CLP |
---|
2547 | parameters[numberParameters++]= |
---|
2548 | CbcOrClpParam("tightLP","Poor person's preSolve for now", |
---|
2549 | TIGHTEN,7,false); |
---|
2550 | #endif |
---|
2551 | #ifdef COIN_HAS_CBC |
---|
2552 | parameters[numberParameters++]= |
---|
2553 | CbcOrClpParam("trust!PseudoCosts","Number of branches before we trust pseudocosts", |
---|
2554 | -1,2000000,NUMBERBEFORE); |
---|
2555 | parameters[numberParameters-1].setLonghelp |
---|
2556 | ( |
---|
2557 | "Using strong branching computes pseudo-costs. After this many times for a variable we just \ |
---|
2558 | trust the pseudo costs and do not do any more strong branching." |
---|
2559 | ); |
---|
2560 | #endif |
---|
2561 | #ifdef COIN_HAS_CBC |
---|
2562 | parameters[numberParameters++]= |
---|
2563 | CbcOrClpParam("tune!PreProcess","Dubious tuning parameters", |
---|
2564 | 0,20000000,PROCESSTUNE,false); |
---|
2565 | parameters[numberParameters-1].setLonghelp |
---|
2566 | ( |
---|
2567 | "For making equality cliques this is minimumsize. Also for adding \ |
---|
2568 | integer slacks. May be used for more later \ |
---|
2569 | If <1000 that is what it does. If <1000000 - numberPasses is (value/1000)-1 and tune is tune %1000. \ |
---|
2570 | If >= 1000000! - numberPasses is (value/1000000)-1 and tune is tune %1000000. In this case if tune is now still >=10000 \ |
---|
2571 | numberPassesPerInnerLoop is changed from 10 to (tune-10000)-1 and tune becomes tune % 10000!!!!! - happy? - \ |
---|
2572 | so to keep normal limit on cliques of 5, do 3 major passes (include presolves) but only doing one tightening pass per major pass - \ |
---|
2573 | you would use 3010005 (I think)" |
---|
2574 | ); |
---|
2575 | parameters[numberParameters++]= |
---|
2576 | CbcOrClpParam("two!MirCuts","Whether to use Two phase Mixed Integer Rounding cuts", |
---|
2577 | "off",TWOMIRCUTS); |
---|
2578 | parameters[numberParameters-1].append("on"); |
---|
2579 | parameters[numberParameters-1].append("root"); |
---|
2580 | parameters[numberParameters-1].append("ifmove"); |
---|
2581 | parameters[numberParameters-1].append("forceOn"); |
---|
2582 | parameters[numberParameters-1].setLonghelp |
---|
2583 | ( |
---|
2584 | "This switches on two phase mixed integer rounding cuts (either at root or in entire tree) \ |
---|
2585 | See branchAndCut for information on options." |
---|
2586 | ); |
---|
2587 | #endif |
---|
2588 | parameters[numberParameters++]= |
---|
2589 | CbcOrClpParam("unitTest","Do unit test", |
---|
2590 | UNITTEST,3); |
---|
2591 | parameters[numberParameters-1].setLonghelp |
---|
2592 | ( |
---|
2593 | "This exercises the unit test for clp" |
---|
2594 | ); |
---|
2595 | parameters[numberParameters++]= |
---|
2596 | CbcOrClpParam("userClp","Hand coded Clp stuff", |
---|
2597 | USERCLP); |
---|
2598 | parameters[numberParameters-1].setLonghelp |
---|
2599 | ( |
---|
2600 | "There are times e.g. when using AMPL interface when you may wish to do something unusual. \ |
---|
2601 | Look for USERCLP in main driver and modify sample code." |
---|
2602 | ); |
---|
2603 | #ifdef COIN_HAS_CBC |
---|
2604 | parameters[numberParameters++]= |
---|
2605 | CbcOrClpParam("userCbc","Hand coded Cbc stuff", |
---|
2606 | USERCBC); |
---|
2607 | parameters[numberParameters-1].setLonghelp |
---|
2608 | ( |
---|
2609 | "There are times e.g. when using AMPL interface when you may wish to do something unusual. \ |
---|
2610 | Look for USERCBC in main driver and modify sample code." |
---|
2611 | ); |
---|
2612 | #endif |
---|
2613 | parameters[numberParameters++]= |
---|
2614 | CbcOrClpParam("vector","Whether to use vector? Form of matrix in simplex", |
---|
2615 | "off",VECTOR,7,false); |
---|
2616 | parameters[numberParameters-1].append("on"); |
---|
2617 | parameters[numberParameters-1].setLonghelp |
---|
2618 | ( |
---|
2619 | "If this is on and ClpPackedMatrix uses extra column copy in odd format." |
---|
2620 | ); |
---|
2621 | parameters[numberParameters++]= |
---|
2622 | CbcOrClpParam("verbose","Switches on longer help on single ?", |
---|
2623 | 0,15,VERBOSE,false); |
---|
2624 | parameters[numberParameters-1].setLonghelp |
---|
2625 | ( |
---|
2626 | "Set to 1 to get short help with ? list, 2 to get long help, 3 for both. (add 4 to just get ampl ones)." |
---|
2627 | ); |
---|
2628 | parameters[numberParameters-1].setIntValue(0); |
---|
2629 | assert(numberParameters<CBCMAXPARAMETERS); |
---|
2630 | } |
---|
2631 | // Given a parameter type - returns its number in list |
---|
2632 | int whichParam (CbcOrClpParameterType name, |
---|
2633 | int numberParameters, CbcOrClpParam *const parameters) |
---|
2634 | { |
---|
2635 | int i; |
---|
2636 | for (i=0;i<numberParameters;i++) { |
---|
2637 | if (parameters[i].type()==name) |
---|
2638 | break; |
---|
2639 | } |
---|
2640 | assert (i<numberParameters); |
---|
2641 | return i; |
---|
2642 | } |
---|
2643 | #ifdef COIN_HAS_CLP |
---|
2644 | // Dump a solution to file |
---|
2645 | void saveSolution(const ClpSimplex * lpSolver,std::string fileName) |
---|
2646 | { |
---|
2647 | FILE * fp=fopen(fileName.c_str(),"wb"); |
---|
2648 | if (fp) { |
---|
2649 | int numberRows=lpSolver->numberRows(); |
---|
2650 | int numberColumns=lpSolver->numberColumns(); |
---|
2651 | double objectiveValue = lpSolver->objectiveValue(); |
---|
2652 | fwrite(&numberRows,sizeof(int),1,fp); |
---|
2653 | fwrite(&numberColumns,sizeof(int),1,fp); |
---|
2654 | fwrite(&objectiveValue,sizeof(double),1,fp); |
---|
2655 | double * dualRowSolution = lpSolver->dualRowSolution(); |
---|
2656 | double * primalRowSolution = lpSolver->primalRowSolution(); |
---|
2657 | fwrite(primalRowSolution,sizeof(double),numberRows,fp); |
---|
2658 | fwrite(dualRowSolution,sizeof(double),numberRows,fp); |
---|
2659 | double * dualColumnSolution = lpSolver->dualColumnSolution(); |
---|
2660 | double * primalColumnSolution = lpSolver->primalColumnSolution(); |
---|
2661 | fwrite(primalColumnSolution,sizeof(double),numberColumns,fp); |
---|
2662 | fwrite(dualColumnSolution,sizeof(double),numberColumns,fp); |
---|
2663 | fclose(fp); |
---|
2664 | } else { |
---|
2665 | std::cout<<"Unable to open file "<<fileName<<std::endl; |
---|
2666 | } |
---|
2667 | } |
---|
2668 | /* Restore a solution from file. |
---|
2669 | mode 0 normal, 1 swap rows and columns and primal and dual |
---|
2670 | if 2 set then also change signs |
---|
2671 | */ |
---|
2672 | void restoreSolution(ClpSimplex * lpSolver,std::string fileName,int mode) |
---|
2673 | { |
---|
2674 | FILE * fp=fopen(fileName.c_str(),"rb"); |
---|
2675 | if (fp) { |
---|
2676 | int numberRows=lpSolver->numberRows(); |
---|
2677 | int numberColumns=lpSolver->numberColumns(); |
---|
2678 | int numberRowsFile; |
---|
2679 | int numberColumnsFile; |
---|
2680 | double objectiveValue; |
---|
2681 | fread(&numberRowsFile,sizeof(int),1,fp); |
---|
2682 | fread(&numberColumnsFile,sizeof(int),1,fp); |
---|
2683 | fread(&objectiveValue,sizeof(double),1,fp); |
---|
2684 | double * dualRowSolution = lpSolver->dualRowSolution(); |
---|
2685 | double * primalRowSolution = lpSolver->primalRowSolution(); |
---|
2686 | double * dualColumnSolution = lpSolver->dualColumnSolution(); |
---|
2687 | double * primalColumnSolution = lpSolver->primalColumnSolution(); |
---|
2688 | if (mode) { |
---|
2689 | // swap |
---|
2690 | int k=numberRows; |
---|
2691 | numberRows=numberColumns; |
---|
2692 | numberColumns=k; |
---|
2693 | double * temp; |
---|
2694 | temp = dualRowSolution; |
---|
2695 | dualRowSolution = primalColumnSolution; |
---|
2696 | primalColumnSolution=temp; |
---|
2697 | temp = dualColumnSolution; |
---|
2698 | dualColumnSolution = primalRowSolution; |
---|
2699 | primalRowSolution=temp; |
---|
2700 | } |
---|
2701 | if (numberRows!=numberRowsFile||numberColumns!=numberColumnsFile) { |
---|
2702 | std::cout<<"Mismatch on rows and/or columns"<<std::endl; |
---|
2703 | } else { |
---|
2704 | lpSolver->setObjectiveValue(objectiveValue); |
---|
2705 | fread(primalRowSolution,sizeof(double),numberRows,fp); |
---|
2706 | fread(dualRowSolution,sizeof(double),numberRows,fp); |
---|
2707 | fread(primalColumnSolution,sizeof(double),numberColumns,fp); |
---|
2708 | fread(dualColumnSolution,sizeof(double),numberColumns,fp); |
---|
2709 | if (mode==3) { |
---|
2710 | int i; |
---|
2711 | for (i=0;i<numberRows;i++) { |
---|
2712 | primalRowSolution[i] = -primalRowSolution[i]; |
---|
2713 | dualRowSolution[i] = -dualRowSolution[i]; |
---|
2714 | } |
---|
2715 | for (i=0;i<numberColumns;i++) { |
---|
2716 | primalColumnSolution[i] = -primalColumnSolution[i]; |
---|
2717 | dualColumnSolution[i] = -dualColumnSolution[i]; |
---|
2718 | } |
---|
2719 | } |
---|
2720 | } |
---|
2721 | fclose(fp); |
---|
2722 | } else { |
---|
2723 | std::cout<<"Unable to open file "<<fileName<<std::endl; |
---|
2724 | } |
---|
2725 | } |
---|
2726 | #endif |
---|