Changes in stable/2.9/Cbc/src/CbcSolver.cpp [2249:2209]
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

stable/2.9/Cbc/src/CbcSolver.cpp
r2249 r2209 4178 4178 osiclp>getModelPtr()>setMoreSpecialOptions(saveOptions262144); 4179 4179 } 4180 4180 solver2 = process.preProcessNonDefault(*saveSolver, translate[preProcess], numberPasses, 4181 4181 tunePreProcess); 4182 if (solver2) { 4183 model_.setOriginalColumns( process.originalColumns(), solver2>getNumCols() ); 4184 osiclp>getModelPtr()>setPerturbation(savePerturbation); 4185 osiclp>getModelPtr()>setMoreSpecialOptions(saveOptions); 4186 } 4182 /*solver2>writeMps("after"); 4183 saveSolver>writeMps("before");*/ 4184 osiclp>getModelPtr()>setPerturbation(savePerturbation); 4185 osiclp>getModelPtr()>setMoreSpecialOptions(saveOptions); 4187 4186 } 4188 4187 #elif CBC_OTHER_SOLVER==1 … … 5435 5434 #endif 5436 5435 const int * originalColumns = preProcess ? process.originalColumns() : NULL; 5437 5438 if (model.getMIPStart().size()) 5439 mipStart = model.getMIPStart(); 5440 5441 if (mipStart.size() && !mipStartBefore.size() && babModel_>getNumCols()) 5436 //if (model.getMIPStart().size()) 5437 // mipStart = model.getMIPStart(); 5438 if (mipStart.size() && !mipStartBefore.size() && babModel_>getNumCols()) 5442 5439 { 5443 std::vector< std::string > colNames; 5444 if (preProcess) 5445 { 5446 /* translating mipstart solution */ 5447 std::map< std::string, double > mipStartV; 5448 for ( size_t i=0 ; (i<mipStart.size()) ; ++i ) 5449 mipStartV[mipStart[i].first] = mipStart[i].second; 5450 5451 std::vector< std::pair< std::string, double > > mipStart2; 5452 for ( int i=0 ; (i<babModel_>solver()>getNumCols()) ; ++i ) { 5453 int iColumn = babModel_>originalColumns()[i]; 5454 if (iColumn>=0) { 5455 std::string cname = model_.solver()>getColName( iColumn ); 5456 colNames.push_back( cname ); 5457 babModel_>solver()>setColName( i, cname ); 5458 std::map< std::string, double >::const_iterator msIt = mipStartV.find( cname ); 5459 if ( msIt != mipStartV.end() ) 5460 mipStart2.push_back( std::pair< std::string, double>( cname, msIt>second ) ); 5461 } else { 5462 // created variable 5463 char newName[15]; 5464 sprintf(newName,"C%7.7d",i); 5465 colNames.push_back( newName ); 5466 } 5467 } 5468 mipStart = mipStart2; 5469 } else { 5470 for ( int i=0 ; (i<babModel_>solver()>getNumCols()) ; ++i ) 5471 colNames.push_back( model_.solver()>getColName(i) ); 5472 } 5473 //printf(" %s %d\n", babModel_>solver()>getColName(0).c_str(), babModel_>solver()>getColNames().size() ); 5474 //printf(" SIZES of models %d %d %d\n", model_.getNumCols(), babModel_>solver()>getNumCols(), babModel_>solver()>getColNames().size() ); 5475 std::vector< double > x( babModel_>getNumCols(), 0.0 ); 5476 double obj; 5477 int status = computeCompleteSolution( babModel_, colNames, mipStart, &x[0], obj ); 5478 if (!status) { 5479 babModel_>setBestSolution( &x[0], static_cast<int>(x.size()), obj, false ); 5480 babModel_>setSolutionCount(1); 5481 } 5482 } 5483 5440 std::vector< std::string > colNames; 5441 if (preProcess) 5442 { 5443 std::vector< std::pair< std::string, double > > mipStart2; 5444 int numberOriginalColumns = model_.solver()>getNumCols(); 5445 for ( int i=0 ; (i<babModel_>solver()>getNumCols()) ; ++i ) { 5446 int iColumn = babModel_>originalColumns()[i]; 5447 if (iColumn>=0 && iColumn < numberOriginalColumns) { 5448 colNames.push_back( model_.solver()>getColName( iColumn ) ); 5449 babModel_>solver()>setColName(i,model_.solver()>getColName(iColumn)); 5450 mipStart2.push_back(mipStart[iColumn]); 5451 } else { 5452 // created variable 5453 char newName[15]; 5454 sprintf(newName,"C%7.7d",i); 5455 colNames.push_back( newName ); 5456 } 5457 } 5458 mipStart = mipStart2; 5459 } else { 5460 for ( int i=0 ; (i<babModel_>solver()>getNumCols()) ; ++i ) 5461 colNames.push_back( model_.solver()>getColName(i) ); 5462 } 5463 //printf(" %s %d\n", babModel_>solver()>getColName(0).c_str(), babModel_>solver()>getColNames().size() ); 5464 //printf(" SIZES of models %d %d %d\n", model_.getNumCols(), babModel_>solver()>getNumCols(), babModel_>solver()>getColNames().size() ); 5465 std::vector< double > x( babModel_>getNumCols(), 0.0 ); 5466 double obj; 5467 int status = computeCompleteSolution( babModel_, colNames, mipStart, &x[0], obj ); 5468 if (!status) { 5469 babModel_>setBestSolution( &x[0], static_cast<int>(x.size()), obj, false ); 5470 babModel_>setSolutionCount(1); 5471 } 5472 } 5484 5473 5485 5474 if (solutionIn && useSolution >= 0) { … … 5567 5556 assert (originalColumns); 5568 5557 int n = CoinMin(truncateColumns,numberColumns); 5569 // allow for empty problem 5570 n = (n) ? originalColumns[n1] + 1 : 0; 5558 n = originalColumns[n1] + 1; 5571 5559 n = CoinMax(n, CoinMax(numberColumns, numberOriginalColumns)); 5572 5560 int * newColumn = new int[n];
Note: See TracChangeset
for help on using the changeset viewer.