 Timestamp:
 Jul 9, 2008 1:29:55 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/ClpSimplex.cpp
r1226 r1227 1594 1594 //#define COMPUTE_INT_INFEAS 1595 1595 #ifdef COMPUTE_INT_INFEAS 1596 if (algorithm_>0&&integerType_&&!nonLinearCost_>numberInfeasibilities()) { 1597 if (fabs(theta_)>1.0e6!numberIterations_) { 1598 int numberFixed=0; 1599 int numberUnsat=0; 1600 int numberSat=0; 1601 double sumUnsat=0.0; 1602 double tolerance = 10.0*primalTolerance_; 1603 double mostAway=0.0; 1604 int iAway=1; 1605 for (int i=0;i<numberColumns_;i++) { 1606 if (upper_[i]>lower_[i]) { 1607 double value = solution_[i]; 1608 if (value>lower_[i]+tolerance&& 1609 value<upper_[i]tolerance) { 1610 if (columnScale_) 1611 value *= columnScale_[i]; 1612 double closest = floor(value+0.5); 1613 // problem may be perturbed so relax test 1614 if (fabs(valueclosest)>1.0e4) { 1615 numberUnsat++; 1616 sumUnsat += fabs(valueclosest); 1617 if (mostAway<fabs(valueclosest)) { 1618 mostAway=fabs(valueclosest); 1619 iAway=i; 1596 if (userPointer_) { 1597 if (algorithm_>0&&integerType_&&!nonLinearCost_>numberInfeasibilities()) { 1598 if (fabs(theta_)>1.0e6!numberIterations_) { 1599 // For saving solutions 1600 typedef struct { 1601 int numberSolutions; 1602 int maximumSolutions; 1603 int numberColumns; 1604 double ** solution; 1605 } clpSolution; 1606 clpSolution * solution = (clpSolution *) userPointer_; 1607 if (solution>numberSolutions==solution>maximumSolutions) { 1608 int n = solution>maximumSolutions; 1609 int n2 = (n*3)/2+10; 1610 solution>maximumSolutions=n2; 1611 double ** temp = new double * [n2]; 1612 for (int i=0;i<n;i++) 1613 temp[i]=solution>solution[i]; 1614 delete [] solution>solution; 1615 solution>solution=temp; 1616 } 1617 assert (numberColumns_==solution>numberColumns); 1618 double * sol = new double [numberColumns_]; 1619 solution>solution[solution>numberSolutions++]=sol; 1620 int numberFixed=0; 1621 int numberUnsat=0; 1622 int numberSat=0; 1623 double sumUnsat=0.0; 1624 double tolerance = 10.0*primalTolerance_; 1625 double mostAway=0.0; 1626 int iAway=1; 1627 for (int i=0;i<numberColumns_;i++) { 1628 // Save anyway 1629 sol[i] = columnScale_ ? solution_[i]*columnScale_[i] : solution_[i]; 1630 // rest is optional 1631 if (upper_[i]>lower_[i]) { 1632 double value = solution_[i]; 1633 if (value>lower_[i]+tolerance&& 1634 value<upper_[i]tolerance&&integerType_[i]) { 1635 // may have to modify value if scaled 1636 if (columnScale_) 1637 value *= columnScale_[i]; 1638 double closest = floor(value+0.5); 1639 // problem may be perturbed so relax test 1640 if (fabs(valueclosest)>1.0e4) { 1641 numberUnsat++; 1642 sumUnsat += fabs(valueclosest); 1643 if (mostAway<fabs(valueclosest)) { 1644 mostAway=fabs(valueclosest); 1645 iAway=i; 1646 } 1647 } else { 1648 numberSat++; 1620 1649 } 1621 1650 } else { … … 1623 1652 } 1624 1653 } else { 1625 number Sat++;1654 numberFixed++; 1626 1655 } 1627 } else { 1628 numberFixed++; 1629 } 1630 } 1631 printf("iteration %d, %d unsatisfied (%g,%g), %d fixed, %d satisfied\n", 1632 numberIterations_,numberUnsat,sumUnsat,mostAway,numberFixed,numberSat); 1656 } 1657 printf("iteration %d, %d unsatisfied (%g,%g), %d fixed, %d satisfied\n", 1658 numberIterations_,numberUnsat,sumUnsat,mostAway,numberFixed,numberSat); 1659 } 1633 1660 } 1634 1661 }
Note: See TracChangeset
for help on using the changeset viewer.