source: trunk/Clp/src/CbcOrClpParam.cpp @ 1321

Last change on this file since 1321 was 1321, checked in by forrest, 11 years ago

out compiler warnings and stability improvements

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