 Timestamp:
 Jan 21, 2008 5:41:00 PM (12 years ago)
 Location:
 trunk/Cbc/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcHeuristicGreedy.cpp
r838 r860 29 29 :CbcHeuristic(model) 30 30 { 31 // Get a copy of original matrix 32 assert(model.solver()); 33 matrix_ = *model.solver()>getMatrixByCol(); 34 originalNumberRows_=model.solver()>getNumRows(); 31 gutsOfConstructor(&model); 35 32 algorithm_=0; 36 33 numberTimes_=100; … … 47 44 { 48 45 return new CbcHeuristicGreedyCover(*this); 46 } 47 // Guts of constructor from a CbcModel 48 void 49 CbcHeuristicGreedyCover::gutsOfConstructor(CbcModel * model) 50 { 51 model_=model; 52 // Get a copy of original matrix 53 assert(model>solver()); 54 matrix_ = *model>solver()>getMatrixByCol(); 55 originalNumberRows_=model>solver()>getNumRows(); 49 56 } 50 57 // Create C++ lines to get to current state … … 349 356 void CbcHeuristicGreedyCover::setModel(CbcModel * model) 350 357 { 351 #define SLOPPY 352 #ifndef SLOPPY 353 model_ = model; 354 assert(model_>solver()); 355 *this = CbcHeuristicGreedyCover(*model); 356 #else 357 if (model_&&model!=model_) { 358 model_ = model; 359 assert(model_>solver()); 360 *this = CbcHeuristicGreedyCover(*model); 361 } 362 #endif 358 gutsOfConstructor(model); 363 359 validate(); 364 360 } … … 367 363 CbcHeuristicGreedyCover::resetModel(CbcModel * model) 368 364 { 369 #ifndef SLOPPY 370 model_ = model; 371 assert(model_>solver()); 372 *this = CbcHeuristicGreedyCover(*model); 373 #else 374 // switch off 375 model_ = NULL; 376 matrix_ = CoinPackedMatrix(); 377 #endif 365 gutsOfConstructor(model); 378 366 } 379 367 // Validate model i.e. sets when_ to 0 if necessary (may be NULL) … … 435 423 { 436 424 // Get a copy of original matrix 437 assert(model.solver()); 438 matrix_ = *model.solver()>getMatrixByCol(); 425 gutsOfConstructor(&model); 439 426 fraction_=1.0; // no branch and bound 440 originalNumberRows_=model.solver()>getNumRows();441 427 algorithm_=0; 442 428 numberTimes_=100; … … 453 439 { 454 440 return new CbcHeuristicGreedyEquality(*this); 441 } 442 // Guts of constructor from a CbcModel 443 void 444 CbcHeuristicGreedyEquality::gutsOfConstructor(CbcModel * model) 445 { 446 model_=model; 447 // Get a copy of original matrix 448 assert(model>solver()); 449 matrix_ = *model>solver()>getMatrixByCol(); 450 originalNumberRows_=model>solver()>getNumRows(); 455 451 } 456 452 // Create C++ lines to get to current state … … 784 780 void CbcHeuristicGreedyEquality::setModel(CbcModel * model) 785 781 { 786 #define SLOPPY 787 #ifndef SLOPPY 788 model_ = model; 789 assert(model_>solver()); 790 *this = CbcHeuristicGreedyEquality(*model); 791 #else 792 if (model_&&model!=model_) { 793 model_ = model; 794 assert(model_>solver()); 795 *this = CbcHeuristicGreedyEquality(*model); 796 } 797 #endif 782 gutsOfConstructor(model); 798 783 validate(); 799 784 } … … 802 787 CbcHeuristicGreedyEquality::resetModel(CbcModel * model) 803 788 { 804 #ifndef SLOPPY 805 model_ = model; 806 assert(model_>solver()); 807 *this = CbcHeuristicGreedyEquality(*model); 808 #else 809 // switch off 810 model_ = NULL; 811 matrix_ = CoinPackedMatrix(); 812 #endif 789 gutsOfConstructor(model); 813 790 } 814 791 // Validate model i.e. sets when_ to 0 if necessary (may be NULL) 
trunk/Cbc/src/CbcHeuristicGreedy.hpp
r765 r860 69 69 70 70 protected: 71 /// Guts of constructor from a CbcModel 72 void gutsOfConstructor(CbcModel * model); 71 73 // Data 72 74 … … 152 154 { numberTimes_=value; } 153 155 protected: 156 /// Guts of constructor from a CbcModel 157 void gutsOfConstructor(CbcModel * model); 154 158 // Data 155 159
Note: See TracChangeset
for help on using the changeset viewer.