Changeset 713


Ignore:
Timestamp:
Jan 30, 2006 5:09:19 PM (15 years ago)
Author:
forrest
Message:

for ampl

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Test/CbcOrClpParam.cpp

    r707 r713  
    3030static char coin_prompt[]="Clp:";
    3131#endif
     32static bool doPrinting=true;
     33std::string afterEquals="";
     34void setCbcOrClpPrinting(bool yesNo)
     35{
     36  doPrinting=yesNo;
     37}
    3238//#############################################################################
    3339// Constructors / Destructor / Assignment
     
    401407      break;
    402408    }
    403     std::cout<<name_<<" was changed from "<<oldValue<<" to "
    404              <<value<<std::endl;
     409    if (doPrinting)
     410      std::cout<<name_<<" was changed from "<<oldValue<<" to "
     411               <<value<<std::endl;
    405412    return 0;
    406413  }
     
    418425    return 1;
    419426  } else {
    420     std::cout<<name_<<" was changed from "<<oldValue<<" to "
    421              <<value<<std::endl;
     427    if (doPrinting)
     428      std::cout<<name_<<" was changed from "<<oldValue<<" to "
     429               <<value<<std::endl;
    422430    doubleValue_=value;
    423431    switch(type_) {
     
    503511  } else {
    504512    intValue_=value;
    505     std::cout<<name_<<" was changed from "<<oldValue<<" to "
    506              <<value<<std::endl;
     513    if (doPrinting)
     514      std::cout<<name_<<" was changed from "<<oldValue<<" to "
     515               <<value<<std::endl;
    507516    switch(type_) {
    508517    case SOLVERLOGLEVEL:
     
    609618      break;
    610619    }
    611     std::cout<<name_<<" was changed from "<<oldValue<<" to "
    612              <<value<<std::endl;
     620    if (doPrinting)
     621      std::cout<<name_<<" was changed from "<<oldValue<<" to "
     622               <<value<<std::endl;
    613623    return 0;
    614624  }
     
    675685      break;
    676686    }
    677     std::cout<<name_<<" was changed from "<<oldValue<<" to "
    678              <<value<<std::endl;
     687    if (doPrinting)
     688      std::cout<<name_<<" was changed from "<<oldValue<<" to "
     689               <<value<<std::endl;
    679690    return 0;
    680691  }
     
    755766      break;
    756767    }
    757     std::cout<<name_<<" was changed from "<<oldValue<<" to "
    758              <<value<<std::endl;
     768    if (doPrinting)
     769      std::cout<<name_<<" was changed from "<<oldValue<<" to "
     770               <<value<<std::endl;
    759771    return 0;
    760772  }
     
    800812  if (action>=0)
    801813    currentKeyWord_=action;
     814}
     815// Sets current parameter option
     816void
     817CbcOrClpParam::setCurrentOption ( int value , bool printIt)
     818{
     819  if (printIt&&value!=currentKeyWord_)
     820    std::cout<<"Option for "<<name_<<" changed from "
     821             <<definedKeyWords_[currentKeyWord_]<<" to "
     822             <<definedKeyWords_[value]<<std::endl;
     823
     824    currentKeyWord_=value;
    802825}
    803826void
     
    900923{
    901924  std::string field="EOL";
     925  // say no =
     926  afterEquals="";
    902927  while (field=="EOL") {
    903928    if (CbcOrClpRead_mode>0) {
     
    910935        } else if (field[0]!='-') {
    911936          if (CbcOrClpRead_mode!=2) {
    912             std::cout<<"skipping non-command "<<field<<std::endl;
    913             field="EOL"; // skip
     937            // now allow std::cout<<"skipping non-command "<<field<<std::endl;
     938            // field="EOL"; // skip
    914939          } else {
    915940            // special dispensation - taken as -import name
     
    934959    }
    935960  }
     961  // if = then modify and save
     962  unsigned int found = field.find('=');
     963  if (found!=std::string::npos) {
     964    afterEquals = field.substr(found+1);
     965    field = field.substr(0,found);
     966  }
    936967  //std::cout<<field<<std::endl;
    937968  return field;
     
    941972{
    942973  std::string field="EOL";
    943   if (CbcOrClpRead_mode>0) {
    944     if (CbcOrClpRead_mode<argc) {
    945       if (argv[CbcOrClpRead_mode][0]!='-') {
    946         field = argv[CbcOrClpRead_mode++];
    947       } else if (!strcmp(argv[CbcOrClpRead_mode],"--")) {
    948         field = argv[CbcOrClpRead_mode++];
    949         // -- means import from stdin
    950         field = "-";
     974  if (afterEquals=="") {
     975    if (CbcOrClpRead_mode>0) {
     976      if (CbcOrClpRead_mode<argc) {
     977        if (argv[CbcOrClpRead_mode][0]!='-') {
     978          field = argv[CbcOrClpRead_mode++];
     979        } else if (!strcmp(argv[CbcOrClpRead_mode],"--")) {
     980          field = argv[CbcOrClpRead_mode++];
     981          // -- means import from stdin
     982          field = "-";
     983        }
    951984      }
     985    } else {
     986      field=CoinReadNextField();
    952987    }
    953988  } else {
    954     field=CoinReadNextField();
     989    field=afterEquals;
     990    afterEquals = "";
    955991  }
    956992  //std::cout<<field<<std::endl;
     
    962998{
    963999  std::string field="EOL";
    964   if (CbcOrClpRead_mode>0) {
    965     if (CbcOrClpRead_mode<argc) {
    966       // may be negative value so do not check for -
    967       field = argv[CbcOrClpRead_mode++];
     1000  if (afterEquals=="") {
     1001    if (CbcOrClpRead_mode>0) {
     1002      if (CbcOrClpRead_mode<argc) {
     1003        // may be negative value so do not check for -
     1004        field = argv[CbcOrClpRead_mode++];
     1005      }
     1006    } else {
     1007      field=CoinReadNextField();
    9681008    }
    9691009  } else {
    970     field=CoinReadNextField();
     1010    field=afterEquals;
     1011    afterEquals = "";
    9711012  }
    9721013  int value=0;
     
    9851026{
    9861027  std::string field="EOL";
    987   if (CbcOrClpRead_mode>0) {
    988     if (CbcOrClpRead_mode<argc) {
    989       // may be negative value so do not check for -
    990       field = argv[CbcOrClpRead_mode++];
     1028  if (afterEquals=="") {
     1029    if (CbcOrClpRead_mode>0) {
     1030      if (CbcOrClpRead_mode<argc) {
     1031        // may be negative value so do not check for -
     1032        field = argv[CbcOrClpRead_mode++];
     1033      }
     1034    } else {
     1035      field=CoinReadNextField();
    9911036    }
    9921037  } else {
    993     field=CoinReadNextField();
     1038    field=afterEquals;
     1039    afterEquals = "";
    9941040  }
    9951041  double value=0.0;
     
    14261472    CbcOrClpParam("help","Print out version, non-standard options and some help",
    14271473                  HELP);
     1474#ifdef COIN_USE_CBC
     1475  parameters[numberParameters++]=
     1476    CbcOrClpParam("hot!StartMaxIts","Maximum iterations on hot start",
     1477                  0,INT_MAX,MAXHOTITS,false);
     1478#endif
    14281479#ifdef COIN_USE_CLP
    14291480  parameters[numberParameters++]=
     
    15901641  parameters[numberParameters++]=
    15911642    CbcOrClpParam("more!MipOptions","More dubious options for mip",
    1592                   0,INT_MAX,MOREMIPOPTIONS,false);
     1643                  -1,INT_MAX,MOREMIPOPTIONS,false);
    15931644  parameters[numberParameters++]=
    15941645    CbcOrClpParam("mixed!IntegerRoundingCuts","Whether to use Mixed Integer Rounding cuts",
  • trunk/Test/CbcOrClpParam.hpp

    r707 r713  
    5959
    6060    STRONGBRANCHING=151,CUTDEPTH, MAXNODES,NUMBERBEFORE,NUMBERANALYZE,
    61     NUMBERMINI,MIPOPTIONS,MOREMIPOPTIONS,
     61    NUMBERMINI,MIPOPTIONS,MOREMIPOPTIONS,MAXHOTITS,
    6262#ifdef COIN_USE_CBC
    6363    LOGLEVEL ,
     
    163163  { return definedKeyWords_[currentKeyWord_]; };
    164164  /// Sets current parameter option
    165   inline void setCurrentOption ( int value )
    166   { currentKeyWord_=value; };
     165  void setCurrentOption ( int value , bool printIt=false);
    167166  /// Sets current parameter option using string
    168167  void setCurrentOption (const std::string value );
     
    253252double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
    254253void CoinReadPrintit(const char * input);
    255 
     254void setCbcOrClpPrinting(bool yesNo);
    256255#define CBCMAXPARAMETERS 200
    257256/*
  • trunk/include/ClpSimplex.hpp

    r701 r713  
    935935      16384 - In fast dual (so we can switch off things)
    936936      32678 - called from Osi
    937   */
     937      NOTE - many applications can call Clp but there may be some short cuts
     938             which are taken which are not guaranteed safe from all applications.
     939             Vetted applications will have a bit set and the code may test this
     940             At present I expect a few such applications - if too many I will
     941             have to re-think.  It is up to application owner to change the code
     942             if she/he needs these short cuts.  I will not debug unless in Coin
     943             repository.  See COIN_CLP_VETTED comments.
     944      0x01000000 is Cbc (and in branch and bound)
     945  */
     946#define COIN_CBC_USING_CLP 0x01000000
    938947  inline unsigned int specialOptions() const
    939948  { return specialOptions_;};
Note: See TracChangeset for help on using the changeset viewer.