source: branches/BSP/trunk/Clp/src/CbcOrClpParam.cpp @ 1086

Last change on this file since 1086 was 1086, checked in by andreasw, 12 years ago

unded [1085]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 96.5 KB
Line 
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
31static char coin_prompt[]="Coin:";
32#else
33static char coin_prompt[]="Clp:";
34#endif
35static bool doPrinting=true;
36std::string afterEquals="";
37void setCbcOrClpPrinting(bool yesNo)
38{
39  doPrinting=yesNo;
40}
41//#############################################################################
42// Constructors / Destructor / Assignment
43//#############################################################################
44
45//-------------------------------------------------------------------
46// Default Constructor
47//-------------------------------------------------------------------
48CbcOrClpParam::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
70CbcOrClpParam::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}
92CbcOrClpParam::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
115CbcOrClpParam::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
140CbcOrClpParam::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//-------------------------------------------------------------------
166CbcOrClpParam::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//-------------------------------------------------------------------
191CbcOrClpParam::~CbcOrClpParam ()
192{
193}
194
195//----------------------------------------------------------------
196// Assignment operator
197//-------------------------------------------------------------------
198CbcOrClpParam &
199CbcOrClpParam::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}
223void 
224CbcOrClpParam::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)
238void 
239CbcOrClpParam::append(std::string keyWord)
240{
241  definedKeyWords_.push_back(keyWord);
242}
243
244int 
245CbcOrClpParam::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
267std::string
268CbcOrClpParam::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)
277int 
278CbcOrClpParam::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
320void 
321CbcOrClpParam::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&&currentKeyWord_<(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
346void 
347CbcOrClpParam::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}
357void 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
382void 
383CbcOrClpParam::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
399int
400CbcOrClpParam::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
430int
431CbcOrClpParam::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}
479double 
480CbcOrClpParam::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}
515int 
516CbcOrClpParam::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}
559int 
560CbcOrClpParam::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
593int
594CbcOrClpParam::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
606double 
607CbcOrClpParam::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}
623int 
624CbcOrClpParam::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}
647int 
648CbcOrClpParam::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}
661int
662CbcOrClpParam::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}
714double 
715CbcOrClpParam::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}
746int 
747CbcOrClpParam::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}
815int 
816CbcOrClpParam::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
864void 
865CbcOrClpParam::setCurrentOption ( const std::string value )
866{
867  int action = parameterOption(value);
868  if (action>=0)
869    currentKeyWord_=action;
870}
871// Sets current parameter option
872void 
873CbcOrClpParam::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}
882void 
883CbcOrClpParam::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}
893void 
894CbcOrClpParam::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}
904void 
905CbcOrClpParam::setStringValue ( std::string value )
906{ 
907  stringValue_=value;
908}
909static char line[1000];
910static char * where=NULL;
911extern int CbcOrClpRead_mode;
912extern FILE * CbcOrClpReadCommand;
913// Simple read stuff
914std::string
915CoinReadNextField()
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
977std::string
978CoinReadGetCommand(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}
1026std::string
1027CoinReadGetString(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
1052int
1053CoinReadGetIntField(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}
1080double
1081CoinReadGetDoubleField(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*/
1112void 
1113establishParams (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 \
1126best 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 \
1132then 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 \
1142basis 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 \
1160corrector algorithm.  You will probably want to link in and choose a better \
1161ordering and factorization than the default ones provided.  It will also solve models \
1162with 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.  \
1199First just try with default settings and look carefully at the log file.  Did cuts help?  Did they take too long?  \
1200Look at output to see which cuts were effective and then do some tuning.  You will see that the \
1201options for cuts are off, on, root and ifmove, forceon.  Off is \
1202obvious, 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 \
1204look as if they are doing some good and moving the objective value.  Forceon is same as on but forces code to use \
1205cut generator at every node.  For probing forceonbut just does fixing probing in tree - not strengthening etc.  \
1206If pre-processing reduced the size of the \
1207problem or strengthened many coefficients then it is probably wise to leave it on.  Switch off heuristics \
1208which did not provide solutions.  The other major area to look at is the search.  Hopefully good solutions \
1209were obtained fairly early in the search so the important point is to select the best variable to branch on.  \
1210See whether strong branching did a good job - or did it just take a lot of iterations.  Adjust the strongBranching \
1211and 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.  \
1246You will need to link in one from another source.  See Makefile.locations for some \
1247possibilities."
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) \
1261See 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 \
1270using variables which have appeared in one or more solutions. \
1271It 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 \
1284first.  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 \
1294you to generate user_driver.cpp which approximates the code.  \
12950 gives simplest driver, 1 generates saves and restores, 2 \
1296generates saves and restores even for variables at default value. \
12974 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'. \
1313I 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 \
1323the feasibility criterion is a bit suspect (JJF)).  This option will crossover \
1324to a basic solution suitable for ranging or branch and cut.  With the current state \
1325of quadratic it may be a good idea to switch off crossover for quadratic (and maybe \
1326presolve 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 \
1336and on.  If they are done every node then that is that, but it may be worth doing them \
1337every so often.  The original method was every so many nodes but it is more logical \
1338to do it whenever depth in tree is a multiple of K.  This option does that and defaults \
1339to -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).  \
1349This is also set by code whenever it obtains a solution and is set to value of \
1350objective 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 \
1362individual ones off or on \
1363See 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\
1373If set to create it will create a file called debug.file  after search; if set \
1374to createAfterPre it will create one suitable for use after preprocessing.\n\n\
1375The idea is that if you suspect a bad cut generator and you did not use preprocessing \
1376you can do a good run with debug set to 'create' and then switch on the cuts you suspect and \
1377re-run with debug set to 'debug.file'  Similarly if you do use preprocessing but use \
1378createAfterPre.  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\
1407You 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  It is initialized to './'"
1416     ); 
1417  parameters[numberParameters++]=
1418    CbcOrClpParam("dirSample","Set directory where the COIN-OR sample problems are.",
1419                  DIRSAMPLE);
1420  parameters[numberParameters-1].setLonghelp
1421    (
1422     "This sets the directory where the COIN-OR sample problems reside. It is\
1423 used only when -unitTest is passed to clp. clp will pick up the test problems\
1424 from this directory.\
1425 It is initialized to '../../Data/Sample'"
1426     ); 
1427  parameters[numberParameters++]=
1428    CbcOrClpParam("dirNetlib","Set directory where the netlib problems are.",
1429                  DIRNETLIB);
1430  parameters[numberParameters-1].setLonghelp
1431    (
1432     "This sets the directory where the netlib problems reside. One can get\
1433 the netlib problems from COIN-OR or from the main netlib site. This\
1434 parameter is used only when -netlib is passed to clp. clp will pick up the\
1435 netlib problems from this directory. If clp is built without zlib support\
1436 then the problems must be uncompressed.\
1437 It is initialized to '../../Data/Netlib'"
1438     ); 
1439  parameters[numberParameters++]=
1440    CbcOrClpParam("dirMiplib","Set directory where the miplib 2003 problems are.",
1441                  DIRMIPLIB);
1442  parameters[numberParameters-1].setLonghelp
1443    (
1444     "This sets the directory where the miplib 2003 problems reside. One can\
1445 get the miplib problems from COIN-OR or from the main miplib site. This\
1446 parameter is used only when -miplib is passed to cbc. cbc will pick up the\
1447 miplib problems from this directory. If cbc is built without zlib support\
1448 then the problems must be uncompressed.\
1449 It is initialized to '../../Data/miplib3'"
1450     ); 
1451#ifdef COIN_HAS_CLP
1452  parameters[numberParameters++]=
1453    CbcOrClpParam("dualB!ound","Initially algorithm acts as if no \
1454gap between bounds exceeds this value",
1455                  1.0e-20,1.0e12,DUALBOUND);
1456  parameters[numberParameters-1].setLonghelp
1457    (
1458     "The dual algorithm in Clp is a single phase algorithm as opposed to a two phase\
1459 algorithm where you first get feasible then optimal.  If a problem has both upper and\
1460 lower bounds then it is trivial to get dual feasible by setting non basic variables\
1461 to correct bound.  If the gap between the upper and lower bounds of a variable is more\
1462 than the value of dualBound Clp introduces fake bounds so that it can make the problem\
1463 dual feasible.  This has the same effect as a composite objective function in the\
1464 primal algorithm.  Too high a value may mean more iterations, while too low a bound means\
1465 the code may go all the way and then have to increase the bounds.  OSL had a heuristic to\
1466 adjust bounds, maybe we need that here."
1467     );
1468  parameters[numberParameters++]=
1469    CbcOrClpParam("dualize","Solves dual reformulation",
1470                  0,2,DUALIZE,false);
1471  parameters[numberParameters-1].setLonghelp
1472    (
1473     "Don't even think about it."
1474     ); 
1475  parameters[numberParameters++]=
1476    CbcOrClpParam("dualP!ivot","Dual pivot choice algorithm",
1477                  "auto!matic",DUALPIVOT);
1478  parameters[numberParameters-1].append("dant!zig");
1479  parameters[numberParameters-1].append("partial");
1480  parameters[numberParameters-1].append("steep!est");
1481  parameters[numberParameters-1].setLonghelp
1482    (
1483     "Clp can use any pivot selection algorithm which the user codes as long as it\
1484 implements the features in the abstract pivot base class.  The Dantzig method is implemented\
1485 to show a simple method but its use is deprecated.  Steepest is the method of choice and there\
1486 are two variants which keep all weights updated but only scan a subset each iteration.\
1487 Partial switches this on while automatic decides at each iteration based on information\
1488 about the factorization."
1489     ); 
1490  parameters[numberParameters++]=
1491    CbcOrClpParam("dualS!implex","Do dual simplex algorithm",
1492                  DUALSIMPLEX);
1493  parameters[numberParameters-1].setLonghelp
1494    (
1495     "This command solves the current model using the dual steepest edge algorithm.\
1496The time and iterations may be affected by settings such as presolve, scaling, crash\
1497 and also by dual pivot method, fake bound on variables and dual and primal tolerances."
1498     );
1499#endif
1500  parameters[numberParameters++]=
1501    CbcOrClpParam("dualT!olerance","For an optimal solution \
1502no dual infeasibility may exceed this value",
1503                  1.0e-20,1.0e12,DUALTOLERANCE);
1504  parameters[numberParameters-1].setLonghelp
1505    (
1506     "Normally the default tolerance is fine, but you may want to increase it a\
1507 bit if a dual run seems to be having a hard time.  One method which can be faster is \
1508to use a large tolerance e.g. 1.0e-4 and dual and then clean up problem using primal and the \
1509correct tolerance (remembering to switch off presolve for this final short clean up phase)."
1510     ); 
1511#ifdef COIN_HAS_CLP
1512  parameters[numberParameters++]=
1513    CbcOrClpParam("either!Simplex","Do dual or primal simplex algorithm",
1514                  EITHERSIMPLEX);
1515  parameters[numberParameters-1].setLonghelp
1516    (
1517     "This command solves the current model using the dual or primal algorithm,\
1518 based on a dubious analysis of model."
1519     );
1520#endif
1521  parameters[numberParameters++]=
1522    CbcOrClpParam("end","Stops clp execution",
1523                  EXIT);
1524  parameters[numberParameters-1].setLonghelp
1525    (
1526     "This stops execution ; end, exit, quit and stop are synonyms"
1527     ); 
1528  parameters[numberParameters++]=
1529    CbcOrClpParam("error!sAllowed","Whether to allow import errors",
1530                  "off",ERRORSALLOWED,3);
1531  parameters[numberParameters-1].append("on");
1532  parameters[numberParameters-1].setLonghelp
1533    (
1534     "The default is not to use any model which had errors when reading the mps file.\
1535  Setting this to 'on' will allow all errors from which the code can recover\
1536 simply by ignoring the error.  There are some errors from which the code can not recover \
1537e.g. no ENDATA.  This has to be set before import i.e. -errorsAllowed on -import xxxxxx.mps."
1538     );
1539  parameters[numberParameters++]=
1540    CbcOrClpParam("exit","Stops clp execution",
1541                  EXIT);
1542  parameters[numberParameters-1].setLonghelp
1543    (
1544     "This stops the execution of Clp, end, exit, quit and stop are synonyms"
1545     ); 
1546  parameters[numberParameters++]=
1547    CbcOrClpParam("export","Export model as mps file",
1548                  EXPORT);
1549  parameters[numberParameters-1].setLonghelp
1550    (
1551     "This will write an MPS format file to the given file name.  It will use the default\
1552 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1553 is initialized to 'default.mps'."
1554     ); 
1555#ifdef COIN_HAS_CBC
1556  parameters[numberParameters++]=
1557    CbcOrClpParam("extra1","Extra integer parameter 1",
1558                  -1,COIN_INT_MAX,EXTRA1,false);
1559  parameters[numberParameters-1].setIntValue(-1);
1560  parameters[numberParameters++]=
1561    CbcOrClpParam("extra2","Extra integer parameter 2",
1562                  -1,COIN_INT_MAX,EXTRA2,false);
1563  parameters[numberParameters-1].setIntValue(-1);
1564  parameters[numberParameters++]=
1565    CbcOrClpParam("extra3","Extra integer parameter 3",
1566                  -1,COIN_INT_MAX,EXTRA3,false);
1567  parameters[numberParameters-1].setIntValue(-1);
1568  parameters[numberParameters++]=
1569    CbcOrClpParam("extra4","Extra integer parameter 4",
1570                  -1,COIN_INT_MAX,EXTRA4,false);
1571  parameters[numberParameters-1].setIntValue(-1);
1572#endif
1573#ifdef COIN_HAS_CLP
1574  parameters[numberParameters++]=
1575    CbcOrClpParam("fakeB!ound","All bounds <= this value - DEBUG",
1576                  1.0,1.0e15,FAKEBOUND,false);
1577#ifdef COIN_HAS_CBC
1578    parameters[numberParameters++]=
1579      CbcOrClpParam("feas!ibilityPump","Whether to try Feasibility Pump",
1580                    "off",FPUMP);
1581    parameters[numberParameters-1].append("on");
1582  parameters[numberParameters-1].setLonghelp
1583    (
1584     "This switches on feasibility pump heuristic at root. This is due to Fischetti and Lodi \
1585and uses a sequence of Lps to try and get an integer feasible solution. \
1586Some fine tuning is available by passFeasibilityPump."
1587     ); 
1588  parameters[numberParameters++]=
1589    CbcOrClpParam("fix!OnDj","Try heuristic based on fixing variables with \
1590reduced costs greater than this",
1591                  -1.0e20,1.0e20,DJFIX,false);
1592  parameters[numberParameters-1].setLonghelp
1593    (
1594     "If this is set integer variables with reduced costs greater than this will be fixed \
1595before branch and bound - use with extreme caution!" 
1596     ); 
1597    parameters[numberParameters++]=
1598      CbcOrClpParam("flow!CoverCuts","Whether to use Flow Cover cuts",
1599                    "off",FLOWCUTS);
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     "This switches on flow cover cuts (either at root or in entire tree) \
1607See branchAndCut for information on options."
1608     ); 
1609    parameters[numberParameters++]=
1610      CbcOrClpParam("force!Solution","Whether to use given solution as crash for BAB",
1611                    "off",USESOLUTION);
1612    parameters[numberParameters-1].append("on");
1613  parameters[numberParameters-1].setLonghelp
1614    (
1615     "If on then tries to branch to solution given by AMPL or priorities file."
1616     ); 
1617#endif
1618  parameters[numberParameters++]=
1619    CbcOrClpParam("gamma!(Delta)","Whether to regularize barrier",
1620                  "off",GAMMA,7,false);
1621  parameters[numberParameters-1].append("on");
1622  parameters[numberParameters-1].append("gamma");
1623  parameters[numberParameters-1].append("delta");
1624  parameters[numberParameters-1].append("onstrong");
1625  parameters[numberParameters-1].append("gammastrong");
1626  parameters[numberParameters-1].append("deltastrong");
1627#endif
1628#ifdef COIN_HAS_CBC
1629  parameters[numberParameters++]=
1630    CbcOrClpParam("gomory!Cuts","Whether to use Gomory cuts",
1631                  "off",GOMORYCUTS);
1632  parameters[numberParameters-1].append("on");
1633  parameters[numberParameters-1].append("root");
1634  parameters[numberParameters-1].append("ifmove");
1635  parameters[numberParameters-1].append("forceOn");
1636  parameters[numberParameters-1].setLonghelp
1637    (
1638     "The original cuts - beware of imitations!  Having gone out of favor, they are now more \
1639fashionable as LP solvers are more robust and they interact well with other cuts.  They will almost always \
1640give cuts (although in this executable they are limited as to number of variables in cut).  \
1641However the cuts may be dense so it is worth experimenting. \
1642See branchAndCut for information on options."
1643     ); 
1644  parameters[numberParameters++]=
1645    CbcOrClpParam("greedy!Heuristic","Whether to use a greedy heuristic",
1646                  "off",GREEDY);
1647  parameters[numberParameters-1].append("on");
1648  parameters[numberParameters-1].append("root");
1649  parameters[numberParameters-1].setLonghelp
1650    (
1651     "Switches on a greedy heuristic which will try and obtain a solution.  It may just fix a \
1652percentage of variables and then try a small branch and cut run."
1653     ); 
1654  parameters[numberParameters++]=
1655    CbcOrClpParam("heur!isticsOnOff","Switches most heuristics on or off",
1656                  "off",HEURISTICSTRATEGY);
1657  parameters[numberParameters-1].append("on");
1658  parameters[numberParameters-1].setLonghelp
1659    (
1660     "This can be used to switch on or off all heuristics.  Then you can do \
1661individual ones off or on.  CbcTreeLocal is not included as it dramatically \
1662alters search."
1663     ); 
1664#endif
1665  parameters[numberParameters++]=
1666    CbcOrClpParam("help","Print out version, non-standard options and some help",
1667                  HELP,3);
1668  parameters[numberParameters-1].setLonghelp
1669    (
1670     "This prints out some help to get user started.  If you have printed this then \
1671you should be past that stage:-)"
1672     ); 
1673#ifdef COIN_HAS_CBC
1674  parameters[numberParameters++]=
1675    CbcOrClpParam("hot!StartMaxIts","Maximum iterations on hot start",
1676                  0,COIN_INT_MAX,MAXHOTITS,false);
1677#endif
1678#ifdef COIN_HAS_CLP
1679  parameters[numberParameters++]=
1680    CbcOrClpParam("idiot!Crash","Whether to try idiot crash",
1681                  -1,999999,IDIOT);
1682  parameters[numberParameters-1].setLonghelp
1683    (
1684     "This is a type of 'crash' which works well on some homogeneous problems.\
1685 It works best on problems with unit elements and rhs but will do something to any model.  It should only be\
1686 used before primal.  It can be set to -1 when the code decides for itself whether to use it,\
1687 0 to switch off or n > 0 to do n passes."
1688     ); 
1689#endif
1690  parameters[numberParameters++]=
1691    CbcOrClpParam("import","Import model from mps file",
1692                  IMPORT,3);
1693  parameters[numberParameters-1].setLonghelp
1694    (
1695     "This will read an MPS format file from the given file name.  It will use the default\
1696 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1697 is initialized to '', i.e. it must be set.  If you have libgz then it can read compressed\
1698 files 'xxxxxxxx.gz'.."
1699     );
1700#ifdef COIN_HAS_CBC
1701  parameters[numberParameters++]=
1702    CbcOrClpParam("inc!rement","A valid solution must be at least this \
1703much better than last integer solution",
1704                  -1.0e20,1.0e20,INCREMENT);
1705  parameters[numberParameters-1].setLonghelp
1706    (
1707     "Whenever a solution is found the bound on solutions is set to solution (in a minimization\
1708sense) plus this.  If it is not set then the code will try and work one out e.g. if \
1709all objective coefficients are multiples of 0.01 and only integer variables have entries in \
1710objective then this can be set to 0.01.  Be careful if you set this negative!"
1711     ); 
1712  parameters[numberParameters++]=
1713    CbcOrClpParam("inf!easibilityWeight","Each integer infeasibility is expected \
1714to cost this much",
1715                  0.0,1.0e20,INFEASIBILITYWEIGHT);
1716  parameters[numberParameters-1].setLonghelp
1717    (
1718     "A primitive way of deciding which node to explore next.  Satisfying each integer infeasibility is \
1719expected to cost this much."
1720     ); 
1721  parameters[numberParameters++]=
1722    CbcOrClpParam("initialS!olve","Solve to continuous",
1723                  SOLVECONTINUOUS);
1724  parameters[numberParameters-1].setLonghelp
1725    (
1726     "This just solves the problem to continuous - without adding any cuts"
1727     ); 
1728  parameters[numberParameters++]=
1729    CbcOrClpParam("integerT!olerance","For an optimal solution \
1730no integer variable may be this away from an integer value",
1731              1.0e-20,0.5,INTEGERTOLERANCE);
1732  parameters[numberParameters-1].setLonghelp
1733    (
1734     "Beware of setting this smaller than the primal tolerance."
1735     ); 
1736#endif
1737#ifdef COIN_HAS_CLP
1738  parameters[numberParameters++]=
1739    CbcOrClpParam("keepN!ames","Whether to keep names from import",
1740                  "on",KEEPNAMES);
1741  parameters[numberParameters-1].append("off");
1742  parameters[numberParameters-1].setLonghelp
1743    (
1744     "It saves space to get rid of names so if you need to you can set this to off.  \
1745This needs to be set before the import of model - so -keepnames off -import xxxxx.mps."
1746     ); 
1747  parameters[numberParameters++]=
1748    CbcOrClpParam("KKT","Whether to use KKT factorization",
1749                  "off",KKT,7,false);
1750  parameters[numberParameters-1].append("on");
1751#endif
1752#ifdef COIN_HAS_CBC
1753  parameters[numberParameters++]=
1754    CbcOrClpParam("knapsack!Cuts","Whether to use Knapsack cuts",
1755                  "off",KNAPSACKCUTS);
1756  parameters[numberParameters-1].append("on");
1757  parameters[numberParameters-1].append("root");
1758  parameters[numberParameters-1].append("ifmove");
1759  parameters[numberParameters-1].append("forceOn");
1760  parameters[numberParameters-1].setLonghelp
1761    (
1762     "This switches on knapsack cuts (either at root or in entire tree) \
1763See branchAndCut for information on options."
1764     ); 
1765  parameters[numberParameters++]=
1766    CbcOrClpParam("lift!AndProjectCuts","Whether to use Lift and Project cuts",
1767                  "off",LANDPCUTS);
1768  parameters[numberParameters-1].append("on");
1769  parameters[numberParameters-1].append("root");
1770  parameters[numberParameters-1].append("ifmove");
1771  parameters[numberParameters-1].append("forceOn");
1772  parameters[numberParameters-1].setLonghelp
1773    (
1774     "Lift and project cuts - may be expensive to compute. \
1775See branchAndCut for information on options."
1776     ); 
1777  parameters[numberParameters++]=
1778    CbcOrClpParam("local!TreeSearch","Whether to use local treesearch",
1779                  "off",LOCALTREE);
1780  parameters[numberParameters-1].append("on");
1781  parameters[numberParameters-1].setLonghelp
1782    (
1783     "This switches on a local search algorithm when a solution is found.  This is from \
1784Fischetti and Lodi and is not really a heuristic although it can be used as one. \
1785When used from Coin solve it has limited functionality.  It is not switched on when \
1786heuristics are switched on."
1787     ); 
1788#endif
1789#ifndef COIN_HAS_CBC
1790  parameters[numberParameters++]=
1791    CbcOrClpParam("log!Level","Level of detail in Solver output",
1792                  -1,63,SOLVERLOGLEVEL);
1793#else
1794  parameters[numberParameters++]=
1795    CbcOrClpParam("log!Level","Level of detail in Coin branch and Cut output",
1796                  -63,63,LOGLEVEL);
1797  parameters[numberParameters-1].setIntValue(1);
1798#endif
1799  parameters[numberParameters-1].setLonghelp
1800    (
1801     "If 0 then there should be no output in normal circumstances.  1 is probably the best\
1802 value for most uses, while 2 and 3 give more information."
1803     ); 
1804  parameters[numberParameters++]=
1805    CbcOrClpParam("max!imize","Set optimization direction to maximize",
1806                  MAXIMIZE,7);
1807  parameters[numberParameters-1].setLonghelp
1808    (
1809     "The default is minimize - use 'maximize' for maximization.\n\
1810You can also use the parameters 'direction maximize'."
1811     ); 
1812#ifdef COIN_HAS_CLP
1813  parameters[numberParameters++]=
1814    CbcOrClpParam("maxF!actor","Maximum number of iterations between \
1815refactorizations",
1816                  1,999999,MAXFACTOR);
1817  parameters[numberParameters-1].setLonghelp
1818    (
1819     "If this is at its initial value of 200 then in this executable clp will guess at a\
1820 value to use.  Otherwise the user can set a value.  The code may decide to re-factorize\
1821 earlier for accuracy."
1822     ); 
1823  parameters[numberParameters++]=
1824    CbcOrClpParam("maxIt!erations","Maximum number of iterations before \
1825stopping",
1826                  0,2147483647,MAXITERATION);
1827  parameters[numberParameters-1].setLonghelp
1828    (
1829     "This can be used for testing purposes.  The corresponding library call\n\
1830      \tsetMaximumIterations(value)\n can be useful.  If the code stops on\
1831 seconds or by an interrupt this will be treated as stopping on maximum iterations"
1832     ); 
1833#endif
1834#ifdef COIN_HAS_CBC
1835  parameters[numberParameters++]=
1836    CbcOrClpParam("maxN!odes","Maximum number of nodes to do",
1837                  0,2147483647,MAXNODES);
1838  parameters[numberParameters-1].setLonghelp
1839    (
1840     "This is a repeatable way to limit search.  Normally using time is easier \
1841but then the results may not be repeatable."
1842     ); 
1843  parameters[numberParameters++]=
1844    CbcOrClpParam("maxS!olutions","Maximum number of solutions to get",
1845                  1,2147483647,MAXSOLS);
1846  parameters[numberParameters-1].setLonghelp
1847    (
1848     "You may want to stop after (say) two solutions or an hour."
1849     ); 
1850#endif
1851  parameters[numberParameters++]=
1852    CbcOrClpParam("min!imize","Set optimization direction to minimize",
1853                  MINIMIZE,7);
1854  parameters[numberParameters-1].setLonghelp
1855    (
1856     "The default is minimize - use 'maximize' for maximization.\n\
1857This should only be necessary if you have previously set maximization \
1858You can also use the parameters 'direction minimize'."
1859     );
1860#ifdef COIN_HAS_CBC
1861  parameters[numberParameters++]=
1862    CbcOrClpParam("mipO!ptions","Dubious options for mip",
1863                  0,COIN_INT_MAX,MIPOPTIONS,false);
1864  parameters[numberParameters++]=
1865    CbcOrClpParam("more!MipOptions","More dubious options for mip",
1866                  -1,COIN_INT_MAX,MOREMIPOPTIONS,false);
1867  parameters[numberParameters++]=
1868    CbcOrClpParam("mixed!IntegerRoundingCuts","Whether to use Mixed Integer Rounding cuts",
1869                  "off",MIXEDCUTS);
1870  parameters[numberParameters-1].append("on");
1871  parameters[numberParameters-1].append("root");
1872  parameters[numberParameters-1].append("ifmove");
1873  parameters[numberParameters-1].append("forceOn");
1874  parameters[numberParameters-1].setLonghelp
1875    (
1876     "This switches on mixed integer rounding cuts (either at root or in entire tree) \
1877See branchAndCut for information on options."
1878     ); 
1879#endif
1880  parameters[numberParameters++]=
1881    CbcOrClpParam("mess!ages","Controls if Clpnnnn is printed",
1882                  "off",MESSAGES);
1883  parameters[numberParameters-1].append("on");
1884  parameters[numberParameters-1].setLonghelp
1885    ("The default behavior is to put out messages such as:\n\
1886   Clp0005 2261  Objective 109.024 Primal infeas 944413 (758)\n\
1887but this program turns this off to make it look more friendly.  It can be useful\
1888 to turn them back on if you want to be able to 'grep' for particular messages or if\
1889 you intend to override the behavior of a particular message."
1890     );
1891#ifdef COIN_HAS_CBC
1892  parameters[numberParameters++]=
1893    CbcOrClpParam("miniT!ree","Size of fast mini tree",
1894                  0,COIN_INT_MAX,NUMBERMINI,false);
1895  parameters[numberParameters-1].setLonghelp
1896    (
1897     "The idea is that I can do a small tree fast. \
1898This is a first try and will hopefully become more sophisticated."
1899     ); 
1900  parameters[numberParameters++]=
1901    CbcOrClpParam("miplib","Do some of miplib test set",
1902                  MIPLIB,3);
1903#endif
1904#ifdef COIN_HAS_CLP
1905  parameters[numberParameters++]=
1906    CbcOrClpParam("netlib","Solve entire netlib test set",
1907                  NETLIB_EITHER,3);
1908  parameters[numberParameters-1].setLonghelp
1909    (
1910     "This exercises the unit test for clp and then solves the netlib test set using dual or primal.\
1911The user can set options before e.g. clp -presolve off -netlib"
1912     ); 
1913#ifdef REAL_BARRIER
1914  parameters[numberParameters++]=
1915    CbcOrClpParam("netlibB!arrier","Solve entire netlib test set with barrier",
1916                  NETLIB_BARRIER,3);
1917  parameters[numberParameters-1].setLonghelp
1918    (
1919     "This exercises the unit test for clp and then solves the netlib test set using barrier.\
1920The user can set options before e.g. clp -kkt on -netlib"
1921     ); 
1922#endif
1923  parameters[numberParameters++]=
1924    CbcOrClpParam("netlibD!ual","Solve entire netlib test set (dual)",
1925                  NETLIB_DUAL,3);
1926  parameters[numberParameters-1].setLonghelp
1927    (
1928     "This exercises the unit test for clp and then solves the netlib test set using dual.\
1929The user can set options before e.g. clp -presolve off -netlib"
1930     ); 
1931  parameters[numberParameters++]=
1932    CbcOrClpParam("netlibP!rimal","Solve entire netlib test set (primal)",
1933                  NETLIB_PRIMAL,3);
1934  parameters[numberParameters-1].setLonghelp
1935    (
1936     "This exercises the unit test for clp and then solves the netlib test set using primal.\
1937The user can set options before e.g. clp -presolve off -netlibp"
1938     ); 
1939  parameters[numberParameters++]=
1940    CbcOrClpParam("netlibT!une","Solve entire netlib test set with 'best' algorithm",
1941                  NETLIB_TUNE,3);
1942  parameters[numberParameters-1].setLonghelp
1943    (
1944     "This exercises the unit test for clp and then solves the netlib test set using whatever \
1945works best.  I know this is cheating but it also stresses the code better by doing a \
1946mixture of stuff.  The best algorithm was chosen on a Linux ThinkPad using native cholesky \
1947with University of Florida ordering."
1948     ); 
1949  parameters[numberParameters++]=
1950    CbcOrClpParam("network","Tries to make network matrix",
1951                  NETWORK,7,false);
1952  parameters[numberParameters-1].setLonghelp
1953    (
1954     "Clp will go faster if the matrix can be converted to a network.  The matrix\
1955 operations may be a bit faster with more efficient storage, but the main advantage\
1956 comes from using a network factorization.  It will probably not be as fast as a \
1957specialized network code."
1958     ); 
1959#ifdef COIN_HAS_CBC
1960  parameters[numberParameters++]=
1961    CbcOrClpParam("node!Strategy","What strategy to use to select nodes",
1962                  "hybrid",NODESTRATEGY);
1963  parameters[numberParameters-1].append("fewest");
1964  parameters[numberParameters-1].append("depth");
1965  parameters[numberParameters-1].append("upfewest");
1966  parameters[numberParameters-1].append("downfewest");
1967  parameters[numberParameters-1].append("updepth");
1968  parameters[numberParameters-1].append("downdepth");
1969  parameters[numberParameters-1].setLonghelp
1970    (
1971     "Normally before a solution the code will choose node with fewest infeasibilities. \
1972You can choose depth as the criterion.  You can also say if up or down branch must \
1973be done first (the up down choice will carry on after solution). \
1974Default has now been changed to hybrid which is breadth first on small depth nodes then fewest."
1975     ); 
1976  parameters[numberParameters++]=
1977    CbcOrClpParam("numberA!nalyze","Number of analysis iterations",
1978                  -COIN_INT_MAX,COIN_INT_MAX,NUMBERANALYZE,false);
1979  parameters[numberParameters-1].setLonghelp
1980    (
1981     "This says how many iterations to spend at root node analyzing problem. \
1982This is a first try and will hopefully become more sophisticated."
1983     ); 
1984#endif
1985  parameters[numberParameters++]=
1986    CbcOrClpParam("objective!Scale","Scale factor to apply to objective",
1987                  -1.0e20,1.0e20,OBJSCALE,false);
1988  parameters[numberParameters-1].setLonghelp
1989    (
1990     "If the objective function has some very large values, you may wish to scale them\
1991 internally by this amount.  It can also be set by autoscale.  It is applied after scaling"
1992     ); 
1993  parameters[numberParameters-1].setDoubleValue(1.0);
1994#endif
1995#ifdef COIN_HAS_CBC
1996  parameters[numberParameters++]=
1997    CbcOrClpParam("outDup!licates","takes duplicate rows etc out of integer model",
1998                  OUTDUPROWS,7,false);
1999#endif
2000  parameters[numberParameters++]=
2001    CbcOrClpParam("output!Format","Which output format to use",
2002                  1,6,OUTPUTFORMAT);
2003  parameters[numberParameters-1].setLonghelp
2004    (
2005     "Normally export will be done using normal representation for numbers and two values\
2006 per line.  You may want to do just one per line (for grep or suchlike) and you may wish\
2007 to save with absolute accuracy using a coded version of the IEEE value. A value of 2 is normal.\
2008 otherwise odd values gives one value per line, even two.  Values 1,2 give normal format, 3,4\
2009 gives greater precision, while 5,6 give IEEE values.  When used for exporting a basis 1 does not save \
2010values, 2 saves values, 3 with greater accuracy and 4 in IEEE."
2011     );
2012#ifdef COIN_HAS_CBC
2013  parameters[numberParameters++]=
2014    CbcOrClpParam("passC!uts","Number of cut passes at root node",
2015                  -999999,999999,CUTPASS);
2016  parameters[numberParameters-1].setLonghelp
2017    (
2018     "The default is 100 passes if less than 500 columns, 100 passes (but \
2019stop if drop small if less than 5000 columns, 20 otherwise"
2020     ); 
2021  parameters[numberParameters++]=
2022    CbcOrClpParam("passF!easibilityPump","How many passes in feasibility pump",
2023                  0,10000,FPUMPITS);
2024  parameters[numberParameters-1].setLonghelp
2025    (
2026     "This fine tunes Feasibility Pump by doing more or fewer passes."
2027     ); 
2028  parameters[numberParameters-1].setIntValue(20);
2029#endif
2030#ifdef COIN_HAS_CLP
2031  parameters[numberParameters++]=
2032    CbcOrClpParam("passP!resolve","How many passes in presolve",
2033                  -200,100,PRESOLVEPASS,false);
2034  parameters[numberParameters-1].setLonghelp
2035    (
2036     "Normally Presolve does 5 passes but you may want to do less to make it\
2037 more lightweight or do more if improvements are still being made.  As Presolve will return\
2038 if nothing is being taken out, you should not normally need to use this fine tuning."
2039     );
2040#endif
2041#ifdef COIN_HAS_CBC
2042  parameters[numberParameters++]=
2043    CbcOrClpParam("passT!reeCuts","Number of cut passes in tree",
2044                  -999999,999999,CUTPASSINTREE);
2045  parameters[numberParameters-1].setLonghelp
2046    (
2047     "The default is one pass"
2048     ); 
2049#endif
2050#ifdef COIN_HAS_CLP
2051  parameters[numberParameters++]=
2052    CbcOrClpParam("pertV!alue","Method of perturbation",
2053                  -5000,102,PERTVALUE,false);
2054  parameters[numberParameters++]=
2055    CbcOrClpParam("perturb!ation","Whether to perturb problem",
2056                  "on",PERTURBATION);
2057  parameters[numberParameters-1].append("off");
2058  parameters[numberParameters-1].setLonghelp
2059    (
2060     "Perturbation helps to stop cycling, but Clp uses other measures for this.\
2061  However large problems and especially ones with unit elements and unit rhs or costs\
2062 benefit from perturbation.  Normally Clp tries to be intelligent, but you can switch this off.\
2063  The Clp library has this off by default.  This program has it on by default."
2064     ); 
2065  parameters[numberParameters++]=
2066    CbcOrClpParam("PFI","Whether to use Product Form of Inverse in simplex",
2067                  "off",PFI,7,false);
2068  parameters[numberParameters-1].append("on");
2069  parameters[numberParameters-1].setLonghelp
2070    (
2071     "By default clp uses Forrest-Tomlin L-U update.  If you are masochistic you can switch it off."
2072     ); 
2073  parameters[numberParameters++]=
2074    CbcOrClpParam("plus!Minus","Tries to make +- 1 matrix",
2075                  PLUSMINUS,7,false);
2076  parameters[numberParameters-1].setLonghelp
2077    (
2078     "Clp will go slightly faster if the matrix can be converted so that the elements are\
2079 not stored and are known to be unit.  The main advantage is memory use.  Clp may automatically\
2080 see if it can convert the problem so you should not need to use this."
2081     ); 
2082  parameters[numberParameters++]=
2083    CbcOrClpParam("pO!ptions","Dubious print options",
2084                  0,COIN_INT_MAX,PRINTOPTIONS,false);
2085  parameters[numberParameters-1].setIntValue(0);
2086  parameters[numberParameters-1].setLonghelp
2087    (
2088     "If this is > 0 then presolve will give more information and branch and cut will give statistics"
2089     ); 
2090  parameters[numberParameters++]=
2091    CbcOrClpParam("preO!pt","Presolve options",
2092                  0,COIN_INT_MAX,PRESOLVEOPTIONS,false);
2093#endif
2094  parameters[numberParameters++]=
2095    CbcOrClpParam("presolve","Whether to presolve problem",
2096                  "on",PRESOLVE);
2097  parameters[numberParameters-1].append("off");
2098  parameters[numberParameters-1].append("more");
2099  parameters[numberParameters-1].append("file");
2100  parameters[numberParameters-1].setLonghelp
2101    (
2102     "Presolve analyzes the model to find such things as redundant equations, equations\
2103 which fix some variables, equations which can be transformed into bounds etc etc.  For the\
2104 initial solve of any problem this is worth doing unless you know that it will have no effect.  \
2105on will normally do 5 passes while using 'more' will do 10.  If the problem is very large you may need \
2106to write the original to file using 'file'."
2107     ); 
2108#ifdef COIN_HAS_CBC
2109  parameters[numberParameters++]=
2110    CbcOrClpParam("preprocess","Whether to use integer preprocessing",
2111                  "off",PREPROCESS);
2112  parameters[numberParameters-1].append("on");
2113  parameters[numberParameters-1].append("save");
2114  parameters[numberParameters-1].append("equal");
2115  parameters[numberParameters-1].append("sos");
2116  parameters[numberParameters-1].append("trysos");
2117  parameters[numberParameters-1].append("equalall");
2118  parameters[numberParameters-1].append("strategy");
2119  parameters[numberParameters-1].setLonghelp
2120    (
2121     "This tries to reduce size of model in a similar way to presolve and \
2122it also tries to strengthen the model - this can be very useful and is worth trying. \
2123 Save option saves on file presolved.mps.  equal will turn <= cliques into \
2124==.  sos will create sos sets if all 0-1 in sets (well one extra is allowed) \
2125and no overlaps.  trysos is same but allows any number extra.  equalall will turn all \
2126valid inequalities into equalities with integer slacks.  strategy is as \
2127on but uses CbcStrategy."
2128     ); 
2129#endif
2130#ifdef COIN_HAS_CLP
2131  parameters[numberParameters++]=
2132    CbcOrClpParam("preT!olerance","Tolerance to use in presolve",
2133                  1.0e-20,1.0e12,PRESOLVETOLERANCE);
2134  parameters[numberParameters-1].setLonghelp
2135    (
2136     "The default is 1.0e-8 - you may wish to try 1.0e-7 if presolve says the problem is \
2137infeasible and you have awkward numbers and you are sure the problem is really feasible."
2138     ); 
2139  parameters[numberParameters++]=
2140    CbcOrClpParam("primalP!ivot","Primal pivot choice algorithm",
2141                  "auto!matic",PRIMALPIVOT);
2142  parameters[numberParameters-1].append("exa!ct");
2143  parameters[numberParameters-1].append("dant!zig");
2144  parameters[numberParameters-1].append("part!ial");
2145  parameters[numberParameters-1].append("steep!est");
2146  parameters[numberParameters-1].append("change");
2147  parameters[numberParameters-1].append("sprint");
2148  parameters[numberParameters-1].setLonghelp
2149    (
2150     "Clp can use any pivot selection algorithm which the user codes as long as it\
2151 implements the features in the abstract pivot base class.  The Dantzig method is implemented\
2152 to show a simple method but its use is deprecated.  Exact devex is the method of choice and there\
2153 are two variants which keep all weights updated but only scan a subset each iteration.\
2154 Partial switches this on while change initially does dantzig until the factorization\
2155 becomes denser.  This is still a work in progress."
2156     ); 
2157  parameters[numberParameters++]=
2158    CbcOrClpParam("primalS!implex","Do primal simplex algorithm",
2159                  PRIMALSIMPLEX);
2160  parameters[numberParameters-1].setLonghelp
2161    (
2162     "This command solves the current model using the primal algorithm.\
2163  The default is to use exact devex.\
2164 The time and iterations may be affected by settings such as presolve, scaling, crash\
2165 and also by column selection  method, infeasibility weight and dual and primal tolerances."
2166     );
2167#endif
2168  parameters[numberParameters++]=
2169    CbcOrClpParam("primalT!olerance","For an optimal solution \
2170no primal infeasibility may exceed this value",
2171                  1.0e-20,1.0e12,PRIMALTOLERANCE);
2172  parameters[numberParameters-1].setLonghelp
2173    (
2174     "Normally the default tolerance is fine, but you may want to increase it a\
2175 bit if a primal run seems to be having a hard time"
2176     ); 
2177#ifdef COIN_HAS_CLP
2178  parameters[numberParameters++]=
2179    CbcOrClpParam("primalW!eight","Initially algorithm acts as if it \
2180costs this much to be infeasible",
2181                  1.0e-20,1.0e20,PRIMALWEIGHT);
2182  parameters[numberParameters-1].setLonghelp
2183    (
2184     "The primal algorithm in Clp is a single phase algorithm as opposed to a two phase\
2185 algorithm where you first get feasible then optimal.  So Clp is minimizing this weight times\
2186 the sum of primal infeasibilities plus the true objective function (in minimization sense).\
2187  Too high a value may mean more iterations, while too low a bound means\
2188 the code may go all the way and then have to increase the weight in order to get feasible.\
2189  OSL had a heuristic to\
2190 adjust bounds, maybe we need that here."
2191     ); 
2192#endif
2193  parameters[numberParameters++]=
2194    CbcOrClpParam("printi!ngOptions","Print options",
2195                  "normal",INTPRINT,3);
2196  parameters[numberParameters-1].append("integer");
2197  parameters[numberParameters-1].append("special");
2198  parameters[numberParameters-1].append("rows");
2199  parameters[numberParameters-1].append("all");
2200  parameters[numberParameters-1].setLonghelp
2201    (
2202     "This changes the amount and format of printing a solution:\nnormal - nonzero column variables \n\
2203integer - nonzero integer column variables\n\
2204special - in format suitable for OsiRowCutDebugger\n\
2205rows - nonzero column variables and row activities\n\
2206all - all column variables and row activities.\n\
2207\nFor non-integer problems 'integer' and 'special' act like 'normal'.  \
2208Also see printMask for controlling output."
2209     ); 
2210  parameters[numberParameters++]=
2211    CbcOrClpParam("printM!ask","Control printing of solution on a  mask",
2212                  PRINTMASK,3);
2213  parameters[numberParameters-1].setLonghelp
2214    (
2215     "If set then only those names which match mask are printed in a solution. \
2216'?' matches any character and '*' matches any set of characters. \
2217 The default is '' i.e. unset so all variables are printed. \
2218This is only active if model has names."
2219     ); 
2220#ifdef COIN_HAS_CBC
2221  parameters[numberParameters++]=
2222    CbcOrClpParam("prio!rityIn","Import priorities etc from file",
2223                  PRIORITYIN,3);
2224  parameters[numberParameters-1].setLonghelp
2225    (
2226     "This will read a file with priorities from the given file name.  It will use the default\
2227 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
2228 is initialized to '', i.e. it must be set.  This can not read from compressed files. \
2229File is in csv format with allowed headings - name, number, priority, direction, up, down, solution.  Exactly one of\
2230 name and number must be given."
2231     ); 
2232  parameters[numberParameters++]=
2233    CbcOrClpParam("probing!Cuts","Whether to use Probing cuts",
2234                  "off",PROBINGCUTS);
2235  parameters[numberParameters-1].append("on");
2236  parameters[numberParameters-1].append("root");
2237  parameters[numberParameters-1].append("ifmove");
2238  parameters[numberParameters-1].append("forceOn");
2239  parameters[numberParameters-1].append("forceOnBut");
2240  parameters[numberParameters-1].append("forceOnStrong");
2241  parameters[numberParameters-1].append("forceOnButStrong");
2242  parameters[numberParameters-1].setLonghelp
2243    (
2244     "This switches on probing cuts (either at root or in entire tree) \
2245See branchAndCut for information on options. \
2246but strong options do more probing"
2247     ); 
2248  parameters[numberParameters++]=
2249    CbcOrClpParam("pumpT!une","Dubious ideas for feasibility pump",
2250                  0,100000000,FPUMPTUNE);
2251  parameters[numberParameters-1].setLonghelp
2252    (
2253     "This fine tunes Feasibility Pump \n\
2254\t>=1000000 use as accumulate switch\n\
2255\t>=1000 use index+1 as number of large loops\n\
2256\t>=100 use 0.05 objvalue as increment\n\
2257\t>=10 use +0.1 objvalue for cutoff (add)\n\
2258\t1 == fix ints at bounds, 2 fix all integral ints, 3 and continuous at bounds"
2259     ); 
2260  parameters[numberParameters-1].setIntValue(0);
2261#endif
2262  parameters[numberParameters++]=
2263    CbcOrClpParam("quit","Stops clp execution",
2264                  EXIT);
2265  parameters[numberParameters-1].setLonghelp
2266    (
2267     "This stops the execution of Clp, end, exit, quit and stop are synonyms"
2268     ); 
2269#ifdef COIN_HAS_CBC
2270  parameters[numberParameters++]=
2271    CbcOrClpParam("ratio!Gap","Stop when gap between best possible and \
2272best less than this fraction of larger of two",
2273                  0.0,1.0e20,GAPRATIO);
2274  parameters[numberParameters-1].setDoubleValue(0.0);
2275  parameters[numberParameters-1].setLonghelp
2276    (
2277     "If the gap between best solution and best possible solution is less than this fraction \
2278of the objective value at the root node then the search will terminate.  See 'allowableGap' for a \
2279way of using absolute value rather than fraction."
2280     ); 
2281#endif
2282#ifdef COIN_HAS_CLP
2283  parameters[numberParameters++]=
2284    CbcOrClpParam("reallyO!bjectiveScale","Scale factor to apply to objective in place",
2285                  -1.0e20,1.0e20,OBJSCALE2,false);
2286  parameters[numberParameters-1].setLonghelp
2287    (
2288     "You can set this to -1.0 to test maximization or other to stress code"
2289     ); 
2290  parameters[numberParameters-1].setDoubleValue(1.0);
2291  parameters[numberParameters++]=
2292    CbcOrClpParam("reallyS!cale","Scales model in place",
2293                  REALLY_SCALE,7,false);
2294#endif
2295#ifdef COIN_HAS_CBC
2296    parameters[numberParameters++]=
2297      CbcOrClpParam("reduce!AndSplitCuts","Whether to use Reduce-and-Split cuts",
2298              "off",REDSPLITCUTS);
2299    parameters[numberParameters-1].append("on");
2300    parameters[numberParameters-1].append("root");
2301    parameters[numberParameters-1].append("ifmove");
2302    parameters[numberParameters-1].append("forceOn");
2303    parameters[numberParameters-1].setLonghelp
2304    (
2305     "This switches on reduce and split  cuts (either at root or in entire tree) \
2306See branchAndCut for information on options."
2307     ); 
2308  parameters[numberParameters++]=
2309    CbcOrClpParam("residual!CapacityCuts","Whether to use Residual Capacity cuts",
2310                  "off",RESIDCUTS);
2311  parameters[numberParameters-1].append("on");
2312  parameters[numberParameters-1].append("root");
2313  parameters[numberParameters-1].append("ifmove");
2314  parameters[numberParameters-1].append("forceOn");
2315  parameters[numberParameters-1].setLonghelp
2316    (
2317     "Residual capacity cuts. \
2318See branchAndCut for information on options."
2319     ); 
2320#endif
2321#ifdef COIN_HAS_CLP
2322  parameters[numberParameters++]=
2323    CbcOrClpParam("restore!Model","Restore model from binary file",
2324                  RESTORE);
2325  parameters[numberParameters-1].setLonghelp
2326    (
2327     "This reads data save by saveModel from the given file.  It will use the default\
2328 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
2329 is initialized to 'default.prob'."
2330     ); 
2331  parameters[numberParameters++]=
2332    CbcOrClpParam("reverse","Reverses sign of objective",
2333                  REVERSE,7,false);
2334  parameters[numberParameters-1].setLonghelp
2335    (
2336     "Useful for testing if maximization works correctly"
2337     ); 
2338  parameters[numberParameters++]=
2339    CbcOrClpParam("rhs!Scale","Scale factor to apply to rhs and bounds",
2340                  -1.0e20,1.0e20,RHSSCALE,false);
2341  parameters[numberParameters-1].setLonghelp
2342    (
2343     "If the rhs or bounds have some very large meaningful values, you may wish to scale them\
2344 internally by this amount.  It can also be set by autoscale"
2345     ); 
2346  parameters[numberParameters-1].setDoubleValue(1.0);
2347#endif
2348#ifdef COIN_HAS_CBC
2349  parameters[numberParameters++]=
2350      CbcOrClpParam("Rins","Whether to try Relaxed Induced Neighborhood Search",
2351                    "off",RINS);
2352    parameters[numberParameters-1].append("on");
2353  parameters[numberParameters-1].setLonghelp
2354    (
2355     "This switches on Relaxed induced neighborhood Search."
2356     ); 
2357  parameters[numberParameters++]=
2358    CbcOrClpParam("round!ingHeuristic","Whether to use Rounding heuristic",
2359                  "off",ROUNDING);
2360  parameters[numberParameters-1].append("on");
2361  parameters[numberParameters-1].setLonghelp
2362    (
2363     "This switches on a simple (but effective) rounding heuristic at each node of tree."
2364     ); 
2365#endif
2366  parameters[numberParameters++]=
2367    CbcOrClpParam("saveM!odel","Save model to binary file",
2368                  SAVE);
2369  parameters[numberParameters-1].setLonghelp
2370    (
2371     "This will save the problem to the given file name for future use\
2372 by restoreModel.  It will use the default\
2373 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
2374 is initialized to 'default.prob'."
2375     ); 
2376  parameters[numberParameters++]=
2377    CbcOrClpParam("saveS!olution","saves solution to file",
2378                  SAVESOL);
2379  parameters[numberParameters-1].setLonghelp
2380    (
2381     "This will write a binary solution file to the given file name.  It will use the default\
2382 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
2383 is initialized to 'solution.file'.  To read the file use fread(int) twice to pick up number of rows \
2384and columns, then fread(double) to pick up objective value, then pick up row activities, row duals, column \
2385activities and reduced costs - see bottom of CbcOrClpParam.cpp for code that reads or writes file."
2386     ); 
2387  parameters[numberParameters++]=
2388    CbcOrClpParam("scal!ing","Whether to scale problem",
2389                  "off",SCALING);
2390  parameters[numberParameters-1].append("equi!librium");
2391  parameters[numberParameters-1].append("geo!metric");
2392  parameters[numberParameters-1].append("auto!matic");
2393  parameters[numberParameters-1].setLonghelp
2394    (
2395     "Scaling can help in solving problems which might otherwise fail because of lack of\
2396 accuracy.  It can also reduce the number of iterations.  It is not applied if the range\
2397 of elements is small.  When unscaled it is possible that there may be small primal and/or\
2398 infeasibilities."
2399     ); 
2400  parameters[numberParameters-1].setCurrentOption(3); // say auto
2401#ifndef COIN_HAS_CBC
2402  parameters[numberParameters++]=
2403    CbcOrClpParam("sec!onds","Maximum seconds",
2404                  -1.0,1.0e12,TIMELIMIT);
2405  parameters[numberParameters-1].setLonghelp
2406    (
2407     "After this many seconds clp will act as if maximum iterations had been reached \
2408(if value >=0).  \
2409In this program it is really only useful for testing but the library function\n\
2410      \tsetMaximumSeconds(value)\n can be useful."
2411     );
2412#else
2413  parameters[numberParameters++]=
2414    CbcOrClpParam("sec!onds","maximum seconds",
2415                  -1.0,1.0e12,TIMELIMIT_BAB);
2416  parameters[numberParameters-1].setLonghelp
2417    (
2418     "After this many seconds coin solver will act as if maximum nodes had been reached."
2419     );
2420#endif
2421  parameters[numberParameters++]=
2422    CbcOrClpParam("sleep","for debug",
2423                  DUMMY,7,false);
2424  parameters[numberParameters-1].setLonghelp
2425    (
2426     "If passed to solver fom ampl, then ampl will wait so that you can copy .nl file for debug."
2427     ); 
2428#ifdef COIN_HAS_CLP
2429  parameters[numberParameters++]=
2430    CbcOrClpParam("slp!Value","Number of slp passes before primal",
2431                  -1,50000,SLPVALUE,false);
2432  parameters[numberParameters-1].setLonghelp
2433    (
2434     "If you are solving a quadratic problem using primal then it may be helpful to do some \
2435sequential Lps to get a good approximate solution."
2436     ); 
2437#endif
2438  parameters[numberParameters++]=
2439    CbcOrClpParam("solu!tion","Prints solution to file",
2440                  SOLUTION);
2441  parameters[numberParameters-1].setLonghelp
2442    (
2443     "This will write a primitive solution file to the given file name.  It will use the default\
2444 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
2445 is initialized to 'stdout'.  The amount of output can be varied using printi!ngOptions or printMask."
2446     ); 
2447#ifdef COIN_HAS_CLP
2448#ifdef COIN_HAS_CBC
2449  parameters[numberParameters++]=
2450    CbcOrClpParam("solv!e","Solve problem",
2451                  BAB);
2452  parameters[numberParameters-1].setLonghelp
2453    (
2454     "If there are no integer variables then this just solves LP.  If there are integer variables \
2455this does branch and cut."
2456     ); 
2457  parameters[numberParameters++]=
2458    CbcOrClpParam("sos!Options","Whether to use SOS from AMPL",
2459                  "off",SOS);
2460  parameters[numberParameters-1].append("on");
2461  parameters[numberParameters-1].setCurrentOption("on");
2462  parameters[numberParameters-1].setLonghelp
2463    (
2464     "Normally if AMPL says there are SOS variables they should be used, but sometime sthey should\
2465 be turned off - this does so."
2466     ); 
2467  parameters[numberParameters++]=
2468    CbcOrClpParam("slog!Level","Level of detail in Solver output",
2469                  -1,63,SOLVERLOGLEVEL);
2470  parameters[numberParameters-1].setLonghelp
2471    (
2472     "If 0 then there should be no output in normal circumstances.  1 is probably the best\
2473 value for most uses, while 2 and 3 give more information."
2474     );
2475#else
2476  // allow solve as synonym for dual
2477  parameters[numberParameters++]=
2478    CbcOrClpParam("solv!e","Solve problem using dual simplex",
2479                  BAB);
2480  parameters[numberParameters-1].setLonghelp
2481    (
2482     "Just so can use solve for clp as well as in cbc"
2483     ); 
2484#endif
2485#endif
2486#ifdef COIN_HAS_CLP
2487  parameters[numberParameters++]=
2488    CbcOrClpParam("spars!eFactor","Whether factorization treated as sparse",
2489                  "on",SPARSEFACTOR,7,false);
2490  parameters[numberParameters-1].append("off");
2491  parameters[numberParameters++]=
2492    CbcOrClpParam("special!Options","Dubious options for Simplex - see ClpSimplex.hpp",
2493                  0,COIN_INT_MAX,SPECIALOPTIONS,false);
2494  parameters[numberParameters++]=
2495    CbcOrClpParam("sprint!Crash","Whether to try sprint crash",
2496                  -1,5000000,SPRINT);
2497  parameters[numberParameters-1].setLonghelp
2498    (
2499     "For long and thin problems this program may solve a series of small problems\
2500 created by taking a subset of the columns.  I introduced the idea as 'Sprint' after\
2501 an LP code of that name of the 60's which tried the same tactic (not totally successfully).\
2502  Cplex calls it 'sifting'.  -1 is automatic choice, 0 is off, n is number of passes"
2503     ); 
2504  parameters[numberParameters++]=
2505    CbcOrClpParam("stat!istics","Print some statistics",
2506                  STATISTICS);
2507  parameters[numberParameters-1].setLonghelp
2508    (
2509     "This command prints some statistics for the current model.\
2510 If log level >1 then more is printed.\
2511 These are for presolved model if presolve on (and unscaled)."
2512     );
2513#endif
2514  parameters[numberParameters++]=
2515    CbcOrClpParam("stop","Stops clp execution",
2516                  EXIT);
2517  parameters[numberParameters-1].setLonghelp
2518    (
2519     "This stops the execution of Clp, end, exit, quit and stop are synonyms"
2520     ); 
2521#ifdef COIN_HAS_CBC
2522  parameters[numberParameters++]=
2523    CbcOrClpParam("strengthen","Create strengthened problem",
2524                  STRENGTHEN,3);
2525  parameters[numberParameters-1].setLonghelp
2526    (
2527     "This creates a new problem by applying the root node cuts.  All tight constraints \
2528will be in resulting problem"
2529     ); 
2530  parameters[numberParameters++]=
2531    CbcOrClpParam("strong!Branching","Number of variables to look at in strong branching",
2532                  0,999999,STRONGBRANCHING);
2533  parameters[numberParameters-1].setLonghelp
2534    (
2535     "In order to decide which variable to branch on, the code will choose up to this number \
2536of unsatisfied variables to do mini up and down branches on.  Then the most effective one is chosen. \
2537If a variable is branched on many times then the previous average up and down costs may be used - \
2538see number before trust."
2539     ); 
2540#endif
2541#ifdef COIN_HAS_CLP
2542  parameters[numberParameters++]=
2543    CbcOrClpParam("subs!titution","How long a column to substitute for in presolve",
2544                  0,10000,SUBSTITUTION,false);
2545  parameters[numberParameters-1].setLonghelp
2546    (
2547     "Normally Presolve gets rid of 'free' variables when there are no more than 3 \
2548 variables in column.  If you increase this the number of rows may decrease but number of \
2549 elements may increase."
2550     ); 
2551#endif
2552#ifdef COIN_HAS_CBC
2553  parameters[numberParameters++]=
2554    CbcOrClpParam("testO!si","Test OsiObject stuff",
2555                  -1,COIN_INT_MAX,TESTOSI,false);
2556#endif
2557#ifdef CBC_THREAD
2558  parameters[numberParameters++]=
2559    CbcOrClpParam("thread!s","Number of threads to try and use",
2560                  -100,10000,THREADS,false);
2561  parameters[numberParameters-1].setLonghelp
2562    (
2563     "To use multiple threads, set threads to number wanted.  It may be better \
2564to use one or two more than number of cpus available.  If 100+n then n threads and \
2565threads used in sub-trees, if 200+n use threads for root cuts, 300+n - both."
2566     ); 
2567#endif
2568#ifdef COIN_HAS_CBC
2569  parameters[numberParameters++]=
2570    CbcOrClpParam("tighten!Factor","Tighten bounds using this times largest \
2571activity at continuous solution",
2572                  1.0e-3,1.0e20,TIGHTENFACTOR,false);
2573  parameters[numberParameters-1].setLonghelp
2574    (
2575     "This sleazy trick can help on some problems."
2576     ); 
2577#endif
2578#ifdef COIN_HAS_CLP
2579  parameters[numberParameters++]=
2580    CbcOrClpParam("tightLP","Poor person's preSolve for now",
2581                  TIGHTEN,7,false);
2582#endif
2583#ifdef COIN_HAS_CBC
2584  parameters[numberParameters++]=
2585    CbcOrClpParam("trust!PseudoCosts","Number of branches before we trust pseudocosts",
2586                  -1,2000000,NUMBERBEFORE);
2587  parameters[numberParameters-1].setLonghelp
2588    (
2589     "Using strong branching computes pseudo-costs.  After this many times for a variable we just \
2590trust the pseudo costs and do not do any more strong branching."
2591     ); 
2592#endif
2593#ifdef COIN_HAS_CBC
2594  parameters[numberParameters++]=
2595    CbcOrClpParam("tune!PreProcess","Dubious tuning parameters",
2596                  0,20000000,PROCESSTUNE,false);
2597  parameters[numberParameters-1].setLonghelp
2598    (
2599     "For making equality cliques this is minimumsize.  Also for adding \
2600integer slacks.  May be used for more later \
2601If <1000 that is what it does.  If <1000000 - numberPasses is (value/1000)-1 and tune is tune %1000. \
2602If >= 1000000! - numberPasses is (value/1000000)-1 and tune is tune %1000000.  In this case if tune is now still >=10000 \
2603numberPassesPerInnerLoop is changed from 10 to (tune-10000)-1 and tune becomes tune % 10000!!!!! - happy? - \
2604so to keep normal limit on cliques of 5, do 3 major passes (include presolves) but only doing one tightening pass per major pass - \
2605you would use 3010005 (I think)"
2606     ); 
2607  parameters[numberParameters++]=
2608    CbcOrClpParam("two!MirCuts","Whether to use Two phase Mixed Integer Rounding cuts",
2609                  "off",TWOMIRCUTS);
2610  parameters[numberParameters-1].append("on");
2611  parameters[numberParameters-1].append("root");
2612  parameters[numberParameters-1].append("ifmove");
2613  parameters[numberParameters-1].append("forceOn");
2614  parameters[numberParameters-1].setLonghelp
2615    (
2616     "This switches on two phase mixed integer rounding  cuts (either at root or in entire tree) \
2617See branchAndCut for information on options."
2618     ); 
2619#endif
2620  parameters[numberParameters++]=
2621    CbcOrClpParam("unitTest","Do unit test",
2622                  UNITTEST,3);
2623  parameters[numberParameters-1].setLonghelp
2624    (
2625     "This exercises the unit test for clp"
2626     ); 
2627  parameters[numberParameters++]=
2628    CbcOrClpParam("userClp","Hand coded Clp stuff",
2629                  USERCLP);
2630  parameters[numberParameters-1].setLonghelp
2631    (
2632     "There are times e.g. when using AMPL interface when you may wish to do something unusual.  \
2633Look for USERCLP in main driver and modify sample code."
2634     ); 
2635#ifdef COIN_HAS_CBC
2636  parameters[numberParameters++]=
2637    CbcOrClpParam("userCbc","Hand coded Cbc stuff",
2638                  USERCBC);
2639  parameters[numberParameters-1].setLonghelp
2640    (
2641     "There are times e.g. when using AMPL interface when you may wish to do something unusual.  \
2642Look for USERCBC in main driver and modify sample code."
2643     ); 
2644#endif
2645  parameters[numberParameters++]=
2646    CbcOrClpParam("vector","Whether to use vector? Form of matrix in simplex",
2647                  "off",VECTOR,7,false);
2648  parameters[numberParameters-1].append("on");
2649  parameters[numberParameters-1].setLonghelp
2650    (
2651     "If this is on and ClpPackedMatrix uses extra column copy in odd format."
2652     ); 
2653  parameters[numberParameters++]=
2654    CbcOrClpParam("verbose","Switches on longer help on single ?",
2655                  0,15,VERBOSE,false);
2656  parameters[numberParameters-1].setLonghelp
2657    (
2658     "Set to 1 to get short help with ? list, 2 to get long help, 3 for both.  (add 4 to just get ampl ones)."
2659     ); 
2660  parameters[numberParameters-1].setIntValue(0);
2661  assert(numberParameters<CBCMAXPARAMETERS);
2662}
2663// Given a parameter type - returns its number in list
2664int whichParam (CbcOrClpParameterType name, 
2665                int numberParameters, CbcOrClpParam *const parameters)
2666{
2667  int i;
2668  for (i=0;i<numberParameters;i++) {
2669    if (parameters[i].type()==name)
2670      break;
2671  }
2672  assert (i<numberParameters);
2673  return i;
2674}
2675#ifdef COIN_HAS_CLP
2676// Dump a solution to file
2677void saveSolution(const ClpSimplex * lpSolver,std::string fileName)
2678{
2679  FILE * fp=fopen(fileName.c_str(),"wb");
2680  if (fp) {
2681    int numberRows=lpSolver->numberRows();
2682    int numberColumns=lpSolver->numberColumns();
2683    double objectiveValue = lpSolver->objectiveValue();
2684    fwrite(&numberRows,sizeof(int),1,fp);
2685    fwrite(&numberColumns,sizeof(int),1,fp);
2686    fwrite(&objectiveValue,sizeof(double),1,fp);
2687    double * dualRowSolution = lpSolver->dualRowSolution();
2688    double * primalRowSolution = lpSolver->primalRowSolution();
2689    fwrite(primalRowSolution,sizeof(double),numberRows,fp);
2690    fwrite(dualRowSolution,sizeof(double),numberRows,fp);
2691    double * dualColumnSolution = lpSolver->dualColumnSolution();
2692    double * primalColumnSolution = lpSolver->primalColumnSolution();
2693    fwrite(primalColumnSolution,sizeof(double),numberColumns,fp);
2694    fwrite(dualColumnSolution,sizeof(double),numberColumns,fp);
2695    fclose(fp);
2696  } else {
2697    std::cout<<"Unable to open file "<<fileName<<std::endl;
2698  }
2699}
2700/* Restore a solution from file.
2701   mode 0 normal, 1 swap rows and columns and primal and dual
2702   if 2 set then also change signs
2703*/
2704void restoreSolution(ClpSimplex * lpSolver,std::string fileName,int mode)
2705{
2706  FILE * fp=fopen(fileName.c_str(),"rb");
2707  if (fp) {
2708    int numberRows=lpSolver->numberRows();
2709    int numberColumns=lpSolver->numberColumns();
2710    int numberRowsFile;
2711    int numberColumnsFile;
2712    double objectiveValue;
2713    fread(&numberRowsFile,sizeof(int),1,fp);
2714    fread(&numberColumnsFile,sizeof(int),1,fp);
2715    fread(&objectiveValue,sizeof(double),1,fp);
2716    double * dualRowSolution = lpSolver->dualRowSolution();
2717    double * primalRowSolution = lpSolver->primalRowSolution();
2718    double * dualColumnSolution = lpSolver->dualColumnSolution();
2719    double * primalColumnSolution = lpSolver->primalColumnSolution();
2720    if (mode) {
2721      // swap
2722      int k=numberRows;
2723      numberRows=numberColumns;
2724      numberColumns=k;
2725      double * temp;
2726      temp = dualRowSolution;
2727      dualRowSolution = primalColumnSolution;
2728      primalColumnSolution=temp;
2729      temp = dualColumnSolution;
2730      dualColumnSolution = primalRowSolution;
2731      primalRowSolution=temp;
2732    }
2733    if (numberRows!=numberRowsFile||numberColumns!=numberColumnsFile) {
2734      std::cout<<"Mismatch on rows and/or columns"<<std::endl;
2735    } else {
2736      lpSolver->setObjectiveValue(objectiveValue);
2737      fread(primalRowSolution,sizeof(double),numberRows,fp);
2738      fread(dualRowSolution,sizeof(double),numberRows,fp);
2739      fread(primalColumnSolution,sizeof(double),numberColumns,fp);
2740      fread(dualColumnSolution,sizeof(double),numberColumns,fp);
2741      if (mode==3) {
2742        int i;
2743        for (i=0;i<numberRows;i++) {
2744          primalRowSolution[i] = -primalRowSolution[i];
2745          dualRowSolution[i] = -dualRowSolution[i];
2746        }
2747        for (i=0;i<numberColumns;i++) {
2748          primalColumnSolution[i] = -primalColumnSolution[i];
2749          dualColumnSolution[i] = -dualColumnSolution[i];
2750        }
2751      }
2752    }
2753    fclose(fp);
2754  } else {
2755    std::cout<<"Unable to open file "<<fileName<<std::endl;
2756  }
2757}
2758#endif
Note: See TracBrowser for help on using the repository browser.