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

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

take out mini tree parameters

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