Changeset 1241 for trunk/Clp


Ignore:
Timestamp:
Jul 17, 2008 2:59:21 PM (12 years ago)
Author:
forrest
Message:

fix corner point bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpSimplex.cpp

    r1227 r1241  
    15921592ClpSimplex::housekeeping(double objectiveChange)
    15931593{
     1594  // save value of incoming and outgoing
     1595  double oldIn = solution_[sequenceIn_];
     1596  double oldOut = solution_[sequenceOut_];
     1597  numberIterations_++;
     1598  changeMade_++; // something has happened
     1599  // incoming variable
     1600  if (handler_->detail(CLP_SIMPLEX_HOUSE1,messages_)<100) {
     1601    handler_->message(CLP_SIMPLEX_HOUSE1,messages_)
     1602      <<directionOut_
     1603      <<directionIn_<<theta_
     1604      <<dualOut_<<dualIn_<<alpha_
     1605      <<CoinMessageEol;
     1606    if (getStatus(sequenceIn_)==isFree) {
     1607      handler_->message(CLP_SIMPLEX_FREEIN,messages_)
     1608        <<sequenceIn_
     1609        <<CoinMessageEol;
     1610    }
     1611  }
     1612  // change of incoming
     1613  char rowcol[]={'R','C'};
     1614  if (pivotRow_>=0)
     1615    pivotVariable_[pivotRow_]=sequenceIn();
     1616  if (upper_[sequenceIn_]>1.0e20&&lower_[sequenceIn_]<-1.0e20)
     1617    progressFlag_ |= 2; // making real progress
     1618  solution_[sequenceIn_]=valueIn_;
     1619  if (upper_[sequenceOut_]-lower_[sequenceOut_]<1.0e-12)
     1620    progressFlag_ |= 1; // making real progress
     1621  if (sequenceIn_!=sequenceOut_) {
     1622    if (alphaAccuracy_>0.0) {
     1623      double value = fabs(alpha_);
     1624      if (value>1.0)
     1625        alphaAccuracy_ *= value;
     1626      else
     1627        alphaAccuracy_ /= value;
     1628    }
     1629    //assert( getStatus(sequenceOut_)== basic);
     1630    setStatus(sequenceIn_,basic);
     1631    if (upper_[sequenceOut_]-lower_[sequenceOut_]>0) {
     1632      // As Nonlinear costs may have moved bounds (to more feasible)
     1633      // Redo using value
     1634      if (fabs(valueOut_-lower_[sequenceOut_])<fabs(valueOut_-upper_[sequenceOut_])) {
     1635        // going to lower
     1636        setStatus(sequenceOut_,atLowerBound);
     1637        oldOut = lower_[sequenceOut_];
     1638      } else {
     1639        // going to upper
     1640        setStatus(sequenceOut_,atUpperBound);
     1641        oldOut = upper_[sequenceOut_];
     1642      }
     1643    } else {
     1644      // fixed
     1645      setStatus(sequenceOut_,isFixed);
     1646    }
     1647    solution_[sequenceOut_]=valueOut_;
     1648  } else {
     1649    //if (objective_->type()<2)
     1650    //assert (fabs(theta_)>1.0e-13);
     1651    // flip from bound to bound
     1652    // As Nonlinear costs may have moved bounds (to more feasible)
     1653    // Redo using value
     1654    if (fabs(valueIn_-lower_[sequenceIn_])<fabs(valueIn_-upper_[sequenceIn_])) {
     1655      // as if from upper bound
     1656      setStatus(sequenceIn_, atLowerBound);
     1657    } else {
     1658      // as if from lower bound
     1659      setStatus(sequenceIn_, atUpperBound);
     1660    }
     1661  }
     1662 
     1663  // Update hidden stuff e.g. effective RHS and gub
     1664  matrix_->updatePivot(this,oldIn,oldOut);
     1665  objectiveValue_ += objectiveChange/(objectiveScale_*rhsScale_);
     1666  if (handler_->detail(CLP_SIMPLEX_HOUSE2,messages_)<100) {
     1667    handler_->message(CLP_SIMPLEX_HOUSE2,messages_)
     1668      <<numberIterations_<<objectiveValue()
     1669      <<rowcol[isColumn(sequenceIn_)]<<sequenceWithin(sequenceIn_)
     1670      <<rowcol[isColumn(sequenceOut_)]<<sequenceWithin(sequenceOut_);
     1671    handler_->printing(algorithm_<0)<<dualOut_<<theta_;
     1672    handler_->printing(algorithm_>0)<<dualIn_<<theta_;
     1673    handler_->message()<<CoinMessageEol;
     1674  }
    15941675  //#define COMPUTE_INT_INFEAS
    15951676#ifdef COMPUTE_INT_INFEAS
     
    16611742  }
    16621743#endif
    1663   // save value of incoming and outgoing
    1664   double oldIn = solution_[sequenceIn_];
    1665   double oldOut = solution_[sequenceOut_];
    1666   numberIterations_++;
    1667   changeMade_++; // something has happened
    1668   // incoming variable
    1669   if (handler_->detail(CLP_SIMPLEX_HOUSE1,messages_)<100) {
    1670     handler_->message(CLP_SIMPLEX_HOUSE1,messages_)
    1671       <<directionOut_
    1672       <<directionIn_<<theta_
    1673       <<dualOut_<<dualIn_<<alpha_
    1674       <<CoinMessageEol;
    1675     if (getStatus(sequenceIn_)==isFree) {
    1676       handler_->message(CLP_SIMPLEX_FREEIN,messages_)
    1677         <<sequenceIn_
    1678         <<CoinMessageEol;
    1679     }
    1680   }
    1681   // change of incoming
    1682   char rowcol[]={'R','C'};
    1683   if (pivotRow_>=0)
    1684     pivotVariable_[pivotRow_]=sequenceIn();
    1685   if (upper_[sequenceIn_]>1.0e20&&lower_[sequenceIn_]<-1.0e20)
    1686     progressFlag_ |= 2; // making real progress
    1687   solution_[sequenceIn_]=valueIn_;
    1688   if (upper_[sequenceOut_]-lower_[sequenceOut_]<1.0e-12)
    1689     progressFlag_ |= 1; // making real progress
    1690   if (sequenceIn_!=sequenceOut_) {
    1691     if (alphaAccuracy_>0.0) {
    1692       double value = fabs(alpha_);
    1693       if (value>1.0)
    1694         alphaAccuracy_ *= value;
    1695       else
    1696         alphaAccuracy_ /= value;
    1697     }
    1698     //assert( getStatus(sequenceOut_)== basic);
    1699     setStatus(sequenceIn_,basic);
    1700     if (upper_[sequenceOut_]-lower_[sequenceOut_]>0) {
    1701       // As Nonlinear costs may have moved bounds (to more feasible)
    1702       // Redo using value
    1703       if (fabs(valueOut_-lower_[sequenceOut_])<fabs(valueOut_-upper_[sequenceOut_])) {
    1704         // going to lower
    1705         setStatus(sequenceOut_,atLowerBound);
    1706         oldOut = lower_[sequenceOut_];
    1707       } else {
    1708         // going to upper
    1709         setStatus(sequenceOut_,atUpperBound);
    1710         oldOut = upper_[sequenceOut_];
    1711       }
    1712     } else {
    1713       // fixed
    1714       setStatus(sequenceOut_,isFixed);
    1715     }
    1716     solution_[sequenceOut_]=valueOut_;
    1717   } else {
    1718     //if (objective_->type()<2)
    1719     //assert (fabs(theta_)>1.0e-13);
    1720     // flip from bound to bound
    1721     // As Nonlinear costs may have moved bounds (to more feasible)
    1722     // Redo using value
    1723     if (fabs(valueIn_-lower_[sequenceIn_])<fabs(valueIn_-upper_[sequenceIn_])) {
    1724       // as if from upper bound
    1725       setStatus(sequenceIn_, atLowerBound);
    1726     } else {
    1727       // as if from lower bound
    1728       setStatus(sequenceIn_, atUpperBound);
    1729     }
    1730   }
    1731  
    1732   // Update hidden stuff e.g. effective RHS and gub
    1733   matrix_->updatePivot(this,oldIn,oldOut);
    1734   objectiveValue_ += objectiveChange/(objectiveScale_*rhsScale_);
    1735   if (handler_->detail(CLP_SIMPLEX_HOUSE2,messages_)<100) {
    1736     handler_->message(CLP_SIMPLEX_HOUSE2,messages_)
    1737       <<numberIterations_<<objectiveValue()
    1738       <<rowcol[isColumn(sequenceIn_)]<<sequenceWithin(sequenceIn_)
    1739       <<rowcol[isColumn(sequenceOut_)]<<sequenceWithin(sequenceOut_);
    1740     handler_->printing(algorithm_<0)<<dualOut_<<theta_;
    1741     handler_->printing(algorithm_>0)<<dualIn_<<theta_;
    1742     handler_->message()<<CoinMessageEol;
    1743   }
    17441744  if (hitMaximumIterations())
    17451745    return 2;
Note: See TracChangeset for help on using the changeset viewer.