Changes from stable/2.8/Cbc/src/CbcClique.cpp at r1902 to trunk/Cbc/src/CbcClique.cpp at r2094
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcClique.cpp
r1902 r2094 44 44 : CbcObject(model) 45 45 { 46 id_ = identifier;47 46 numberMembers_ = numberMembers; 47 int * backward = NULL; 48 if (identifier<0) { 49 // which are variables in model  not in integers 50 identifier=identifier; 51 int numberColumns = model>getNumCols(); 52 int numberIntegers = model>numberIntegers(); 53 const int * integerVariable = model>integerVariable(); 54 backward = new int [numberColumns]; 55 for (int i=0;i<numberColumns;i++) 56 backward[i]=1; 57 for (int i=0;i<numberIntegers;i++) { 58 backward[integerVariable[i]]=i; 59 } 60 } 48 61 if (numberMembers_) { 49 62 members_ = new int[numberMembers_]; 50 63 memcpy(members_, which, numberMembers_*sizeof(int)); 64 if (backward) { 65 for (int i=0;i<numberMembers_;i++) { 66 int iColumn = which[i]; 67 iColumn = backward[iColumn]; 68 assert (iColumn>=0); 69 members_[i]=iColumn; 70 #ifdef FULL_PRINT 71 printf("%d column %d member %d\n",i,which[i],iColumn); 72 #endif 73 } 74 } 51 75 type_ = new char[numberMembers_]; 52 76 if (type) { … … 68 92 cliqueType_ = cliqueType; 69 93 slack_ = slack; 94 delete [] backward; 95 id_ = identifier; 70 96 } 71 97 … … 283 309 const int * integer = model_>integerVariable(); 284 310 //OsiSolverInterface * solver = model_>solver(); 311 CoinWarmStartBasis * basis = dynamic_cast<CoinWarmStartBasis*>(solver>getWarmStart()) ; 285 312 const double * solution = model_>testSolution(); 286 313 const double * lower = solver>getColLower(); … … 312 339 } else if (upper[iColumn] > lower[iColumn]) { 313 340 upList[numberFree] = j; 341 sort[numberFree] = 0.0; 342 if (basis && basis>getStructStatus(iColumn) == CoinWarmStartBasis::basic) 343 sort[numberFree] = 1.0; 344 314 345 } 315 346 } … … 318 349 // sort 319 350 CoinSort_2(sort, sort + numberUnsatis, upList); 351 // also try and spread out satisfied basic 352 CoinSort_2(sort+numberFree, sort + numberMembers_, upList+numberFree); 320 353 // put first in up etc 321 354 int kWay = 1; … … 459 492 #endif 460 493 // fix weak way 461 if (clique_>type(i + 32*iWord)) 494 if (clique_>type(i + 32*iWord)) { 495 #ifdef FULL_PRINT 496 printf("member %d int %d matcol %d bound %g %g to 0.0\n", 497 i,iColumn,integerVariables[iColumn], 498 model_>solver()>getColLower()[integerVariables[iColumn]], 499 model_>solver()>getColUpper()[integerVariables[iColumn]]); 500 #endif 462 501 model_>solver()>setColUpper(integerVariables[iColumn], 0.0); 463 else 502 } else { 503 #ifdef FULL_PRINT 504 printf("member %d int %d matcol %d bound %g %g to 1.0\n", 505 i,iColumn,integerVariables[iColumn], 506 model_>solver()>getColLower()[integerVariables[iColumn]], 507 model_>solver()>getColUpper()[integerVariables[iColumn]]); 508 #endif 464 509 model_>solver()>setColLower(integerVariables[iColumn], 1.0); 510 } 465 511 } 466 512 } … … 481 527 #endif 482 528 // fix weak way 483 if (clique_>type(i + 32*iWord)) 529 if (clique_>type(i + 32*iWord)) { 530 #ifdef FULL_PRINT 531 printf("member %d int %d matcol %d bound %g %g to 0.0\n", 532 i,iColumn,integerVariables[iColumn], 533 model_>solver()>getColLower()[integerVariables[iColumn]], 534 model_>solver()>getColUpper()[integerVariables[iColumn]]); 535 #endif 484 536 model_>solver()>setColUpper(integerVariables[iColumn], 0.0); 485 else 537 } else { 538 #ifdef FULL_PRINT 539 printf("member %d int %d matcol %d bound %g %g to 1.0\n", 540 i,iColumn,integerVariables[iColumn], 541 model_>solver()>getColLower()[integerVariables[iColumn]], 542 model_>solver()>getColUpper()[integerVariables[iColumn]]); 543 #endif 486 544 model_>solver()>setColLower(integerVariables[iColumn], 1.0); 545 } 487 546 } 488 547 }
Note: See TracChangeset
for help on using the changeset viewer.