Changeset 1161 for stable/1.6
- Timestamp:
- Feb 14, 2008 4:34:42 PM (13 years ago)
- Location:
- stable/1.6/Clp/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable/1.6/Clp/src/CbcOrClpParam.cpp
r1159 r1161 402 402 CbcOrClpParam::setDoubleParameter (OsiSolverInterface * model,double value) 403 403 { 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 411 const char * 412 CbcOrClpParam::setDoubleParameterWithMessage ( OsiSolverInterface * model, double value ,int & returnCode) 413 { 404 414 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_); 405 417 std::cout<<value<<" was provided for "<<name_<< 406 418 " - valid range is "<<lowerDoubleValue_<<" to "<< 407 419 upperDoubleValue_<<std::endl; 408 return 1;420 returnCode = 1; 409 421 } else { 410 422 double oldValue=doubleValue_; … … 422 434 break; 423 435 } 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; 429 441 } 430 442 #endif … … 433 445 CbcOrClpParam::setDoubleParameter (ClpSimplex * model,double value) 434 446 { 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 454 const char * 455 CbcOrClpParam::setDoubleParameterWithMessage ( ClpSimplex * model, double value ,int & returnCode) 456 { 435 457 double oldValue = doubleValue_; 436 458 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; 441 462 } 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; 445 466 doubleValue_=value; 446 467 switch(type_) { … … 476 497 break; 477 498 } 478 return 0;479 }499 } 500 return printArray; 480 501 } 481 502 double … … 518 539 CbcOrClpParam::setIntParameter (ClpSimplex * model,int value) 519 540 { 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 548 const char * 549 CbcOrClpParam::setIntParameterWithMessage ( ClpSimplex * model, int value ,int & returnCode) 550 { 520 551 int oldValue = intValue_; 521 552 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; 526 556 } else { 527 557 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; 531 561 switch(type_) { 532 562 case SOLVERLOGLEVEL: … … 556 586 break; 557 587 } 558 return 0;559 }588 } 589 return printArray; 560 590 } 561 591 int … … 626 656 CbcOrClpParam::setIntParameter (OsiSolverInterface * model,int value) 627 657 { 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 665 const char * 666 CbcOrClpParam::setIntParameterWithMessage ( OsiSolverInterface * model, int value ,int & returnCode) 667 { 628 668 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; 633 672 } else { 634 673 int oldValue=intValue_; … … 641 680 break; 642 681 } 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; 648 687 } 649 688 int … … 664 703 CbcOrClpParam::setDoubleParameter (CbcModel &model,double value) 665 704 { 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 712 const char * 713 CbcOrClpParam::setDoubleParameterWithMessage ( CbcModel & model, double value ,int & returnCode) 714 { 666 715 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; 671 719 } else { 672 720 double oldValue=doubleValue_; … … 708 756 break; 709 757 } 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; 715 763 } 716 764 double … … 749 797 CbcOrClpParam::setIntParameter (CbcModel &model,int value) 750 798 { 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 806 const char * 807 CbcOrClpParam::setIntParameterWithMessage ( CbcModel & model, int value ,int & returnCode) 808 { 751 809 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; 756 813 } else { 757 814 int oldValue=intValue_; … … 803 860 oldValue=model.getNumberThreads(); 804 861 model.setNumberThreads(value); 805 break; 862 break; 806 863 #endif 807 864 #endif … … 809 866 break; 810 867 } 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; 816 873 } 817 874 int -
stable/1.6/Clp/src/CbcOrClpParam.hpp
r1159 r1161 138 138 /// Sets a double parameter (nonzero code if error) 139 139 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); 140 142 /// Gets a double parameter 141 143 double doubleParameter(CbcModel & model) const; 142 144 /// Sets a int parameter (nonzero code if error) 143 145 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); 144 148 /// Gets a int parameter 145 149 int intParameter(CbcModel & model) const; … … 148 152 /// Gets a double parameter 149 153 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); 150 156 /// Sets a int parameter (nonzero code if error) 151 157 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); 152 160 /// Gets a int parameter 153 161 int intParameter(ClpSimplex * model) const; 154 162 /// Sets a double parameter (nonzero code if error) 155 163 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); 156 166 /// Gets a double parameter 157 167 double doubleParameter(OsiSolverInterface * model) const; 158 168 /// Sets a int parameter (nonzero code if error) 159 169 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); 160 172 /// Gets a int parameter 161 173 int intParameter(OsiSolverInterface * model) const;
Note: See TracChangeset
for help on using the changeset viewer.