Changeset 1161


Ignore:
Timestamp:
Feb 14, 2008 4:34:42 PM (12 years ago)
Author:
forrest
Message:

for Stefan messages

Location:
stable/1.6/Clp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable/1.6/Clp/src/CbcOrClpParam.cpp

    r1159 r1161  
    402402CbcOrClpParam::setDoubleParameter (OsiSolverInterface * model,double value)
    403403{
     404  int returnCode;
     405  setDoubleParameterWithMessage(model,value,returnCode);
     406  if (doPrinting&&strlen(printArray))
     407    std::cout<<printArray<<std::endl;
     408  return returnCode;
     409}
     410// Sets double parameter and returns printable string and error code
     411const char *
     412CbcOrClpParam::setDoubleParameterWithMessage ( OsiSolverInterface * model, double  value ,int & returnCode)
     413{
    404414  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
     415    sprintf(printArray,"%g was provided for %s - valid range is %g to %g",
     416            value,name_.c_str(),lowerDoubleValue_,upperDoubleValue_);
    405417    std::cout<<value<<" was provided for "<<name_<<
    406418      " - valid range is "<<lowerDoubleValue_<<" to "<<
    407419      upperDoubleValue_<<std::endl;
    408     return 1;
     420    returnCode = 1;
    409421  } else {
    410422    double oldValue=doubleValue_;
     
    422434      break;
    423435    }
    424     if (doPrinting)
    425       std::cout<<name_<<" was changed from "<<oldValue<<" to "
    426                <<value<<std::endl;
    427     return 0;
    428   }
     436    sprintf(printArray,"%s was changed from %g to %g",
     437            name_.c_str(),oldValue,value);
     438    returnCode = 0;
     439  }
     440  return printArray;
    429441}
    430442#endif
     
    433445CbcOrClpParam::setDoubleParameter (ClpSimplex * model,double value)
    434446{
     447  int returnCode;
     448  setDoubleParameterWithMessage(model,value,returnCode);
     449  if (doPrinting&&strlen(printArray))
     450    std::cout<<printArray<<std::endl;
     451  return returnCode;
     452}
     453// Sets int parameter and returns printable string and error code
     454const char *
     455CbcOrClpParam::setDoubleParameterWithMessage ( ClpSimplex * model, double value ,int & returnCode)
     456{
    435457  double oldValue = doubleValue_;
    436458  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
    437     std::cout<<value<<" was provided for "<<name_<<
    438       " - valid range is "<<lowerDoubleValue_<<" to "<<
    439       upperDoubleValue_<<std::endl;
    440     return 1;
     459    sprintf(printArray,"%g was provided for %s - valid range is %g to %g",
     460            value,name_.c_str(),lowerDoubleValue_,upperDoubleValue_);
     461    returnCode = 1;
    441462  } else {
    442     if (doPrinting)
    443       std::cout<<name_<<" was changed from "<<oldValue<<" to "
    444                <<value<<std::endl;
     463    sprintf(printArray,"%s was changed from %g to %g",
     464            name_.c_str(),oldValue,value);
     465    returnCode = 0;
    445466    doubleValue_=value;
    446467    switch(type_) {
     
    476497      break;
    477498    }
    478     return 0;
    479   }
     499  }
     500  return printArray;
    480501}
    481502double
     
    518539CbcOrClpParam::setIntParameter (ClpSimplex * model,int value)
    519540{
     541  int returnCode;
     542  setIntParameterWithMessage(model,value,returnCode);
     543  if (doPrinting&&strlen(printArray))
     544    std::cout<<printArray<<std::endl;
     545  return returnCode;
     546}
     547// Sets int parameter and returns printable string and error code
     548const char *
     549CbcOrClpParam::setIntParameterWithMessage ( ClpSimplex * model, int value ,int & returnCode)
     550{
    520551  int oldValue = intValue_;
    521552  if (value<lowerIntValue_||value>upperIntValue_) {
    522     std::cout<<value<<" was provided for "<<name_<<
    523       " - valid range is "<<lowerIntValue_<<" to "<<
    524       upperIntValue_<<std::endl;
    525     return 1;
     553    sprintf(printArray,"%d was provided for %s - valid range is %d to %d",
     554            value,name_.c_str(),lowerIntValue_,upperIntValue_);
     555    returnCode = 1;
    526556  } else {
    527557    intValue_=value;
    528     if (doPrinting)
    529       std::cout<<name_<<" was changed from "<<oldValue<<" to "
    530                <<value<<std::endl;
     558    sprintf(printArray,"%s was changed from %d to %d",
     559            name_.c_str(),oldValue,value);
     560    returnCode = 0;
    531561    switch(type_) {
    532562    case SOLVERLOGLEVEL:
     
    556586      break;
    557587    }
    558     return 0;
    559   }
     588  }
     589  return printArray;
    560590}
    561591int
     
    626656CbcOrClpParam::setIntParameter (OsiSolverInterface * model,int value)
    627657{
     658  int returnCode;
     659  setIntParameterWithMessage(model,value,returnCode);
     660  if (doPrinting&&strlen(printArray))
     661    std::cout<<printArray<<std::endl;
     662  return returnCode;
     663}
     664// Sets int parameter and returns printable string and error code
     665const char *
     666CbcOrClpParam::setIntParameterWithMessage ( OsiSolverInterface * model, int  value ,int & returnCode)
     667{
    628668  if (value<lowerIntValue_||value>upperIntValue_) {
    629     std::cout<<value<<" was provided for "<<name_<<
    630       " - valid range is "<<lowerIntValue_<<" to "<<
    631       upperIntValue_<<std::endl;
    632     return 1;
     669    sprintf(printArray,"%d was provided for %s - valid range is %d to %d",
     670            value,name_.c_str(),lowerIntValue_,upperIntValue_);
     671    returnCode = 1;
    633672  } else {
    634673    int oldValue=intValue_;
     
    641680      break;
    642681    }
    643     if (doPrinting)
    644       std::cout<<name_<<" was changed from "<<oldValue<<" to "
    645                <<value<<std::endl;
    646     return 0;
    647   }
     682    sprintf(printArray,"%s was changed from %d to %d",
     683            name_.c_str(),oldValue,value);
     684    returnCode = 0;
     685  }
     686  return printArray;
    648687}
    649688int
     
    664703CbcOrClpParam::setDoubleParameter (CbcModel &model,double value)
    665704{
     705  int returnCode;
     706  setDoubleParameterWithMessage(model,value,returnCode);
     707  if (doPrinting&&strlen(printArray))
     708    std::cout<<printArray<<std::endl;
     709  return returnCode;
     710}
     711// Sets double parameter and returns printable string and error code
     712const char *
     713CbcOrClpParam::setDoubleParameterWithMessage ( CbcModel & model, double  value ,int & returnCode)
     714{
    666715  if (value<lowerDoubleValue_||value>upperDoubleValue_) {
    667     std::cout<<value<<" was provided for "<<name_<<
    668       " - valid range is "<<lowerDoubleValue_<<" to "<<
    669       upperDoubleValue_<<std::endl;
    670     return 1;
     716    sprintf(printArray,"%g was provided for %s - valid range is %g to %g",
     717            value,name_.c_str(),lowerDoubleValue_,upperDoubleValue_);
     718    returnCode = 1;
    671719  } else {
    672720    double oldValue=doubleValue_;
     
    708756      break;
    709757    }
    710     if (doPrinting)
    711       std::cout<<name_<<" was changed from "<<oldValue<<" to "
    712                <<value<<std::endl;
    713     return 0;
    714   }
     758    sprintf(printArray,"%s was changed from %g to %g",
     759            name_.c_str(),oldValue,value);
     760    returnCode = 0;
     761  }
     762  return printArray;
    715763}
    716764double
     
    749797CbcOrClpParam::setIntParameter (CbcModel &model,int value)
    750798{
     799  int returnCode;
     800  setIntParameterWithMessage(model,value,returnCode);
     801  if (doPrinting&&strlen(printArray))
     802    std::cout<<printArray<<std::endl;
     803  return returnCode;
     804}
     805// Sets int parameter and returns printable string and error code
     806const char *
     807CbcOrClpParam::setIntParameterWithMessage ( CbcModel & model, int value ,int & returnCode)
     808{
    751809  if (value<lowerIntValue_||value>upperIntValue_) {
    752     std::cout<<value<<" was provided for "<<name_<<
    753       " - valid range is "<<lowerIntValue_<<" to "<<
    754       upperIntValue_<<std::endl;
    755     return 1;
     810    sprintf(printArray,"%d was provided for %s - valid range is %d to %d",
     811            value,name_.c_str(),lowerIntValue_,upperIntValue_);
     812    returnCode = 1;
    756813  } else {
    757814    int oldValue=intValue_;
     
    803860      oldValue=model.getNumberThreads();
    804861      model.setNumberThreads(value);
    805       break;
     862      break; 
    806863#endif
    807864#endif
     
    809866      break;
    810867    }
    811     if (doPrinting)
    812       std::cout<<name_<<" was changed from "<<oldValue<<" to "
    813                <<value<<std::endl;
    814     return 0;
    815   }
     868    sprintf(printArray,"%s was changed from %d to %d",
     869            name_.c_str(),oldValue,value);
     870    returnCode = 0;
     871  }
     872  return printArray;
    816873}
    817874int
  • stable/1.6/Clp/src/CbcOrClpParam.hpp

    r1159 r1161  
    138138  /// Sets a double parameter (nonzero code if error)
    139139  int setDoubleParameter(CbcModel & model, double value) ;
     140  /// Sets double parameter and returns printable string and error code
     141  const char * setDoubleParameterWithMessage ( CbcModel & model, double  value ,int & returnCode);
    140142  /// Gets a double parameter
    141143  double doubleParameter(CbcModel & model) const;
    142144  /// Sets a int parameter (nonzero code if error)
    143145  int setIntParameter(CbcModel & model, int value) ;
     146  /// Sets int parameter and returns printable string and error code
     147  const char * setIntParameterWithMessage ( CbcModel & model, int value ,int & returnCode);
    144148  /// Gets a int parameter
    145149  int intParameter(CbcModel & model) const;
     
    148152  /// Gets a double parameter
    149153  double doubleParameter(ClpSimplex * model) const;
     154  /// Sets double parameter and returns printable string and error code
     155  const char * setDoubleParameterWithMessage ( ClpSimplex * model, double  value ,int & returnCode);
    150156  /// Sets a int parameter (nonzero code if error)
    151157  int setIntParameter(ClpSimplex * model, int value) ;
     158  /// Sets int parameter and returns printable string and error code
     159  const char * setIntParameterWithMessage ( ClpSimplex * model, int  value ,int & returnCode);
    152160  /// Gets a int parameter
    153161  int intParameter(ClpSimplex * model) const;
    154162  /// Sets a double parameter (nonzero code if error)
    155163  int setDoubleParameter(OsiSolverInterface * model, double value) ;
     164  /// Sets double parameter and returns printable string and error code
     165  const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double  value ,int & returnCode);
    156166  /// Gets a double parameter
    157167  double doubleParameter(OsiSolverInterface * model) const;
    158168  /// Sets a int parameter (nonzero code if error)
    159169  int setIntParameter(OsiSolverInterface * model, int value) ;
     170  /// Sets int parameter and returns printable string and error code
     171  const char * setIntParameterWithMessage ( OsiSolverInterface * model, int  value ,int & returnCode);
    160172  /// Gets a int parameter
    161173  int intParameter(OsiSolverInterface * model) const;
Note: See TracChangeset for help on using the changeset viewer.