source: trunk/Test/CbcOrClpParam.cpp @ 170

Last change on this file since 170 was 170, checked in by forrest, 16 years ago

for solve

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 64.2 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 <string>
9#include <iostream>
10#include <cassert>
11
12#include "CbcOrClpParam.hpp"
13#ifdef COIN_USE_CBC
14#include "OsiSolverInterface.hpp"
15#include "CbcModel.hpp"
16#endif
17#ifdef COIN_USE_CLP
18#include "ClpSimplex.hpp"
19#include "ClpFactorization.hpp"
20#endif
21#ifdef COIN_USE_READLINE     
22#include <readline/readline.h>
23#include <readline/history.h>
24#endif
25#ifdef COIN_OSI_HAS_CLP
26// from CoinSolve
27static char coin_prompt[]="Coin:";
28#else
29static char coin_prompt[]="Clp:";
30#endif
31//#############################################################################
32// Constructors / Destructor / Assignment
33//#############################################################################
34
35//-------------------------------------------------------------------
36// Default Constructor
37//-------------------------------------------------------------------
38CbcOrClpParam::CbcOrClpParam () 
39  : type_(INVALID),
40    lowerDoubleValue_(0.0),
41    upperDoubleValue_(0.0),
42    lowerIntValue_(0),
43    upperIntValue_(0),
44    lengthName_(0),
45    lengthMatch_(0),
46    definedKeyWords_(),
47    name_(),
48    shortHelp_(),
49    longHelp_(),
50    action_(INVALID),
51    currentKeyWord_(-1),
52    display_(false),
53    intValue_(-1),
54    doubleValue_(-1.0),
55    stringValue_(""),
56    indexNumber_(INVALID)
57{
58}
59// Other constructors
60CbcOrClpParam::CbcOrClpParam (std::string name, std::string help,
61           double lower, double upper, CbcOrClpParameterType type,
62                    bool display)
63  : type_(type),
64    lowerIntValue_(0),
65    upperIntValue_(0),
66    definedKeyWords_(),
67    name_(name),
68    shortHelp_(help),
69    longHelp_(),
70    action_(type),
71    currentKeyWord_(-1),
72    display_(display),
73    intValue_(-1),
74    doubleValue_(-1.0),
75    stringValue_(""),
76    indexNumber_(type)
77{
78  lowerDoubleValue_ = lower;
79  upperDoubleValue_ = upper;
80  gutsOfConstructor();
81}
82CbcOrClpParam::CbcOrClpParam (std::string name, std::string help,
83           int lower, int upper, CbcOrClpParameterType type,
84                    bool display)
85  : type_(type),
86    lowerDoubleValue_(0.0),
87    upperDoubleValue_(0.0),
88    definedKeyWords_(),
89    name_(name),
90    shortHelp_(help),
91    longHelp_(),
92    action_(type),
93    currentKeyWord_(-1),
94    display_(display),
95    intValue_(-1),
96    doubleValue_(-1.0),
97    stringValue_(""),
98    indexNumber_(type)
99{
100  gutsOfConstructor();
101  lowerIntValue_ = lower;
102  upperIntValue_ = upper;
103}
104// Other strings will be added by append
105CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, 
106                    std::string firstValue,
107                    CbcOrClpParameterType type,int defaultIndex,
108                    bool display)
109  : type_(type),
110    lowerDoubleValue_(0.0),
111    upperDoubleValue_(0.0),
112    lowerIntValue_(0),
113    upperIntValue_(0),
114    definedKeyWords_(),
115    name_(name),
116    shortHelp_(help),
117    longHelp_(),
118    action_(type),
119    currentKeyWord_(defaultIndex),
120    display_(display),
121    intValue_(-1),
122    doubleValue_(-1.0),
123    stringValue_(""),
124    indexNumber_(type)
125{
126  gutsOfConstructor();
127  definedKeyWords_.push_back(firstValue);
128}
129// Action
130CbcOrClpParam::CbcOrClpParam (std::string name, std::string help,
131                    CbcOrClpParameterType type,int indexNumber,
132                    bool display)
133  : type_(type),
134    lowerDoubleValue_(0.0),
135    upperDoubleValue_(0.0),
136    lowerIntValue_(0),
137    upperIntValue_(0),
138    definedKeyWords_(),
139    name_(name),
140    shortHelp_(help),
141    longHelp_(),
142    action_(type),
143    currentKeyWord_(-1),
144    display_(display),
145    intValue_(-1),
146    doubleValue_(-1.0),
147    stringValue_("")
148{
149  if (indexNumber<0)
150    indexNumber_=type;
151  else
152    indexNumber_=indexNumber;
153  gutsOfConstructor();
154}
155
156//-------------------------------------------------------------------
157// Copy constructor
158//-------------------------------------------------------------------
159CbcOrClpParam::CbcOrClpParam (const CbcOrClpParam & rhs) 
160{ 
161  type_ = rhs.type_;
162  lowerDoubleValue_ = rhs.lowerDoubleValue_;
163  upperDoubleValue_ = rhs.upperDoubleValue_;
164  lowerIntValue_ = rhs.lowerIntValue_;
165  upperIntValue_ = rhs.upperIntValue_;
166  lengthName_ = rhs.lengthName_;
167  lengthMatch_ = rhs.lengthMatch_;
168  definedKeyWords_ = rhs.definedKeyWords_;
169  name_ = rhs.name_;
170  shortHelp_ = rhs.shortHelp_;
171  longHelp_ = rhs.longHelp_;
172  action_ = rhs.action_;
173  currentKeyWord_ = rhs.currentKeyWord_;
174  display_=rhs.display_;
175  intValue_=rhs.intValue_;
176  doubleValue_=rhs.doubleValue_;
177  stringValue_=rhs.stringValue_;
178  indexNumber_=rhs.indexNumber_;
179}
180
181//-------------------------------------------------------------------
182// Destructor
183//-------------------------------------------------------------------
184CbcOrClpParam::~CbcOrClpParam ()
185{
186}
187
188//----------------------------------------------------------------
189// Assignment operator
190//-------------------------------------------------------------------
191CbcOrClpParam &
192CbcOrClpParam::operator=(const CbcOrClpParam& rhs)
193{
194  if (this != &rhs) {
195    type_ = rhs.type_;
196    lowerDoubleValue_ = rhs.lowerDoubleValue_;
197    upperDoubleValue_ = rhs.upperDoubleValue_;
198    lowerIntValue_ = rhs.lowerIntValue_;
199    upperIntValue_ = rhs.upperIntValue_;
200    lengthName_ = rhs.lengthName_;
201    lengthMatch_ = rhs.lengthMatch_;
202    definedKeyWords_ = rhs.definedKeyWords_;
203    name_ = rhs.name_;
204    shortHelp_ = rhs.shortHelp_;
205    longHelp_ = rhs.longHelp_;
206    action_ = rhs.action_;
207    currentKeyWord_ = rhs.currentKeyWord_;
208    display_=rhs.display_;
209    intValue_=rhs.intValue_;
210    doubleValue_=rhs.doubleValue_;
211    stringValue_=rhs.stringValue_;
212    indexNumber_=rhs.indexNumber_;
213  }
214  return *this;
215}
216void 
217CbcOrClpParam::gutsOfConstructor()
218{
219  std::string::size_type  shriekPos = name_.find('!');
220  lengthName_ = name_.length();
221  if ( shriekPos==std::string::npos ) {
222    //does not contain '!'
223    lengthMatch_= lengthName_;
224  } else {
225    lengthMatch_=shriekPos;
226    name_ = name_.substr(0,shriekPos)+name_.substr(shriekPos+1);
227    lengthName_--;
228  }
229}
230// Insert string (only valid for keywords)
231void 
232CbcOrClpParam::append(std::string keyWord)
233{
234  definedKeyWords_.push_back(keyWord);
235}
236
237int 
238CbcOrClpParam::matches (std::string input) const
239{
240  // look up strings to do more elegantly
241  if (input.length()>lengthName_) {
242    return 0;
243  } else {
244    unsigned int i;
245    for (i=0;i<input.length();i++) {
246      if (tolower(name_[i])!=tolower(input[i])) 
247        break;
248    }
249    if (i<input.length()) {
250      return 0;
251    } else if (i>=lengthMatch_) {
252      return 1;
253    } else {
254      // matched but too short
255      return 2;
256    }
257  }
258}
259// Returns name which could match
260std::string
261CbcOrClpParam::matchName (  ) const
262{ 
263  if (lengthMatch_==lengthName_) 
264    return name_;
265  else
266    return name_.substr(0,lengthMatch_)+"("+name_.substr(lengthMatch_)+")";
267}
268
269// Returns parameter option which matches (-1 if none)
270int 
271CbcOrClpParam::parameterOption ( std::string check ) const
272{
273  int numberItems = definedKeyWords_.size();
274  if (!numberItems) {
275    return -1;
276  } else {
277    int whichItem=0;
278    unsigned int it;
279    for (it=0;it<definedKeyWords_.size();it++) {
280      std::string thisOne = definedKeyWords_[it];
281      std::string::size_type  shriekPos = thisOne.find('!');
282      unsigned int length1 = thisOne.length();
283      unsigned int length2 = length1;
284      if ( shriekPos!=std::string::npos ) {
285        //contains '!'
286        length2 = shriekPos;
287        thisOne = thisOne.substr(0,shriekPos)+
288          thisOne.substr(shriekPos+1);
289        length1 = thisOne.length();
290      }
291      if (check.length()<=length1&&length2<=check.length()) {
292        unsigned int i;
293        for (i=0;i<check.length();i++) {
294          if (tolower(thisOne[i])!=tolower(check[i])) 
295            break;
296        }
297        if (i<check.length()) {
298          whichItem++;
299        } else if (i>=length2) {
300          break;
301        } 
302      } else {
303        whichItem++;
304      }
305    }
306    if (whichItem<numberItems)
307      return whichItem;
308    else
309      return -1;
310  }
311}
312// Prints parameter options
313void 
314CbcOrClpParam::printOptions (  ) const
315{
316  std::cout<<"Possible options for "<<name_<<" are:"<<std::endl;
317  unsigned int it;
318  for (it=0;it<definedKeyWords_.size();it++) {
319    std::string thisOne = definedKeyWords_[it];
320    std::string::size_type  shriekPos = thisOne.find('!');
321    if ( shriekPos!=std::string::npos ) {
322      //contains '!'
323      thisOne = thisOne.substr(0,shriekPos)+
324        "("+thisOne.substr(shriekPos+1)+")";
325    }
326    std::cout<<thisOne<<std::endl;
327  }
328}
329// Print action and string
330void 
331CbcOrClpParam::printString() const
332{
333  if (name_=="directory")
334    std::cout<<"Current working directory is "<<stringValue_<<std::endl;
335  else
336    std::cout<<"Current default (if $ as parameter) for "<<name_
337             <<" is "<<stringValue_<<std::endl;
338}
339void CoinReadPrintit(const char * input)
340{
341  int length =strlen(input);
342  char temp[101];
343  int i;
344  int n=0;
345  for (i=0;i<length;i++) {
346    if (input[i]=='\n') {
347      temp[n]='\0';
348      std::cout<<temp<<std::endl;
349      n=0;
350    } else if (n>=65&&input[i]==' ') {
351      temp[n]='\0';
352      std::cout<<temp<<std::endl;
353      n=0;
354    } else if (n||input[i]!=' ') {
355      temp[n++]=input[i];
356    }
357  }
358  if (n) {
359    temp[n]='\0';
360    std::cout<<temp<<std::endl;
361  }
362}
363// Print Long help
364void 
365CbcOrClpParam::printLongHelp() const
366{
367  if (type_>=1&&type_<400) {
368    if (type_<LOGLEVEL) {
369      printf("Range of values is %g to %g\n",lowerDoubleValue_,upperDoubleValue_);
370    } else if (type_<DIRECTION) {
371      printf("Range of values is %d to %d\n",lowerIntValue_,upperIntValue_);
372    } else if (type_<DIRECTORY) {
373      printOptions();
374    }
375    CoinReadPrintit(longHelp_.c_str());
376  }
377}
378#ifdef COIN_USE_CBC
379int
380CbcOrClpParam::setDoubleParameter (OsiSolverInterface * model,double value) 
381{
382  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
383    std::cout<<value<<" was provided for "<<name_<<
384      " - valid range is "<<lowerDoubleValue_<<" to "<<
385      upperDoubleValue_<<std::endl;
386    return 1;
387  } else {
388    double oldValue;
389    switch(type_) {
390    case DUALTOLERANCE:
391      model->getDblParam(OsiDualTolerance,oldValue);
392      model->setDblParam(OsiDualTolerance,value);
393      break;
394    case PRIMALTOLERANCE:
395      model->getDblParam(OsiPrimalTolerance,oldValue);
396      model->setDblParam(OsiPrimalTolerance,value);
397      break;
398    default:
399      oldValue=0.0; // to avoid compiler message
400      abort();
401    }
402    std::cout<<name_<<" was changed from "<<oldValue<<" to "
403             <<value<<std::endl;
404    return 0;
405  }
406}
407#endif
408#ifdef COIN_USE_CLP
409int
410CbcOrClpParam::setDoubleParameter (ClpSimplex * model,double value) 
411{
412  double oldValue = doubleParameter(model);
413  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
414    std::cout<<value<<" was provided for "<<name_<<
415      " - valid range is "<<lowerDoubleValue_<<" to "<<
416      upperDoubleValue_<<std::endl;
417    return 1;
418  } else {
419    std::cout<<name_<<" was changed from "<<oldValue<<" to "
420             <<value<<std::endl;
421    switch(type_) {
422#ifndef COIN_USE_CBC
423    case DUALTOLERANCE:
424      model->setDualTolerance(value);
425      break;
426    case PRIMALTOLERANCE:
427      model->setPrimalTolerance(value);
428      break;
429#endif
430    case DUALBOUND:
431      model->setDualBound(value);
432      break;
433    case PRIMALWEIGHT:
434      model->setInfeasibilityCost(value);
435      break;
436#ifndef COIN_USE_CBC
437    case TIMELIMIT:
438      model->setMaximumSeconds(value);
439      break;
440#endif
441    case OBJSCALE:
442      model->setObjectiveScale(value);
443      break;
444    case RHSSCALE:
445      model->setRhsScale(value);
446      break;
447    default:
448      abort();
449    }
450    return 0;
451  }
452}
453double 
454CbcOrClpParam::doubleParameter (ClpSimplex * model) const
455{
456  double value;
457  switch(type_) {
458#ifndef COIN_USE_CBC
459  case DUALTOLERANCE:
460    value=model->dualTolerance();
461    break;
462  case PRIMALTOLERANCE:
463    value=model->primalTolerance();
464    break;
465#endif
466  case DUALBOUND:
467    value=model->dualBound();
468    break;
469  case PRIMALWEIGHT:
470    value=model->infeasibilityCost();
471    break;
472#ifndef COIN_USE_CBC
473  case TIMELIMIT:
474    value=model->maximumSeconds();
475    break;
476#endif
477  case OBJSCALE:
478    value=model->objectiveScale();
479    break;
480  case RHSSCALE:
481    value=model->rhsScale();
482    break;
483  default:
484    abort();
485  }
486  return value;
487}
488int 
489CbcOrClpParam::setIntParameter (ClpSimplex * model,int value) 
490{
491  int oldValue = intParameter(model);
492  if (value<lowerIntValue_||value>upperIntValue_) {
493    std::cout<<value<<" was provided for "<<name_<<
494      " - valid range is "<<lowerIntValue_<<" to "<<
495      upperIntValue_<<std::endl;
496    return 1;
497  } else {
498    std::cout<<name_<<" was changed from "<<oldValue<<" to "
499             <<value<<std::endl;
500    switch(type_) {
501    case SOLVERLOGLEVEL:
502      model->setLogLevel(value);
503      if (value>2)
504        model->factorization()->messageLevel(8);
505      else
506        model->factorization()->messageLevel(0);
507      break;
508    case MAXFACTOR:
509      model->factorization()->maximumPivots(value);
510      break;
511    case PERTVALUE:
512      model->setPerturbation(value);
513      break;
514    case MAXITERATION:
515      model->setMaximumIterations(value);
516      break;
517    case SPECIALOPTIONS:
518      model->setSpecialOptions(value);
519      break;
520    default:
521      abort();
522    }
523    return 0;
524  }
525}
526int 
527CbcOrClpParam::intParameter (ClpSimplex * model) const
528{
529  int value;
530  switch(type_) {
531#ifndef COIN_USE_CBC
532  case SOLVERLOGLEVEL:
533    value=model->logLevel();
534    break;
535#endif
536  case MAXFACTOR:
537    value=model->factorization()->maximumPivots();
538    break;
539    break;
540  case PERTVALUE:
541    value=model->perturbation();
542    break;
543  case MAXITERATION:
544    value=model->maximumIterations();
545    break;
546  case SPECIALOPTIONS:
547    value=model->specialOptions();
548    break;
549  default:
550    value=-1;
551    break;
552  }
553  return value;
554}
555#endif
556int
557CbcOrClpParam::checkDoubleParameter (double value) const
558{
559  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
560    std::cout<<value<<" was provided for "<<name_<<
561      " - valid range is "<<lowerDoubleValue_<<" to "<<
562      upperDoubleValue_<<std::endl;
563    return 1;
564  } else {
565    return 0;
566  }
567}
568#ifdef COIN_USE_CBC
569double 
570CbcOrClpParam::doubleParameter (OsiSolverInterface * model) const
571{
572  double value;
573  switch(type_) {
574  case DUALTOLERANCE:
575    assert(model->getDblParam(OsiDualTolerance,value));
576    break;
577  case PRIMALTOLERANCE:
578    assert(model->getDblParam(OsiPrimalTolerance,value));
579    break;
580  default:
581    abort();
582  }
583  return value;
584}
585int 
586CbcOrClpParam::setIntParameter (OsiSolverInterface * model,int value) 
587{
588  if (value<lowerIntValue_||value>upperIntValue_) {
589    std::cout<<value<<" was provided for "<<name_<<
590      " - valid range is "<<lowerIntValue_<<" to "<<
591      upperIntValue_<<std::endl;
592    return 1;
593  } else {
594    int oldValue;
595    switch(type_) {
596    case SOLVERLOGLEVEL:
597      model->messageHandler()->setLogLevel(value);
598      break;
599    default:
600      oldValue=0; // to avoid compiler message
601      abort();
602    }
603    std::cout<<name_<<" was changed from "<<oldValue<<" to "
604             <<value<<std::endl;
605    return 0;
606  }
607}
608int 
609CbcOrClpParam::intParameter (OsiSolverInterface * model) const
610{
611  int value=0;
612  switch(type_) {
613  case SOLVERLOGLEVEL:
614    value=model->messageHandler()->logLevel();
615    break;
616  default:
617    abort();
618  }
619  return value;
620}
621int
622CbcOrClpParam::setDoubleParameter (CbcModel &model,double value) 
623{
624  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
625    std::cout<<value<<" was provided for "<<name_<<
626      " - valid range is "<<lowerDoubleValue_<<" to "<<
627      upperDoubleValue_<<std::endl;
628    return 1;
629  } else {
630    double oldValue;
631    setDoubleValue(value);
632    switch(type_) {
633    case INFEASIBILITYWEIGHT:
634      oldValue=model.getDblParam(CbcModel::CbcInfeasibilityWeight);
635      model.setDblParam(CbcModel::CbcInfeasibilityWeight,value);
636      break;
637    case INTEGERTOLERANCE:
638      oldValue=model.getDblParam(CbcModel::CbcIntegerTolerance);
639      model.setDblParam(CbcModel::CbcIntegerTolerance,value);
640      break;
641    case INCREMENT:
642      oldValue=model.getDblParam(CbcModel::CbcCutoffIncrement);
643      model.setDblParam(CbcModel::CbcCutoffIncrement,value);
644    case ALLOWABLEGAP:
645      oldValue=model.getDblParam(CbcModel::CbcAllowableGap);
646      model.setDblParam(CbcModel::CbcAllowableGap,value);
647      break;
648    case CUTOFF:
649      oldValue=model.getCutoff();
650      model.setCutoff(value);
651      break;
652    case TIMELIMIT_BAB:
653      oldValue = model.getDblParam(CbcModel::CbcMaximumSeconds) ;
654      model.setDblParam(CbcModel::CbcMaximumSeconds,value) ;
655      break ;
656    case DUALTOLERANCE:
657    case PRIMALTOLERANCE:
658      setDoubleParameter(model.solver(),value);
659      return 0; // to avoid message
660    default:
661      oldValue=0.0; // to avoid compiler message
662      break;
663    }
664    std::cout<<name_<<" was changed from "<<oldValue<<" to "
665             <<value<<std::endl;
666    return 0;
667  }
668}
669double 
670CbcOrClpParam::doubleParameter (CbcModel &model) const
671{
672  double value;
673  switch(type_) {
674  case INFEASIBILITYWEIGHT:
675    value=model.getDblParam(CbcModel::CbcInfeasibilityWeight);
676    break;
677  case INTEGERTOLERANCE:
678    value=model.getDblParam(CbcModel::CbcIntegerTolerance);
679    break;
680  case INCREMENT:
681    value=model.getDblParam(CbcModel::CbcCutoffIncrement);
682  case ALLOWABLEGAP:
683    value=model.getDblParam(CbcModel::CbcAllowableGap);
684    break;
685  case CUTOFF:
686    value=model.getCutoff();
687    break;
688  case TIMELIMIT_BAB:
689    value = model.getDblParam(CbcModel::CbcMaximumSeconds) ;
690    break ;
691  case DUALTOLERANCE:
692  case PRIMALTOLERANCE:
693    value=doubleParameter(model.solver());
694    break;
695  default:
696    abort();
697  }
698  return value;
699}
700int 
701CbcOrClpParam::setIntParameter (CbcModel &model,int value) 
702{
703  if (value<lowerIntValue_||value>upperIntValue_) {
704    std::cout<<value<<" was provided for "<<name_<<
705      " - valid range is "<<lowerIntValue_<<" to "<<
706      upperIntValue_<<std::endl;
707    return 1;
708  } else {
709    setIntValue(value);
710    int oldValue;
711    switch(type_) {
712    case LOGLEVEL:
713      oldValue = model.messageHandler()->logLevel();
714      model.messageHandler()->setLogLevel(value);
715      break;
716    case SOLVERLOGLEVEL:
717      oldValue = model.solver()->messageHandler()->logLevel();
718      model.solver()->messageHandler()->setLogLevel(value);
719      break;
720    case MAXNODES:
721      oldValue=model.getIntParam(CbcModel::CbcMaxNumNode);
722      model.setIntParam(CbcModel::CbcMaxNumNode,value);
723      break;
724    case STRONGBRANCHING:
725      oldValue=model.numberStrong();
726      model.setNumberStrong(value);
727      break;
728    case NUMBERBEFORE:
729      oldValue=model.numberBeforeTrust();
730      model.setNumberBeforeTrust(value);
731      break;
732    default:
733      oldValue=0; // to avoid compiler message
734      break;
735    }
736    std::cout<<name_<<" was changed from "<<oldValue<<" to "
737             <<value<<std::endl;
738    return 0;
739  }
740}
741int 
742CbcOrClpParam::intParameter (CbcModel &model) const
743{
744  int value;
745  switch(type_) {
746  case LOGLEVEL:
747    value = model.messageHandler()->logLevel();
748      break;
749  case SOLVERLOGLEVEL:
750    value = model.solver()->messageHandler()->logLevel();
751      break;
752  case MAXNODES:
753    value = model.getIntParam(CbcModel::CbcMaxNumNode);
754    break;
755  case STRONGBRANCHING:
756    value=model.numberStrong();
757    break;
758  case NUMBERBEFORE:
759    value=model.numberBeforeTrust();
760    break;
761  default:
762    abort();
763  }
764  return value;
765}
766#endif
767// Sets current parameter option using string
768void 
769CbcOrClpParam::setCurrentOption ( const std::string value )
770{
771  int action = parameterOption(value);
772  if (action>=0)
773    currentKeyWord_=action;
774}
775void 
776CbcOrClpParam::setIntValue ( int value )
777{ 
778  if (value<lowerIntValue_||value>upperIntValue_) {
779    std::cout<<value<<" was provided for "<<name_<<
780      " - valid range is "<<lowerIntValue_<<" to "<<
781      upperIntValue_<<std::endl;
782  } else {
783    intValue_=value;
784  }
785}
786void 
787CbcOrClpParam::setDoubleValue ( double value )
788{ 
789  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
790    std::cout<<value<<" was provided for "<<name_<<
791      " - valid range is "<<lowerDoubleValue_<<" to "<<
792      upperDoubleValue_<<std::endl;
793  } else {
794    doubleValue_=value;
795  }
796}
797void 
798CbcOrClpParam::setStringValue ( std::string value )
799{ 
800  stringValue_=value;
801}
802static char line[1000];
803static char * where=NULL;
804extern int CbcOrClpRead_mode;
805extern FILE * CbcOrClpReadCommand;
806// Simple read stuff
807std::string
808CoinReadNextField()
809{
810  std::string field;
811  if (!where) {
812    // need new line
813#ifdef COIN_USE_READLINE     
814    if (CbcOrClpReadCommand==stdin) {
815      // Get a line from the user.
816      where = readline (coin_prompt);
817     
818      // If the line has any text in it, save it on the history.
819      if (where) {
820        if ( *where)
821          add_history (where);
822        strcpy(line,where);
823        free(where);
824      }
825    } else {
826      where = fgets(line,1000,CbcOrClpReadCommand);
827    }
828#else
829    if (CbcOrClpReadCommand==stdin) {
830      fprintf(stdout,coin_prompt);
831      fflush(stdout);
832    }
833    where = fgets(line,1000,CbcOrClpReadCommand);
834#endif
835    if (!where)
836      return field; // EOF
837    where = line;
838    // clean image
839    char * lastNonBlank = line-1;
840    while ( *where != '\0' ) {
841      if ( *where != '\t' && *where < ' ' ) {
842        break;
843      } else if ( *where != '\t' && *where != ' ') {
844        lastNonBlank = where;
845      }
846      where++;
847    }
848    where=line;
849    *(lastNonBlank+1)='\0';
850  }
851  // munch white space
852  while(*where==' '||*where=='\t')
853    where++;
854  char * saveWhere = where;
855  while (*where!=' '&&*where!='\t'&&*where!='\0')
856    where++;
857  if (where!=saveWhere) {
858    char save = *where;
859    *where='\0';
860    //convert to string
861    field=saveWhere;
862    *where=save;
863  } else {
864    where=NULL;
865    field="EOL";
866  }
867  return field;
868}
869
870std::string
871CoinReadGetCommand(int argc, const char *argv[])
872{
873  std::string field="EOL";
874  while (field=="EOL") {
875    if (CbcOrClpRead_mode>0) {
876      if (CbcOrClpRead_mode<argc) {
877        field = argv[CbcOrClpRead_mode++];
878        if (field=="-") {
879          std::cout<<"Switching to line mode"<<std::endl;
880          CbcOrClpRead_mode=-1;
881          field=CoinReadNextField();
882        } else if (field[0]!='-') {
883          if (CbcOrClpRead_mode!=2) {
884            std::cout<<"skipping non-command "<<field<<std::endl;
885            field="EOL"; // skip
886          } else {
887            // special dispensation - taken as -import name
888            CbcOrClpRead_mode--;
889            field="import";
890          }
891        } else {
892          if (field!="--") {
893            // take off -
894            field = field.substr(1);
895          } else {
896            // special dispensation - taken as -import --
897            CbcOrClpRead_mode--;
898            field="import";
899          }
900        }
901      } else {
902        field="";
903      }
904    } else {
905      field=CoinReadNextField();
906    }
907  }
908  //std::cout<<field<<std::endl;
909  return field;
910}
911std::string
912CoinReadGetString(int argc, const char *argv[])
913{
914  std::string field="EOL";
915  if (CbcOrClpRead_mode>0) {
916    if (CbcOrClpRead_mode<argc) {
917      if (argv[CbcOrClpRead_mode][0]!='-') { 
918        field = argv[CbcOrClpRead_mode++];
919      } else if (!strcmp(argv[CbcOrClpRead_mode],"--")) {
920        field = argv[CbcOrClpRead_mode++];
921        // -- means import from stdin
922        field = "-";
923      }
924    }
925  } else {
926    field=CoinReadNextField();
927  }
928  //std::cout<<field<<std::endl;
929  return field;
930}
931// valid 0 - okay, 1 bad, 2 not there
932int
933CoinReadGetIntField(int argc, const char *argv[],int * valid)
934{
935  std::string field="EOL";
936  if (CbcOrClpRead_mode>0) {
937    if (CbcOrClpRead_mode<argc) {
938      // may be negative value so do not check for -
939      field = argv[CbcOrClpRead_mode++];
940    }
941  } else {
942    field=CoinReadNextField();
943  }
944  int value=0;
945  //std::cout<<field<<std::endl;
946  if (field!="EOL") {
947    // how do I check valid
948    value =  atoi(field.c_str());
949    *valid=0;
950  } else {
951    *valid=2;
952  }
953  return value;
954}
955double
956CoinReadGetDoubleField(int argc, const char *argv[],int * valid)
957{
958  std::string field="EOL";
959  if (CbcOrClpRead_mode>0) {
960    if (CbcOrClpRead_mode<argc) {
961      // may be negative value so do not check for -
962      field = argv[CbcOrClpRead_mode++];
963    }
964  } else {
965    field=CoinReadNextField();
966  }
967  double value=0.0;
968  //std::cout<<field<<std::endl;
969  if (field!="EOL") {
970    // how do I check valid
971    value = atof(field.c_str());
972    *valid=0;
973  } else {
974    *valid=2;
975  }
976  return value;
977}
978/*
979  Subroutine to establish the cbc parameter array. See the description of
980  class CbcOrClpParam for details. Pulled from C..Main() for clarity.
981*/
982void 
983establishParams (int &numberParameters, CbcOrClpParam *const parameters)
984{
985  numberParameters=0;
986  parameters[numberParameters++]=
987    CbcOrClpParam("?","For help",GENERALQUERY,-1,false);
988  parameters[numberParameters++]=
989    CbcOrClpParam("???","For help",FULLGENERALQUERY,-1,false);
990  parameters[numberParameters++]=
991    CbcOrClpParam("-","From stdin",
992                  STDIN,299,false);
993#ifdef COIN_USE_CBC
994    parameters[numberParameters++]=
995      CbcOrClpParam("allow!ableGap","Stop when gap between best possible and \
996best less than this",
997              0.0,1.0e20,ALLOWABLEGAP);
998  parameters[numberParameters-1].setDoubleValue(0.0);
999  parameters[numberParameters-1].setLonghelp
1000    (
1001     "If the gap between best solution and best possible solution is less than this \
1002then the search will be terminated"
1003     ); 
1004#endif
1005#ifdef COIN_USE_CLP
1006  parameters[numberParameters++]=
1007    CbcOrClpParam("allS!lack","Set basis back to all slack and reset solution",
1008                  ALLSLACK,false);
1009  parameters[numberParameters-1].setLonghelp
1010    (
1011     "Useful for playing around"
1012     ); 
1013  parameters[numberParameters++]=
1014    CbcOrClpParam("auto!Scale","Whether to scale objective, rhs and bounds of problem if they look odd",
1015                  "off",AUTOSCALE,0,false);
1016  parameters[numberParameters-1].append("on");
1017  parameters[numberParameters-1].setLonghelp
1018    (
1019     "If you think you may get odd objective values or large equality rows etc then\
1020 it may be worth setting this true.  It is still experimental and you may prefer\
1021 to use objective!Scale and rhs!Scale"
1022     ); 
1023  parameters[numberParameters++]=
1024    CbcOrClpParam("barr!ier","Solve using primal dual predictor corrector algorithm",
1025                  BARRIER);
1026  parameters[numberParameters-1].setLonghelp
1027    (
1028     "This command solves the current model using the  primal dual predictor \
1029corrector algorithm."
1030     
1031     ); 
1032  parameters[numberParameters++]=
1033    CbcOrClpParam("basisI!n","Import basis from bas file",
1034                  BASISIN);
1035  parameters[numberParameters-1].setLonghelp
1036    (
1037     "This will read an MPS format basis file from the given file name.  It will use the default\
1038 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1039 is initialized to '', i.e. it must be set.  If you have libgz then it can read compressed\
1040 files 'xxxxxxxx.gz'.."
1041     ); 
1042  parameters[numberParameters++]=
1043    CbcOrClpParam("basisO!ut","Export basis as bas file",
1044                  BASISOUT);
1045  parameters[numberParameters-1].setLonghelp
1046    (
1047     "This will write an MPS format basis file to the given file name.  It will use the default\
1048 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1049 is initialized to 'default.bas'."
1050     ); 
1051  parameters[numberParameters++]=
1052    CbcOrClpParam("biasLU","Whether factorization biased towards U",
1053                  "UU",BIASLU,2,false);
1054  parameters[numberParameters-1].append("UX");
1055  parameters[numberParameters-1].append("LX");
1056  parameters[numberParameters-1].append("LL");
1057#endif
1058#ifdef COIN_USE_CBC
1059  parameters[numberParameters++]=
1060    CbcOrClpParam("branch!AndCut","Do Branch and Cut",
1061                  BAB);
1062  parameters[numberParameters-1].setLonghelp
1063    (
1064     "This does branch and cut.  Far too many parameters apply to give a full description here.  \
1065the main thing is to think about which cuts to apply.  .. expand ..."
1066     ); 
1067#endif
1068  parameters[numberParameters++]=
1069    CbcOrClpParam("bscale","Whether to scale in barrier",
1070                  "off",BARRIERSCALE,0,false);
1071  parameters[numberParameters-1].append("on");
1072  parameters[numberParameters++]=
1073    CbcOrClpParam("chol!esky","Which cholesky algorithm",
1074                  "native",CHOLESKY,false);
1075  parameters[numberParameters-1].append("dense");
1076  //#ifdef FOREIGN_BARRIER
1077#ifdef WSSMP_BARRIER
1078  parameters[numberParameters-1].append("fudge!Long");
1079  parameters[numberParameters-1].append("wssmp");
1080#define REAL_BARRIER
1081#else
1082  parameters[numberParameters-1].append("fudge!Long_dummy");
1083  parameters[numberParameters-1].append("wssmp_dummy");
1084#endif
1085#ifdef UFL_BARRIER
1086  parameters[numberParameters-1].append("Uni!versityOfFlorida");
1087#define REAL_BARRIER
1088#else
1089  parameters[numberParameters-1].append("Uni!versityOfFlorida_dummy");
1090#endif
1091#ifdef TAUCS_BARRIER
1092  parameters[numberParameters-1].append("Taucs");
1093#define REAL_BARRIER
1094#else
1095  parameters[numberParameters-1].append("Taucs_dummy");
1096#endif
1097  //#endif
1098#ifdef COIN_USE_CBC
1099  parameters[numberParameters++]=
1100    CbcOrClpParam("clique!Cuts","Whether to use Clique cuts",
1101                  "off",CLIQUECUTS);
1102  parameters[numberParameters-1].append("on");
1103  parameters[numberParameters-1].append("root");
1104  parameters[numberParameters-1].setLonghelp
1105    (
1106     "This switches on clique cuts (either at roor or in entire tree)"
1107     ); 
1108  parameters[numberParameters++]=
1109    CbcOrClpParam("cost!Strategy","How to use costs",
1110                  "off",COSTSTRATEGY);
1111  parameters[numberParameters-1].append("pri!orities");
1112  parameters[numberParameters-1].append("pseudo!costs(not implemented yet)");
1113  parameters[numberParameters-1].setLonghelp
1114    (
1115     "This orders the variables in order of their absolute costs - with largest cost ones being branched on first"
1116     ); 
1117#endif
1118#ifdef COIN_USE_CLP
1119  parameters[numberParameters++]=
1120    CbcOrClpParam("crash","Whether to create basis for problem",
1121                  "off",CRASH);
1122  parameters[numberParameters-1].append("on");
1123  parameters[numberParameters-1].append("so!low_halim");
1124  parameters[numberParameters-1].append("ha!lim_solow(JJF mods)");
1125  parameters[numberParameters-1].append("4");
1126  parameters[numberParameters-1].append("5");
1127  parameters[numberParameters-1].setLonghelp
1128    (
1129     "If crash is set on and there is an all slack basis then Clp will flip or put structural\
1130 variables into basis with the aim of getting dual feasible.  On the whole dual seems to be\
1131 better without it and there alernative types of 'crash' for primal e.g. 'idiot' or 'sprint'. \
1132I have also added a variant due to Solow and Halim which is as on but just flip."); 
1133  parameters[numberParameters++]=
1134    CbcOrClpParam("cross!over","Whether to get a basic solution after barrier",
1135                  "on",CROSSOVER);
1136  parameters[numberParameters-1].append("off");
1137  parameters[numberParameters-1].append("maybe");
1138  parameters[numberParameters-1].setLonghelp
1139    (
1140     "Interior point algorithms do not obtain a basic solution (and \
1141the feasibility criterion is a bit suspect (JJF)).  This option will crossover \
1142to a basic solution suitable for ranging or branch and cut.  With the current state \
1143of quadratic it may be a good idea to switch off crossover for quadratic (and maybe \
1144presolve as well) - the option maybe does this."
1145     );
1146#endif
1147#ifdef COIN_USE_CBC
1148  parameters[numberParameters++]=
1149    CbcOrClpParam("cutD!epth","Depth in tree at which to do cuts",
1150                  -1,999999,CUTDEPTH);
1151  parameters[numberParameters-1].setLonghelp
1152    (
1153     "Cut generators may be - off, on only at root, on if they look possible \
1154and on.  If they are done every node then that is that, but it may be worth doing them \
1155every so often.  The original method was every so many node but it may be more logical \
1156to do it whenever depth in tree is a multiple of K.  This option does that and defaults \
1157to -1 (off)."
1158     );
1159  parameters[numberParameters-1].setIntValue(-1);
1160  parameters[numberParameters++]=
1161    CbcOrClpParam("cuto!ff","All solutions must be better than this",
1162                  -1.0e60,1.0e60,CUTOFF);
1163  parameters[numberParameters-1].setDoubleValue(1.0e50);
1164  parameters[numberParameters-1].setLonghelp
1165    (
1166     "All solutions must be better than this value (in a minimization sense)."
1167     );
1168#endif
1169  parameters[numberParameters++]=
1170    CbcOrClpParam("direction","Minimize or Maximize",
1171                  "min!imize",DIRECTION);
1172  parameters[numberParameters-1].append("max!imize");
1173  parameters[numberParameters-1].append("zero");
1174  parameters[numberParameters-1].setLonghelp
1175    (
1176     "The default is minimize - use 'direction maximize' for maximization.\n\
1177You can also use the parameters 'maximize' or 'minimize'."
1178     ); 
1179  parameters[numberParameters++]=
1180    CbcOrClpParam("directory","Set Default directory for import etc.",
1181                  DIRECTORY,299);
1182  parameters[numberParameters-1].setLonghelp
1183    (
1184     "This sets the directory which import, export, saveModel and restoreModel will use.\
1185  It is initialized to './'"
1186     ); 
1187#ifdef COIN_USE_CLP
1188  parameters[numberParameters++]=
1189    CbcOrClpParam("dualB!ound","Initially algorithm acts as if no \
1190gap between bounds exceeds this value",
1191                  1.0e-20,1.0e12,DUALBOUND);
1192  parameters[numberParameters-1].setLonghelp
1193    (
1194     "The dual algorithm in Clp is a single phase algorithm as opposed to a two phase\
1195 algorithm where you first get feasible then optimal.  If a problem has both upper and\
1196 lower bounds then it is trivial to get dual feasible by setting non basic variables\
1197 to correct bound.  If the gap between the upper and lower bounds of a variable is more\
1198 than the value of dualBound Clp introduces fake bounds so that it can make the problem\
1199 dual feasible.  This has the same effect as a composite objective function in the\
1200 primal algorithm.  Too high a value may mean more iterations, while too low a bound means\
1201 the code may go all the way and then have to increase the bounds.  OSL had a heuristic to\
1202 adjust bounds, maybe we need that here."
1203     );
1204  parameters[numberParameters++]=
1205    CbcOrClpParam("dualize","Solves dual reformulation",
1206                  0,1,DUALIZE,false);
1207  parameters[numberParameters-1].setLonghelp
1208    (
1209     "Don't even think about it."
1210     ); 
1211  parameters[numberParameters++]=
1212    CbcOrClpParam("dualP!ivot","Dual pivot choice algorithm",
1213                  "auto!matic",DUALPIVOT);
1214  parameters[numberParameters-1].append("dant!zig");
1215  parameters[numberParameters-1].append("partial");
1216  parameters[numberParameters-1].append("steep!est");
1217  parameters[numberParameters-1].setLonghelp
1218    (
1219     "Clp can use any pivot selection algorithm which the user codes as long as it\
1220 implements the features in the abstract pivot base class.  The Dantzig method is implemented\
1221 to show a simple method but its use is deprecated.  Steepest is the method of choice and there\
1222 are two variants which keep all weights updated but only scan a subset each iteration.\
1223 Partial switches this on while automatic decides at each iteration based on information\
1224 about the factorization."
1225     ); 
1226  parameters[numberParameters++]=
1227    CbcOrClpParam("dualS!implex","Do dual simplex algorithm",
1228                  DUALSIMPLEX);
1229  parameters[numberParameters-1].setLonghelp
1230    (
1231     "This command solves the current model using the dual steepest algorithm.\
1232The time and iterations may be affected by settings such as presolve, scaling, crash\
1233 and also by dual pivot method, fake bound on variables and dual and primal tolerances."
1234     );
1235#endif
1236  parameters[numberParameters++]=
1237    CbcOrClpParam("dualT!olerance","For an optimal solution \
1238no dual infeasibility may exceed this value",
1239                  1.0e-20,1.0e12,DUALTOLERANCE);
1240  parameters[numberParameters-1].setLonghelp
1241    (
1242     "Normally the default tolerance is fine, but you may want to increase it a\
1243 bit if a dual run seems to be having a hard time"
1244     ); 
1245#ifdef COIN_USE_CLP
1246  parameters[numberParameters++]=
1247    CbcOrClpParam("either!Simplex","Do dual or primal simplex algorithm",
1248                  EITHERSIMPLEX);
1249  parameters[numberParameters-1].setLonghelp
1250    (
1251     "This command solves the current model using the dual or primal algorithm,\
1252 based on a dubious analysis of model."
1253     );
1254#endif
1255  parameters[numberParameters++]=
1256    CbcOrClpParam("end","Stops clp execution",
1257                  EXIT);
1258  parameters[numberParameters-1].setLonghelp
1259    (
1260     "This stops execution ; end, exit, quit and stop are synonyms"
1261     ); 
1262  parameters[numberParameters++]=
1263    CbcOrClpParam("error!sAllowed","Whether to allow import errors",
1264                  "off",ERRORSALLOWED);
1265  parameters[numberParameters-1].append("on");
1266  parameters[numberParameters-1].setLonghelp
1267    (
1268     "The default is not to use any model which had errors when reading the mps file.\
1269  Setting this to 'on' will allow all errors from which the code can recover\
1270 by ignoring the error."
1271     );
1272  parameters[numberParameters++]=
1273    CbcOrClpParam("exit","Stops clp execution",
1274                  EXIT);
1275  parameters[numberParameters-1].setLonghelp
1276    (
1277     "This stops the execution of Clp, end, exit, quit and stop are synonyms"
1278     ); 
1279  parameters[numberParameters++]=
1280    CbcOrClpParam("export","Export model as mps file",
1281                  EXPORT);
1282  parameters[numberParameters-1].setLonghelp
1283    (
1284     "This will write an MPS format file to the given file name.  It will use the default\
1285 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1286 is initialized to 'default.mps'."
1287     ); 
1288#ifdef COIN_USE_CLP
1289  parameters[numberParameters++]=
1290    CbcOrClpParam("fakeB!ound","All bounds <= this value - DEBUG",
1291                  1.0,1.0e15,FAKEBOUND,false);
1292#ifdef COIN_USE_CBC
1293  parameters[numberParameters++]=
1294    CbcOrClpParam("fix!OnDj","Try heuristic based on fixing variables with \
1295reduced costs greater than this",
1296                  -1.0e20,1.0e20,DJFIX,false);
1297  parameters[numberParameters-1].setLonghelp
1298    (
1299     "If this is set integer variables with reduced costs greater than this will be fixed \
1300before branch and bound - use with extreme caution!" 
1301     ); 
1302    parameters[numberParameters++]=
1303      CbcOrClpParam("flow!CoverCuts","Whether to use Flow Cover cuts",
1304                    "off",FLOWCUTS);
1305    parameters[numberParameters-1].append("on");
1306    parameters[numberParameters-1].append("root");
1307  parameters[numberParameters-1].setLonghelp
1308    (
1309     "This switches on flow cover cuts (either at roor or in entire tree)"
1310     ); 
1311#endif
1312  parameters[numberParameters++]=
1313    CbcOrClpParam("gamma","Whether to regularize barrier",
1314                  "off",GAMMA,0,false);
1315  parameters[numberParameters-1].append("on");
1316#endif
1317#ifdef COIN_USE_CBC
1318  parameters[numberParameters++]=
1319    CbcOrClpParam("gap!Ratio","Stop when gap between best possible and \
1320best less than this fraction of larger of two",
1321                  0.0,1.0e20,GAPRATIO);
1322  parameters[numberParameters-1].setDoubleValue(0.0);
1323  parameters[numberParameters-1].setLonghelp
1324    (
1325     "If the gap between best solution and best possible solution is less than this fraction \
1326of the objective value at the root node then the search will terminate"
1327     ); 
1328  parameters[numberParameters++]=
1329    CbcOrClpParam("gomory!Cuts","Whether to use Gomory cuts",
1330                  "off",GOMORYCUTS);
1331  parameters[numberParameters-1].append("on");
1332  parameters[numberParameters-1].append("root");
1333  parameters[numberParameters-1].setLonghelp
1334    (
1335     "The original cuts - beware of imitations!  Having gone out of favo(u)r, they are now more \
1336fashionable as LP solvers are more robust and they interact well with other cuts.  They will almost always \
1337give cuts (although in this executable they are limited as to number of variables in cut)."
1338     ); 
1339#endif
1340  parameters[numberParameters++]=
1341    CbcOrClpParam("help","Print out version, non-standard options and some help",
1342                  HELP);
1343#ifdef COIN_USE_CLP
1344  parameters[numberParameters++]=
1345    CbcOrClpParam("idiot!Crash","Whether to try idiot crash",
1346                  -1,999999,IDIOT);
1347  parameters[numberParameters-1].setLonghelp
1348    (
1349     "This is a type of 'crash' which works well on some homogeneous problems.\
1350 It works best on problems with unit elements and rhs but will do something to any model.  It should only be\
1351 used before primal.  It can be set to -1 when the code decides for itself whether to use it,\
1352 0 to switch off or n > 0 to do n passes."
1353     ); 
1354#endif
1355  parameters[numberParameters++]=
1356    CbcOrClpParam("import","Import model from mps file",
1357                  IMPORT);
1358  parameters[numberParameters-1].setLonghelp
1359    (
1360     "This will read an MPS format file from the given file name.  It will use the default\
1361 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1362 is initialized to '', i.e. it must be set.  If you have libgz then it can read compressed\
1363 files 'xxxxxxxx.gz'.."
1364     );
1365#ifdef COIN_USE_CBC
1366  parameters[numberParameters++]=
1367    CbcOrClpParam("inc!rement","A valid solution must be at least this \
1368much better than last integer solution",
1369                  -1.0e20,1.0e20,INCREMENT);
1370  parameters[numberParameters-1].setLonghelp
1371    (
1372     "Whenever a solution is found the bound on solutions is set to solution (in a minimization\
1373sense) plus this.  Becareful if you set this negative"
1374     ); 
1375  parameters[numberParameters++]=
1376    CbcOrClpParam("inf!easibilityWeight","Each integer infeasibility is expected \
1377to cost this much",
1378                  0.0,1.0e20,INFEASIBILITYWEIGHT);
1379  parameters[numberParameters-1].setLonghelp
1380    (
1381     "A crude way of deciding which node to explore next.  Satisfying each integer infeasibility is \
1382expected to cost this much."
1383     ); 
1384  parameters[numberParameters++]=
1385    CbcOrClpParam("initialS!olve","Solve to continuous",
1386                  SOLVECONTINUOUS);
1387  parameters[numberParameters-1].setLonghelp
1388    (
1389     "This just solves the problem to continuous - without adding any cuts"
1390     ); 
1391  parameters[numberParameters++]=
1392    CbcOrClpParam("integerT!olerance","For an optimal solution \
1393no integer variable may be this away from an integer value",
1394              1.0e-20,0.5,INTEGERTOLERANCE);
1395  parameters[numberParameters-1].setLonghelp
1396    (
1397     "The short help says it all"
1398     ); 
1399#endif
1400#ifdef COIN_USE_CLP
1401  parameters[numberParameters++]=
1402    CbcOrClpParam("keepN!ames","Whether to keep names from import",
1403                  "on",KEEPNAMES);
1404  parameters[numberParameters-1].append("off");
1405  parameters[numberParameters-1].setLonghelp
1406    (
1407     "It saves space to get rid of names so if you need to you can set this to off."
1408     ); 
1409  parameters[numberParameters++]=
1410    CbcOrClpParam("KKT","Whether to use KKT factorization",
1411                  "off",KKT,0,false);
1412  parameters[numberParameters-1].append("on");
1413#endif
1414#ifdef COIN_USE_CBC
1415  parameters[numberParameters++]=
1416    CbcOrClpParam("knapsack!Cuts","Whether to use Knapsack cuts",
1417                  "off",KNAPSACKCUTS);
1418  parameters[numberParameters-1].append("on");
1419  parameters[numberParameters-1].append("root");
1420  parameters[numberParameters-1].setLonghelp
1421    (
1422     "This switches on knapsack cuts (either at roor or in entire tree)"
1423     ); 
1424#endif
1425#ifndef COIN_USE_CBC
1426  parameters[numberParameters++]=
1427    CbcOrClpParam("log!Level","Level of detail in Solver output",
1428                  -1,63,SOLVERLOGLEVEL);
1429#else
1430  parameters[numberParameters++]=
1431    CbcOrClpParam("log!Level","Level of detail in Coin branch and Cut output",
1432                  -1,63,LOGLEVEL);
1433  parameters[numberParameters-1].setIntValue(1);
1434#endif
1435  parameters[numberParameters-1].setLonghelp
1436    (
1437     "If 0 then there should be no output in normal circumstances.  1 is probably the best\
1438 value for most uses, while 2 and 3 give more information."
1439     ); 
1440  parameters[numberParameters++]=
1441    CbcOrClpParam("max!imize","Set optimization direction to maximize",
1442                  MAXIMIZE,299);
1443  parameters[numberParameters-1].setLonghelp
1444    (
1445     "The default is minimize - use 'maximize' for maximization.\n\
1446You can also use the parameters 'direction maximize'."
1447     ); 
1448#ifdef COIN_USE_CLP
1449  parameters[numberParameters++]=
1450    CbcOrClpParam("maxF!actor","Maximum number of iterations between \
1451refactorizations",
1452                  1,999999,MAXFACTOR);
1453  parameters[numberParameters-1].setLonghelp
1454    (
1455     "If this is at its initial value of 201 then in this executable clp will guess at a\
1456 value to use.  Otherwise the user can set a value.  The code may decide to re-factorize\
1457 earlier."
1458     ); 
1459  parameters[numberParameters++]=
1460    CbcOrClpParam("maxIt!erations","Maximum number of iterations before \
1461stopping",
1462                  0,99999999,MAXITERATION);
1463  parameters[numberParameters-1].setLonghelp
1464    (
1465     "This can be used for testing purposes.  The corresponding library call\n\
1466      \tsetMaximumIterations(value)\n can be useful.  If the code stops on\
1467 seconds or by an interrupt this will be treated as stopping on maximum iterations"
1468     ); 
1469#endif
1470#ifdef COIN_USE_CBC
1471  parameters[numberParameters++]=
1472    CbcOrClpParam("maxN!odes","Maximum number of nodes to do",
1473                  1,99999999,MAXNODES);
1474  parameters[numberParameters-1].setLonghelp
1475    (
1476     "This is a repeatable way to limit search.  Normally using time is easier \
1477but then the results may not be repeatable."
1478     ); 
1479#endif
1480  parameters[numberParameters++]=
1481    CbcOrClpParam("min!imize","Set optimization direction to minimize",
1482                  MINIMIZE,299);
1483  parameters[numberParameters-1].setLonghelp
1484    (
1485     "The default is minimize - use 'maximize' for maximization.\n\
1486This should only be necessary if you have previously set maximization \
1487You can also use the parameters 'direction minimize'."
1488     );
1489#ifdef COIN_USE_CBC
1490  parameters[numberParameters++]=
1491    CbcOrClpParam("mixed!IntegerRoundingCuts","Whether to use Mixed Integer Rounding cuts",
1492                  "off",MIXEDCUTS);
1493  parameters[numberParameters-1].append("on");
1494  parameters[numberParameters-1].append("root");
1495  parameters[numberParameters-1].setLonghelp
1496    (
1497     "This switches on mixed integer rounding cuts (either at roor or in entire tree)"
1498     ); 
1499#endif
1500  parameters[numberParameters++]=
1501    CbcOrClpParam("mess!ages","Controls if Clpnnnn is printed",
1502                  "off",MESSAGES);
1503  parameters[numberParameters-1].append("on");
1504  parameters[numberParameters-1].setLonghelp
1505    ("The default for the Clp library is to put out messages such as:\n\
1506   Clp0005 2261  Objective 109.024 Primal infeas 944413 (758)\n\
1507but this program turns this off to make it look more friendly.  It can be useful\
1508 to turn them back on if you want to be able 'grep' for particular messages or if\
1509 you intend to override the behavior of a particular message."
1510     );
1511#ifdef COIN_USE_CBC
1512  parameters[numberParameters++]=
1513    CbcOrClpParam("miplib","Do some of miplib test set",
1514                  MIPLIB);
1515#endif
1516#ifdef COIN_USE_CLP
1517  parameters[numberParameters++]=
1518    CbcOrClpParam("netlib","Solve entire netlib test set",
1519                  NETLIB_EITHER);
1520  parameters[numberParameters-1].setLonghelp
1521    (
1522     "This exercises the unit test for clp and then solves the netlib test set using dual or primal.\
1523The user can set options before e.g. clp -presolve off -netlib"
1524     ); 
1525#ifdef REAL_BARRIER
1526  parameters[numberParameters++]=
1527    CbcOrClpParam("netlibB!arrier","Solve entire netlib test set with barrier",
1528                  NETLIB_BARRIER);
1529  parameters[numberParameters-1].setLonghelp
1530    (
1531     "This exercises the unit test for clp and then solves the netlib test set using barrier.\
1532The user can set options before e.g. clp -kkt on -netlib"
1533     ); 
1534#endif
1535  parameters[numberParameters++]=
1536    CbcOrClpParam("netlibD!ual","Solve entire netlib test set (dual)",
1537                  NETLIB_DUAL);
1538  parameters[numberParameters-1].setLonghelp
1539    (
1540     "This exercises the unit test for clp and then solves the netlib test set using dual.\
1541The user can set options before e.g. clp -presolve off -netlib"
1542     ); 
1543  parameters[numberParameters++]=
1544    CbcOrClpParam("netlibP!rimal","Solve entire netlib test set (primal)",
1545                  NETLIB_PRIMAL);
1546  parameters[numberParameters-1].setLonghelp
1547    (
1548     "This exercises the unit test for clp and then solves the netlib test set using primal.\
1549The user can set options before e.g. clp -presolve off -netlibp"
1550     ); 
1551  parameters[numberParameters++]=
1552    CbcOrClpParam("netlibT!une","Solve entire netlib test set with 'best' algorithm",
1553                  NETLIB_TUNE);
1554  parameters[numberParameters-1].setLonghelp
1555    (
1556     "This exercises the unit test for clp and then solves the netlib test set using whatever \
1557works best.  I know this is cheating but it also stresses the code better by doing a \
1558mixture of stuff.  The best algorithm was chosen on a Linux ThinkPad using native cholesky \
1559with University of Florida ordering."
1560     ); 
1561  parameters[numberParameters++]=
1562    CbcOrClpParam("network","Tries to make network matrix",
1563                  NETWORK,-1,false);
1564  parameters[numberParameters-1].setLonghelp
1565    (
1566     "Clp will go faster if the matrix can be converted to a network.  The matrix\
1567 operations may be a bit faster with more efficient storage, but the main advantage\
1568 comes from using a network factorization.  It will probably not be as fast as a \
1569specialized network code."
1570     ); 
1571  parameters[numberParameters++]=
1572    CbcOrClpParam("objective!Scale","Scale factor to apply to objective",
1573                  -1.0e20,1.0e20,OBJSCALE,false);
1574  parameters[numberParameters-1].setLonghelp
1575    (
1576     "If the objective function has some very large values, you may wish to scale them\
1577 internally by this amount.  It can also be set by autoscale.  It is applied after scaling"
1578     ); 
1579  parameters[numberParameters-1].setDoubleValue(1.0);
1580#endif
1581  parameters[numberParameters++]=
1582    CbcOrClpParam("output!Format","Which output format to use",
1583                  1,6,OUTPUTFORMAT);
1584  parameters[numberParameters-1].setLonghelp
1585    (
1586     "Normally export will be done using normal representation for numbers and two values\
1587 per line.  You may want to do just one per line (for grep or suchlike) and you may wish\
1588 to save with absolute accuracy using a coded version of the IEEE value. A value of 2 is normal.\
1589 otherwise odd values gives one value per line, even two.  Values 1,2 give normal format, 3,4\
1590 gives greater precision, while 5,6 give IEEE values.  When used for exporting a basis 1 does not save \
1591values, 2 saves values, 3 with greater accuracy and 4 in IEEE."
1592     ); 
1593#ifdef COIN_USE_CLP
1594  parameters[numberParameters++]=
1595    CbcOrClpParam("passP!resolve","How many passes in presolve",
1596                  -200,100,PRESOLVEPASS,false);
1597  parameters[numberParameters-1].setLonghelp
1598    (
1599     "Normally Presolve does 5 passes but you may want to do less to make it\
1600 more lightweight or do more if improvements are still being made.  As Presolve will return\
1601 if nothing is being taken out, then you should not need to use this fine tuning."
1602     ); 
1603  parameters[numberParameters++]=
1604    CbcOrClpParam("pertV!alue","Method of perturbation",
1605                  -5000,102,PERTVALUE,false);
1606  parameters[numberParameters++]=
1607    CbcOrClpParam("perturb!ation","Whether to perturb problem",
1608                  "on",PERTURBATION);
1609  parameters[numberParameters-1].append("off");
1610  parameters[numberParameters-1].setLonghelp
1611    (
1612     "Perturbation helps to stop cycling, but Clp uses other measures for this.\
1613  However large problems and especially ones with unit elements and unit rhs or costs\
1614 benefit from perturbation.  Normally Clp tries to be intelligent, but you can switch this off.\
1615  The Clp library has this off by default.  This program has it on."
1616     ); 
1617  parameters[numberParameters++]=
1618    CbcOrClpParam("PFI","Whether to use Product Form of Inverse in simplex",
1619                  "off",PFI,0,false);
1620  parameters[numberParameters-1].append("on");
1621  parameters[numberParameters-1].setLonghelp
1622    (
1623     "By default clp uses Forrest-Tomlin L-U update.  If you are masochistic you can switch it off."
1624     ); 
1625  parameters[numberParameters++]=
1626    CbcOrClpParam("plus!Minus","Tries to make +- 1 matrix",
1627                  PLUSMINUS,-1,false);
1628  parameters[numberParameters-1].setLonghelp
1629    (
1630     "Clp will go slightly faster if the matrix can be converted so that the elements are\
1631 not stored and are known to be unit.  The main advantage is memory use.  Clp may automatically\
1632 see if it can convert the problem so you should not need to use this."
1633     ); 
1634  parameters[numberParameters++]=
1635    CbcOrClpParam("preO!pt","Presolve options",
1636                  0,INT_MAX,PRESOLVEOPTIONS,false);
1637#endif
1638  parameters[numberParameters++]=
1639    CbcOrClpParam("presolve","Whether to presolve problem",
1640                  "on",PRESOLVE);
1641  parameters[numberParameters-1].append("off");
1642  parameters[numberParameters-1].append("more");
1643  parameters[numberParameters-1].append("file");
1644  parameters[numberParameters-1].setLonghelp
1645    (
1646     "Presolve analyzes the model to find such things as redundant equations, equations\
1647 which fix some variables, equations which can be transformed into bounds etc etc.  For the\
1648 initial solve of any problem this is worth doing unless you know that it will have no effect."
1649     ); 
1650#ifdef COIN_USE_CBC
1651  parameters[numberParameters++]=
1652    CbcOrClpParam("preprocess","Whether to use integer preprocessing",
1653                  "off",PREPROCESS);
1654  parameters[numberParameters-1].append("on");
1655  parameters[numberParameters-1].setLonghelp
1656    (
1657     "This tries to reduce size of model in a similar way to presolve and \
1658it also tries to strengthen the model - needs more work but can be useful."
1659     ); 
1660#endif
1661#ifdef COIN_USE_CLP
1662  parameters[numberParameters++]=
1663    CbcOrClpParam("primalP!ivot","Primal pivot choice algorithm",
1664                  "auto!matic",PRIMALPIVOT);
1665  parameters[numberParameters-1].append("exa!ct");
1666  parameters[numberParameters-1].append("dant!zig");
1667  parameters[numberParameters-1].append("part!ial");
1668  parameters[numberParameters-1].append("steep!est");
1669  parameters[numberParameters-1].append("change");
1670  parameters[numberParameters-1].append("sprint");
1671  parameters[numberParameters-1].setLonghelp
1672    (
1673     "Clp can use any pivot selection algorithm which the user codes as long as it\
1674 implements the features in the abstract pivot base class.  The Dantzig method is implemented\
1675 to show a simple method but its use is deprecated.  Exact devex is the method of choice and there\
1676 are two variants which keep all weights updated but only scan a subset each iteration.\
1677 Partial switches this on while change initially does dantzig until the factorization\
1678 becomes denser.  This is still a work in progress."
1679     ); 
1680  parameters[numberParameters++]=
1681    CbcOrClpParam("primalS!implex","Do primal simplex algorithm",
1682                  PRIMALSIMPLEX);
1683  parameters[numberParameters-1].setLonghelp
1684    (
1685     "This command solves the current model using the primal algorithm.\
1686  The default is to use exact devex.\
1687 The time and iterations may be affected by settings such as presolve, scaling, crash\
1688 and also by column selection  method, infeasibility weight and dual and primal tolerances."
1689     );
1690#endif
1691  parameters[numberParameters++]=
1692    CbcOrClpParam("primalT!olerance","For an optimal solution \
1693no primal infeasibility may exceed this value",
1694                  1.0e-20,1.0e12,PRIMALTOLERANCE);
1695  parameters[numberParameters-1].setLonghelp
1696    (
1697     "Normally the default tolerance is fine, but you may want to increase it a\
1698 bit if a primal run seems to be having a hard time"
1699     ); 
1700#ifdef COIN_USE_CLP
1701  parameters[numberParameters++]=
1702    CbcOrClpParam("primalW!eight","Initially algorithm acts as if it \
1703costs this much to be infeasible",
1704                  1.0e-20,1.0e20,PRIMALWEIGHT);
1705  parameters[numberParameters-1].setLonghelp
1706    (
1707     "The primal algorithm in Clp is a single phase algorithm as opposed to a two phase\
1708 algorithm where you first get feasible then optimal.  So Clp is minimizing this weight times\
1709 the sum of primal infeasibilities plus the true objective function (in minimization sense).\
1710  Too high a value may mean more iterations, while too low a bound means\
1711 the code may go all the way and then have to increase the weight in order to get feasible.\
1712  OSL had a heuristic to\
1713 adjust bounds, maybe we need that here."
1714     ); 
1715  parameters[numberParameters++]=
1716    CbcOrClpParam("printO!ptions","Print options",
1717                  0,INT_MAX,PRINTOPTIONS,false);
1718#endif
1719#ifdef COIN_USE_CBC
1720  parameters[numberParameters++]=
1721    CbcOrClpParam("probing!Cuts","Whether to use Probing cuts",
1722                  "off",PROBINGCUTS);
1723  parameters[numberParameters-1].append("on");
1724  parameters[numberParameters-1].append("root");
1725  parameters[numberParameters-1].setLonghelp
1726    (
1727     "This switches on probing cuts (either at roor or in entire tree)"
1728     ); 
1729#endif
1730  parameters[numberParameters++]=
1731    CbcOrClpParam("quit","Stops clp execution",
1732                  EXIT);
1733  parameters[numberParameters-1].setLonghelp
1734    (
1735     "This stops the execution of Clp, end, exit, quit and stop are synonyms"
1736     ); 
1737#ifdef COIN_USE_CLP
1738  parameters[numberParameters++]=
1739    CbcOrClpParam("reallyS!cale","Scales model in place",
1740                  REALLY_SCALE,false);
1741#endif
1742#ifdef COIN_USE_CBC
1743    parameters[numberParameters++]=
1744      CbcOrClpParam("reduce!AndSplitCuts","Whether to use Reduce-and-Split cuts",
1745              "off",REDSPLITCUTS);
1746    parameters[numberParameters-1].append("on");
1747    parameters[numberParameters-1].append("root");
1748  parameters[numberParameters-1].setLonghelp
1749    (
1750     "This switches on reduce and split  cuts (either at roor or in entire tree)"
1751     ); 
1752#endif
1753#ifdef COIN_USE_CLP
1754  parameters[numberParameters++]=
1755    CbcOrClpParam("restore!Model","Restore model from binary file",
1756                  RESTORE);
1757  parameters[numberParameters-1].setLonghelp
1758    (
1759     "This reads data save by saveModel from the given file.  It will use the default\
1760 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1761 is initialized to 'default.prob'."
1762     ); 
1763  parameters[numberParameters++]=
1764    CbcOrClpParam("reverse","Reverses sign of objective",
1765                  REVERSE,false);
1766  parameters[numberParameters-1].setLonghelp
1767    (
1768     "Useful for testing if maximization works correctly"
1769     ); 
1770  parameters[numberParameters++]=
1771    CbcOrClpParam("rhs!Scale","Scale factor to apply to rhs and bounds",
1772                  -1.0e20,1.0e20,RHSSCALE,false);
1773  parameters[numberParameters-1].setLonghelp
1774    (
1775     "If the rhs or bounds have some very large meaningful values, you may wish to scale them\
1776 internally by this amount.  It can also be set by autoscale"
1777     ); 
1778  parameters[numberParameters-1].setDoubleValue(1.0);
1779#endif
1780#ifdef COIN_USE_CBC
1781  parameters[numberParameters++]=
1782    CbcOrClpParam("round!ingHeuristic","Whether to use Rounding heuristic",
1783                  "off",ROUNDING);
1784  parameters[numberParameters-1].append("on");
1785  parameters[numberParameters-1].setLonghelp
1786    (
1787     "This switches on a simple (but effective) rounding heuristic at each node of tree."
1788     ); 
1789#endif
1790  parameters[numberParameters++]=
1791    CbcOrClpParam("save!Model","Save model to binary file",
1792                  SAVE);
1793  parameters[numberParameters-1].setLonghelp
1794    (
1795     "This will save the problem to the given file name for future use\
1796 by restoreModel.  It will use the default\
1797 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1798 is initialized to 'default.prob'."
1799     ); 
1800  parameters[numberParameters++]=
1801    CbcOrClpParam("scal!ing","Whether to scale problem",
1802                  "off",SCALING);
1803  parameters[numberParameters-1].append("equi!librium");
1804  parameters[numberParameters-1].append("geo!metric");
1805  parameters[numberParameters-1].append("auto!matic");
1806  parameters[numberParameters-1].setLonghelp
1807    (
1808     "Scaling can help in solving problems which might otherwise fail because of lack of\
1809 accuracy.  It can also reduce the number of iterations.  It is not applied if the range\
1810 of elements is small.  When unscaled it is possible that there may be small primal and/or\
1811 infeasibilities."
1812     ); 
1813  parameters[numberParameters-1].setCurrentOption(3); // say auto
1814  parameters[numberParameters++]=
1815    CbcOrClpParam("sec!onds","maximum seconds",
1816                  -1.0,1.0e12,TIMELIMIT);
1817  parameters[numberParameters-1].setLonghelp
1818    (
1819     "After this many seconds clp will act as if maximum iterations had been reached.\
1820  In this program it is really only useful for testing but the library function\n\
1821      \tsetMaximumSeconds(value)\n can be useful."
1822     );
1823#ifdef COIN_USE_CBC
1824  parameters[numberParameters++]=
1825    CbcOrClpParam("sec!onds","maximum seconds",
1826                  -1.0,1.0e12,TIMELIMIT_BAB);
1827  parameters[numberParameters-1].setLonghelp
1828    (
1829     "After this many seconds coin solver will act as if maximum nodes had been reached."
1830     );
1831#endif
1832#ifdef COIN_USE_CLP
1833  parameters[numberParameters++]=
1834    CbcOrClpParam("slp!Value","Number of slp passes before primal",
1835                  -1,50000,SLPVALUE,false);
1836#endif
1837  parameters[numberParameters++]=
1838    CbcOrClpParam("solu!tion","Prints solution to file",
1839                  SOLUTION);
1840  parameters[numberParameters-1].setLonghelp
1841    (
1842     "This will write a primitive solution file to the given file name.  It will use the default\
1843 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
1844 is initialized to 'stdout'."
1845     ); 
1846#ifdef COIN_USE_CBC
1847#ifdef COIN_USE_CLP
1848  parameters[numberParameters++]=
1849    CbcOrClpParam("solv!e","Solve problem",
1850                  BAB);
1851  parameters[numberParameters-1].setLonghelp
1852    (
1853     "If there are no integer variables then this just solves LP.  If there are integer variables \
1854this does branch and cut.  Far too many parameters apply to give a full description here.  \
1855the main thing is to think about which cuts to apply.  .. expand ..."
1856     ); 
1857  parameters[numberParameters++]=
1858    CbcOrClpParam("slog!Level","Level of detail in Solver output",
1859                  -1,63,SOLVERLOGLEVEL);
1860  parameters[numberParameters-1].setLonghelp
1861    (
1862     "If 0 then there should be no output in normal circumstances.  1 is probably the best\
1863 value for most uses, while 2 and 3 give more information."
1864     ); 
1865#endif
1866#endif
1867#ifdef COIN_USE_CLP
1868  parameters[numberParameters++]=
1869    CbcOrClpParam("spars!eFactor","Whether factorization treated as sparse",
1870                  "on",SPARSEFACTOR,0,false);
1871  parameters[numberParameters-1].append("off");
1872  parameters[numberParameters++]=
1873    CbcOrClpParam("special!Options","Dubious options for Simplex - see ClpSimplex.hpp",
1874                  0,INT_MAX,SPECIALOPTIONS,false);
1875  parameters[numberParameters++]=
1876    CbcOrClpParam("sprint!Crash","Whether to try sprint crash",
1877                  -1,500,SPRINT);
1878  parameters[numberParameters-1].setLonghelp
1879    (
1880     "For long and thin problems this program may solve a series of small problems\
1881 created by taking a subset of the columns.  I introduced the idea as 'Sprint' after\
1882 an LP code of that name of the 60's which tried the same tactic (not totally successfully).\
1883  Cplex calls it 'sifting'.  -1 is automatic choice, 0 is off, n is number of passes"
1884     ); 
1885  parameters[numberParameters++]=
1886    CbcOrClpParam("stat!istics","Print some statistics",
1887                  STATISTICS);
1888  parameters[numberParameters-1].setLonghelp
1889    (
1890     "This command prints crude statistics for the current model.\
1891 If log level >1 then more is printed.\
1892 These are for presolved model if presolve on (and unscaled)."
1893     );
1894#endif
1895  CbcOrClpParam("stdin","From stdin",
1896                STDIN,-1,false);
1897  parameters[numberParameters++]=
1898    CbcOrClpParam("stop","Stops clp execution",
1899                  EXIT);
1900  parameters[numberParameters-1].setLonghelp
1901    (
1902     "This stops the execution of Clp, end, exit, quit and stop are synonyms"
1903     ); 
1904#ifdef COIN_USE_CBC
1905  parameters[numberParameters++]=
1906    CbcOrClpParam("strong!Branching","Number of variables to look at in strong branching",
1907                  0,999999,STRONGBRANCHING);
1908  parameters[numberParameters-1].setLonghelp
1909    (
1910     "In order to decide which variable to branch on, the code will choose up to this number \
1911of unsatisfied variables to do mini up and down branches on.  Then the most effective one is chosen. \
1912If a variable is branched on many times then the previous average up and down costs may be used - \
1913see number before trust."
1914     ); 
1915#endif
1916#ifdef COIN_USE_CLP
1917  parameters[numberParameters++]=
1918    CbcOrClpParam("subs!titution","How long a column to substitute for in presolve",
1919                  0,10000,SUBSTITUTION,false);
1920  parameters[numberParameters-1].setLonghelp
1921    (
1922     "Normally Presolve gets rid of 'free' variables when there are no more than 3 \
1923 variables in column.  If you increase this the number of rows may decrease but number of \
1924 elements may increase."
1925     ); 
1926#endif
1927#ifdef COIN_USE_CBC
1928  parameters[numberParameters++]=
1929    CbcOrClpParam("tighten!Factor","Tighten bounds using this times largest \
1930activity at continuous solution",
1931                  1.0,1.0e20,TIGHTENFACTOR,false);
1932  parameters[numberParameters-1].setLonghelp
1933    (
1934     "This sleazy trick can help on some problems."
1935     ); 
1936#endif
1937#ifdef COIN_USE_CLP
1938  parameters[numberParameters++]=
1939    CbcOrClpParam("tightLP","Poor person's preSolve for now",
1940                  TIGHTEN,-1,false);
1941#endif
1942#ifdef COIN_USE_CBC
1943  parameters[numberParameters++]=
1944    CbcOrClpParam("trust!PseudoCosts","Number of branches before we trust pseudocosts",
1945                  0,999999,NUMBERBEFORE);
1946  parameters[numberParameters-1].setLonghelp
1947    (
1948     "Using strong branching computes pseudo-costs.  After this many time sfor a variable we just \
1949trust the pseudo costs and do not do any more strong branching."
1950     ); 
1951#endif
1952#ifdef COIN_USE_CBC
1953  parameters[numberParameters++]=
1954    CbcOrClpParam("two!MirCuts","Whether to use Two phase Mixed Integer Rounding cuts",
1955                  "off",TWOMIRCUTS);
1956  parameters[numberParameters-1].append("on");
1957  parameters[numberParameters-1].append("root");
1958  parameters[numberParameters-1].setLonghelp
1959    (
1960     "This switches on two phase mixed integer rounding  cuts (either at roor or in entire tree)"
1961     ); 
1962#endif
1963  parameters[numberParameters++]=
1964    CbcOrClpParam("unitTest","Do unit test",
1965                  UNITTEST);
1966  parameters[numberParameters-1].setLonghelp
1967    (
1968     "This exercises the unit test for clp"
1969     ); 
1970  assert(numberParameters<CBCMAXPARAMETERS);
1971}
1972// Given a parameter type - returns its number in list
1973int whichParam (CbcOrClpParameterType name, 
1974                int numberParameters, CbcOrClpParam *const parameters)
1975{
1976  int i;
1977  for (i=0;i<numberParameters;i++) {
1978    if (parameters[i].type()==name)
1979      break;
1980  }
1981  assert (i<numberParameters);
1982  return i;
1983}
Note: See TracBrowser for help on using the repository browser.