Changeset 41 for branches/devel1/Presolve.cpp
 Timestamp:
 Oct 14, 2002 9:12:24 AM (17 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/devel1/Presolve.cpp
r40 r41 2 2 // Corporation and others. All Rights Reserved. 3 3 4 #define CHECK_CONSISTENCY 14 //#define CHECK_CONSISTENCY 1 5 5 6 6 #include <stdio.h> … … 204 204 presolvedModel_ = new ClpSimplex(si); 205 205 206 206 207 // drop integer information if wanted 207 208 if (!keepIntegers) … … 213 214 *presolvedModel_, 214 215 nrows_, nelems_,true); 216 // make sure row solution correct 217 { 218 double *colels = prob.colels_; 219 int *hrow = prob.hrow_; 220 int *mcstrt = prob.mcstrt_; 221 int *hincol = prob.hincol_; 222 int ncols = prob.ncols_; 223 224 225 double * csol = prob.sol_; 226 double * acts = prob.acts_; 227 int nrows = prob.nrows_; 228 229 int colx; 230 231 memset(acts,0,nrows*sizeof(double)); 232 233 for (colx = 0; colx < ncols; ++colx) { 234 double solutionValue = csol[colx]; 235 for (int i=mcstrt[colx]; i<mcstrt[colx]+hincol[colx]; ++i) { 236 int row = hrow[i]; 237 double coeff = colels[i]; 238 acts[row] += solutionValue*coeff; 239 } 240 } 241 } 215 242 prob.handler_ = presolvedModel_>messageHandler(); 216 243 prob.messages_ = presolvedModel_>messages(); … … 417 444 #endif 418 445 } 419 420 #if defDEBUG_PRESOLVE421 void check_sol(PresolveMatrix *prob )446 //#define DEBUG_PRESOLVE 1 447 #if DEBUG_PRESOLVE 448 void check_sol(PresolveMatrix *prob,double tol) 422 449 { 423 450 double *colels = prob>colels_; … … 425 452 int *mcstrt = prob>mcstrt_; 426 453 int *hincol = prob>hincol_; 454 int *hinrow = prob>hinrow_; 427 455 int ncols = prob>ncols_; 428 456 429 457 430 458 double * csol = prob>sol_; 459 double * acts = prob>acts_; 431 460 double * clo = prob>clo_; 432 461 double * cup = prob>cup_; … … 451 480 rsol[row] += solutionValue*coeff; 452 481 } 453 if (csol[colx]<clo[colx] 1.0e4) {482 if (csol[colx]<clo[colx]tol) { 454 483 printf("low CSOL: %d  %g %g %g\n", 455 484 colx, clo[colx], csol[colx], cup[colx]); 456 } else if (csol[colx]>cup[colx]+ 1.0e4) {485 } else if (csol[colx]>cup[colx]+tol) { 457 486 printf("high CSOL: %d  %g %g %g\n", 458 487 colx, clo[colx], csol[colx], cup[colx]); … … 462 491 int rowx; 463 492 for (rowx = 0; rowx < nrows; ++rowx) { 464 if (1) { 465 if (rsol[rowx]<rlo[rowx]1.0e4) { 493 if (hinrow[rowx]) { 494 if (fabs(rsol[rowx]acts[rowx])>tol) 495 printf("inacc RSOL: %d  %g %g (acts_ %g) %g\n", 496 rowx, rlo[rowx], rsol[rowx], acts[rowx], rup[rowx]); 497 if (rsol[rowx]<rlo[rowx]tol) { 466 498 printf("low RSOL: %d  %g %g %g\n", 467 499 rowx, rlo[rowx], rsol[rowx], rup[rowx]); 468 } else if (rsol[rowx]>rup[rowx]+ 1.0e4) {500 } else if (rsol[rowx]>rup[rowx]+tol ) { 469 501 printf("high RSOL: %d  %g %g %g\n", 470 502 rowx, rlo[rowx], rsol[rowx], rup[rowx]); … … 514 546 515 547 int iLoop; 548 #if DEBUG_PRESOLVE 549 check_sol(prob,1.0e0); 550 #endif 516 551 517 552 for (iLoop=0;iLoop<numberPasses_;iLoop++) { … … 558 593 } 559 594 560 561 #if DEBUG_PRESOLVE 562 check_sol(prob); 595 #if DEBUG_PRESOLVE 596 check_sol(prob,1.0e0); 563 597 #endif 564 598 … … 576 610 #endif 577 611 578 #if PRESOLVE_SUMMARY579 612 prob>whichpass_++; 580 #endif581 613 582 614 // set up for next pass … … 632 664 printf("Starting expensive\n"); 633 665 #endif 634 635 666 if (dual) { 636 667 int itry; … … 656 687 break; 657 688 } 689 #if DEBUG_PRESOLVE 690 check_sol(prob,1.0e0); 691 #endif 658 692 659 693 if (duprow) { … … 662 696 break; 663 697 } 698 #if DEBUG_PRESOLVE 699 check_sol(prob,1.0e0); 700 #endif 701 { 702 int * hinrow = prob>hinrow_; 703 int numberDropped=0; 704 for (i=0;i<nrows_;i++) 705 if (!hinrow[i]) 706 numberDropped++; 707 printf("%d rows dropped after pass %d\n",numberDropped, 708 prob>whichpass_+1); 709 } 664 710 if (paction_ == paction0) 665 711 break; … … 669 715 if (!prob>status_) { 670 716 paction_ = drop_zero_coefficients(prob, paction_); 717 #if DEBUG_PRESOLVE 718 check_sol(prob,1.0e0); 719 #endif 671 720 672 721 paction_ = drop_empty_cols_action::presolve(prob, paction_); 673 722 paction_ = drop_empty_rows_action::presolve(prob, paction_); 723 #if DEBUG_PRESOLVE 724 check_sol(prob,1.0e0); 725 #endif 674 726 } 675 727 … … 839 891 void check_djs(PostsolveMatrix *prob) 840 892 { 893 return; 841 894 double *colels = prob>colels_; 842 895 int *hrow = prob>hrow_;
Note: See TracChangeset
for help on using the changeset viewer.